Skip to content

Commit

Permalink
Merge branch 'main' into feat/model/user-accent-color-and-banner
Browse files Browse the repository at this point in the history
  • Loading branch information
7596ff committed Sep 8, 2021
2 parents 41303a4 + f930ae0 commit 4f008fc
Show file tree
Hide file tree
Showing 65 changed files with 1,920 additions and 446 deletions.
11 changes: 11 additions & 0 deletions cache/in-memory/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

Changelog for `twilight-cache-inmemory`.

## [0.6.1] - 2021-08-30

### Additions

Add `InMemoryCache::guild_integrations` to retrieve a guild's list of
integration IDs and `InMemoryCache::integration` to retrieve an integration by
guild and integration ID ([#1134] - [@zeylahellyer]).

[#1134]: https://github.com/twilight-rs/twilight/pull/1134

## [0.6.0] - 2021-07-31

### Changes
Expand Down Expand Up @@ -398,6 +408,7 @@ Initial release.
[#528]: https://github.com/twilight-rs/twilight/pull/528
[#524]: https://github.com/twilight-rs/twilight/pull/524

[0.6.1]: https://github.com/twilight-rs/twilight/releases/tag/cache-in-memory-0.6.1
[0.5.3]: https://github.com/twilight-rs/twilight/releases/tag/cache-in-memory-0.5.3
[0.5.2]: https://github.com/twilight-rs/twilight/releases/tag/cache-in-memory-0.5.2
[0.5.1]: https://github.com/twilight-rs/twilight/releases/tag/cache-in-memory-0.5.1
Expand Down
2 changes: 1 addition & 1 deletion cache/in-memory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ name = "twilight-cache-inmemory"
publish = false
repository = "https://github.com/twilight-rs/twilight"
readme = "README.md"
version = "0.6.0"
version = "0.6.1"

[dependencies]
bitflags = { default-features = false, version = "1" }
Expand Down
82 changes: 75 additions & 7 deletions cache/in-memory/src/event/interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,17 @@ mod tests {
application_command::{CommandData, CommandInteractionDataResolved, InteractionMember},
ApplicationCommand, InteractionType,
},
channel::{
message::{
sticker::{MessageSticker, StickerFormatType, StickerId},
MessageFlags, MessageType,
},
Message,
},
guild::{PartialMember, Permissions, Role},
id::{ApplicationId, ChannelId, CommandId, GuildId, InteractionId, RoleId, UserId},
id::{
ApplicationId, ChannelId, CommandId, GuildId, InteractionId, MessageId, RoleId, UserId,
},
user::User,
};

Expand All @@ -80,15 +89,74 @@ mod tests {
options: Vec::new(),
resolved: Some(CommandInteractionDataResolved {
channels: Vec::new(),
members: vec![InteractionMember {
members: Vec::from([InteractionMember {
hoisted_role: None,
id: UserId(7),
joined_at: Some("joined at date".into()),
nick: None,
premium_since: None,
roles: vec![RoleId(8)],
}],
roles: vec![Role {
}]),
messages: Vec::from([Message {
activity: None,
application: None,
application_id: None,
attachments: Vec::new(),
author: User {
accent_color: None,
avatar: Some("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".to_owned()),
banner: None,
bot: false,
discriminator: "0001".to_owned(),
email: None,
flags: None,
id: UserId(3),
locale: None,
mfa_enabled: None,
name: "test".to_owned(),
premium_type: None,
public_flags: None,
system: None,
verified: None,
},
channel_id: ChannelId(2),
components: Vec::new(),
content: "ping".to_owned(),
edited_timestamp: None,
embeds: Vec::new(),
flags: Some(MessageFlags::empty()),
guild_id: Some(GuildId(1)),
id: MessageId(4),
interaction: None,
kind: MessageType::Regular,
member: Some(PartialMember {
deaf: false,
joined_at: Some("2020-01-01T00:00:00.000000+00:00".to_owned()),
mute: false,
nick: Some("member nick".to_owned()),
permissions: None,
premium_since: None,
roles: Vec::new(),
user: None,
}),
mention_channels: Vec::new(),
mention_everyone: false,
mention_roles: Vec::new(),
mentions: Vec::new(),
pinned: false,
reactions: Vec::new(),
reference: None,
sticker_items: vec![MessageSticker {
format_type: StickerFormatType::Png,
id: StickerId(1),
name: "sticker name".to_owned(),
}],
referenced_message: None,
timestamp: "2020-02-02T02:02:02.020000+00:00".to_owned(),
tts: false,
webhook_id: None,
}]),
roles: Vec::from([Role {
color: 0u32,
hoist: false,
id: RoleId(8),
Expand All @@ -98,8 +166,8 @@ mod tests {
permissions: Permissions::empty(),
position: 2i64,
tags: None,
}],
users: vec![User {
}]),
users: Vec::from([User {
accent_color: None,
avatar: Some("different avatar".into()),
banner: None,
Expand All @@ -115,7 +183,7 @@ mod tests {
public_flags: None,
system: None,
verified: None,
}],
}]),
}),
},
guild_id: Some(GuildId(3)),
Expand Down
27 changes: 27 additions & 0 deletions cache/in-memory/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,16 @@ impl InMemoryCache {
self.0.guild_emojis.get(&guild_id).map(|r| r.clone())
}

/// Gets the set of integrations in a guild.
///
/// This requires the [`GUILD_INTEGRATIONS`] intent. The
/// [`ResourceType::INTEGRATION`] resource type must be enabled.
///
/// [`GUILD_INTEGRATIONS`]: twilight_model::gateway::Intents::GUILD_INTEGRATIONS
pub fn guild_integrations(&self, guild_id: GuildId) -> Option<HashSet<IntegrationId>> {
self.0.guild_integrations.get(&guild_id).map(|r| r.clone())
}

/// Gets the set of members in a guild.
///
/// This list may be incomplete if not all members have been cached.
Expand Down Expand Up @@ -458,6 +468,23 @@ impl InMemoryCache {
.map(|r| r.value().clone())
}

/// Gets an integration by guild ID and integration ID.
///
/// This is an O(1) operation. This requires the [`GUILD_INTEGRATIONS`]
/// intent. The [`ResourceType::INTEGRATION`] resource type must be enabled.
///
/// [`GUILD_INTEGRATIONS`]: twilight_model::gateway::Intents::GUILD_INTEGRATIONS
pub fn integration(
&self,
guild_id: GuildId,
integration_id: IntegrationId,
) -> Option<GuildIntegration> {
self.0
.integrations
.get(&(guild_id, integration_id))
.map(|r| r.data.clone())
}

/// Gets a member by guild ID and user ID.
///
/// This is an O(1) operation. This requires the [`GUILD_MEMBERS`] intent.
Expand Down
12 changes: 12 additions & 0 deletions gateway/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

Changelog for `twilight-gateway`.

## [0.6.2] - 2021-08-30

### Enhancements

Reduce the log level of shard resumes from INFO to DEBUG ([#1137] - [@vilgotf]).

Fix two remaining intradoc links ([#1128] - [@zeylahellyer]).

[#1137]: https://github.com/twilight-rs/twilight/pull/1137
[#1128]: https://github.com/twilight-rs/twilight/pull/1128

## [0.6.1] - 2021-08-18

### Enhancements
Expand Down Expand Up @@ -547,6 +558,7 @@ Initial release.
[#515]: https://github.com/twilight-rs/twilight/pull/515
[#512]: https://github.com/twilight-rs/twilight/pull/512

[0.6.2]: https://github.com/twilight-rs/twilight/releases/tag/gateway-0.6.2
[0.6.1]: https://github.com/twilight-rs/twilight/releases/tag/gateway-0.6.1
[0.5.5]: https://github.com/twilight-rs/twilight/releases/tag/gateway-0.5.5
[0.5.4]: https://github.com/twilight-rs/twilight/releases/tag/gateway-0.5.4
Expand Down
2 changes: 1 addition & 1 deletion gateway/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ name = "twilight-gateway"
publish = false
readme = "README.md"
repository = "https://github.com/twilight-rs/twilight.git"
version = "0.6.1"
version = "0.6.2"

[dependencies]
bitflags = { default-features = false, version = "1" }
Expand Down
2 changes: 0 additions & 2 deletions gateway/src/cluster/impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,8 +592,6 @@ impl Cluster {
///
/// Returns a [`ClusterCommandErrorType::ShardNonexistent`] error type if
/// the provided shard ID does not exist in the cluster.
///
/// [`SessionInactiveError`]: struct.SessionInactiveError.html
pub async fn send(&self, id: u64, message: Message) -> Result<(), ClusterSendError> {
let shard = self.shard(id).ok_or(ClusterSendError {
kind: ClusterSendErrorType::ShardNonexistent { id },
Expand Down
2 changes: 1 addition & 1 deletion gateway/src/cluster/scheme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl Iterator for ShardSchemeIter {
///
/// By default this is [`Auto`].
///
/// [`Auto`]: #variant.Auto
/// [`Auto`]: Self::Auto
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
#[non_exhaustive]
pub enum ShardScheme {
Expand Down
2 changes: 1 addition & 1 deletion gateway/src/shard/processor/impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ impl ShardProcessor {
/// connection.
async fn resume(&mut self) {
#[cfg(feature = "tracing")]
tracing::info!("resuming shard {:?}", self.config.shard());
tracing::debug!("resuming shard {:?}", self.config.shard());

self.session.set_stage(Stage::Resuming);
self.session.stop_heartbeater();
Expand Down
36 changes: 36 additions & 0 deletions http/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,41 @@

Changelog for `twilight-http`.

## [0.6.3] - 2021-08-30

### Additions

Support message components, including action rows, buttons, and select menus
([#1020], [#1043], [#1044], [#1090], aggregate [#1121] - [@AEnterprise],
[@AsianIntel], [@zeylahellyer], [@7596ff]).

Add comparing `StatusCode` with `u16` ([#1131] - [@zeylahellyer]).

Add API error code 30040, described as "Maximum number of prune requests has
been reached. Try again later" ([#1125] - [@zeylahellyer]).

### Enhancements

Document that `tracing` is now disabled by default ([#1129] - [@zeylahellyer]).

Add `Response<ListBody<T>>::model` and `Response<MemberListBody>::model` aliases
corresponding to their `models` equivalents ([#1123] - [@zeylahellyer]).

Display body parsing errors as a legible string if they're UTF-8 valid
([#1118] - [@AEnterprise]).

[#1131]: https://github.com/twilight-rs/twilight/pull/1131
[#1129]: https://github.com/twilight-rs/twilight/pull/1129
[#1125]: https://github.com/twilight-rs/twilight/pull/1125
[#1123]: https://github.com/twilight-rs/twilight/pull/1123
[#1121]: https://github.com/twilight-rs/twilight/pull/1121
[#1120]: https://github.com/twilight-rs/twilight/pull/1120
[#1118]: https://github.com/twilight-rs/twilight/pull/1118
[#1090]: https://github.com/twilight-rs/twilight/pull/1090
[#1044]: https://github.com/twilight-rs/twilight/pull/1044
[#1043]: https://github.com/twilight-rs/twilight/pull/1043
[#1020]: https://github.com/twilight-rs/twilight/pull/1020

## [0.6.2] - 2021-08-18

### Additions
Expand Down Expand Up @@ -1176,6 +1211,7 @@ Initial release.

[0.2.0-beta.1:app integrations]: https://github.com/discord/discord-api-docs/commit/a926694e2f8605848bda6b57d21c8817559e5cec

[0.6.3]: https://github.com/twilight-rs/twilight/releases/tag/http-0.6.3
[0.6.2]: https://github.com/twilight-rs/twilight/releases/tag/http-0.6.2
[0.5.7]: https://github.com/twilight-rs/twilight/releases/tag/http-0.5.7
[0.5.6]: https://github.com/twilight-rs/twilight/releases/tag/http-0.5.6
Expand Down
2 changes: 1 addition & 1 deletion http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ name = "twilight-http"
publish = false
readme = "README.md"
repository = "https://github.com/twilight-rs/twilight.git"
version = "0.6.2"
version = "0.6.3"

[dependencies]
hyper = { default-features = false, features = ["client", "http1", "http2", "runtime"], version = "0.14" }
Expand Down
2 changes: 1 addition & 1 deletion http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ This is enabled by default.

The `tracing` feature enables logging via the [`tracing`] crate.

This is enabled by default.
This is disabled by default.

[`native-tls`]: https://crates.io/crates/native-tls
[`hyper`]: https://crates.io/crates/hyper
Expand Down
Loading

0 comments on commit 4f008fc

Please sign in to comment.