Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use twilight_util::builder::command::{BooleanBuilder, CommandBuilder, StringBuil
CommandBuilder::new(
"blep",
"Send a random adorable animal photo",
CommandType::ChatInput,
CommandType::CHAT_INPUT,
)
.option(
StringBuilder::new("animal", "The type of animal")
Expand Down
10 changes: 5 additions & 5 deletions examples/model-webhook-slash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ where

match interaction.kind {
// Return a Pong if a Ping is received.
InteractionType::Ping => {
InteractionType::PING => {
let response = InteractionResponse {
kind: InteractionResponseType::Pong,
kind: InteractionResponseType::PONG,
data: None,
};

Expand All @@ -107,7 +107,7 @@ where
.body(json.into())?)
}
// Respond to a slash command.
InteractionType::ApplicationCommand => {
InteractionType::APPLICATION_COMMAND => {
// Run the handler to gain a response.
let data = match interaction.data {
Some(InteractionData::ApplicationCommand(data)) => Some(data),
Expand Down Expand Up @@ -144,7 +144,7 @@ async fn handler(data: Box<CommandData>) -> anyhow::Result<InteractionResponse>
/// Example of a handler that returns the formatted version of the interaction.
async fn debug(data: Box<CommandData>) -> anyhow::Result<InteractionResponse> {
Ok(InteractionResponse {
kind: InteractionResponseType::ChannelMessageWithSource,
kind: InteractionResponseType::CHANNEL_MESSAGE_WITH_SOURCE,
data: Some(InteractionResponseData {
content: Some(format!("```rust\n{data:?}\n```")),
..Default::default()
Expand All @@ -155,7 +155,7 @@ async fn debug(data: Box<CommandData>) -> anyhow::Result<InteractionResponse> {
/// Example of interaction that responds with a message saying "Vroom vroom".
async fn vroom(_: Box<CommandData>) -> anyhow::Result<InteractionResponse> {
Ok(InteractionResponse {
kind: InteractionResponseType::ChannelMessageWithSource,
kind: InteractionResponseType::CHANNEL_MESSAGE_WITH_SOURCE,
data: Some(InteractionResponseData {
content: Some("Vroom vroom".to_owned()),
..Default::default()
Expand Down
18 changes: 9 additions & 9 deletions twilight-cache-inmemory/src/event/guild.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ mod tests {
icon: None,
id: Id::new(111),
invitable: None,
kind: ChannelType::GuildText,
kind: ChannelType::GUILD_TEXT,
last_message_id: None,
last_pin_timestamp: None,
member: None,
Expand Down Expand Up @@ -357,7 +357,7 @@ mod tests {
icon: None,
id: Id::new(222),
invitable: None,
kind: ChannelType::PublicThread,
kind: ChannelType::PUBLIC_THREAD,
last_message_id: None,
last_pin_timestamp: None,
member: Some(ThreadMember {
Expand All @@ -382,7 +382,7 @@ mod tests {
rtc_region: None,
thread_metadata: Some(ThreadMetadata {
archived: false,
auto_archive_duration: AutoArchiveDuration::Hour,
auto_archive_duration: AutoArchiveDuration::HOUR,
archive_timestamp: timestamp,
create_timestamp: Some(timestamp),
invitable: None,
Expand All @@ -401,11 +401,11 @@ mod tests {
approximate_presence_count: None,
banner: None,
channels,
default_message_notifications: DefaultMessageNotificationLevel::Mentions,
default_message_notifications: DefaultMessageNotificationLevel::MENTIONS,
description: None,
discovery_splash: None,
emojis: Vec::new(),
explicit_content_filter: ExplicitContentFilter::AllMembers,
explicit_content_filter: ExplicitContentFilter::ALL_MEMBERS,
features: vec![],
icon: None,
id: Id::new(123),
Expand All @@ -416,16 +416,16 @@ mod tests {
max_video_channel_users: None,
member_count: Some(25),
members: Vec::new(),
mfa_level: MfaLevel::Elevated,
mfa_level: MfaLevel::ELEVATED,
name: "this is a guild".to_owned(),
nsfw_level: NSFWLevel::AgeRestricted,
nsfw_level: NSFWLevel::AGE_RESTRICTED,
owner_id: Id::new(456),
owner: Some(false),
permissions: Some(Permissions::SEND_MESSAGES),
preferred_locale: "en-GB".to_owned(),
premium_progress_bar_enabled: true,
premium_subscription_count: Some(0),
premium_tier: PremiumTier::None,
premium_tier: PremiumTier::NONE,
presences: Vec::new(),
public_updates_channel_id: None,
roles: Vec::new(),
Expand All @@ -438,7 +438,7 @@ mod tests {
threads,
unavailable: false,
vanity_url_code: None,
verification_level: VerificationLevel::VeryHigh,
verification_level: VerificationLevel::VERY_HIGH,
voice_states: Vec::new(),
widget_channel_id: None,
widget_enabled: None,
Expand Down
8 changes: 4 additions & 4 deletions twilight-cache-inmemory/src/event/interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ mod tests {
guild_id: None,
id: Id::new(5),
name: "command name".into(),
kind: CommandType::ChatInput, // This isn't actually a valid command, so just mark it as a slash command.
kind: CommandType::CHAT_INPUT, // This isn't actually a valid command, so just mark it as a slash command.
options: Vec::new(),
resolved: Some(CommandInteractionDataResolved {
attachments: HashMap::new(),
Expand Down Expand Up @@ -158,7 +158,7 @@ mod tests {
guild_id: Some(Id::new(1)),
id: Id::new(4),
interaction: None,
kind: MessageType::Regular,
kind: MessageType::REGULAR,
member: Some(PartialMember {
avatar: None,
communication_disabled_until: None,
Expand All @@ -181,7 +181,7 @@ mod tests {
reference: None,
role_subscription_data: None,
sticker_items: vec![MessageSticker {
format_type: StickerFormatType::Png,
format_type: StickerFormatType::PNG,
id: Id::new(1),
name: "sticker name".to_owned(),
}],
Expand Down Expand Up @@ -234,7 +234,7 @@ mod tests {
guild_id: Some(Id::new(3)),
guild_locale: None,
id: Id::new(4),
kind: InteractionType::ApplicationCommand,
kind: InteractionType::APPLICATION_COMMAND,
locale: Some("en-GB".to_owned()),
member: Some(PartialMember {
avatar: None,
Expand Down
2 changes: 1 addition & 1 deletion twilight-cache-inmemory/src/event/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ mod tests {
guild_id: Some(Id::new(1)),
id: Id::new(4),
interaction: None,
kind: MessageType::Regular,
kind: MessageType::REGULAR,
member: Some(PartialMember {
avatar: None,
communication_disabled_until: None,
Expand Down
4 changes: 2 additions & 2 deletions twilight-cache-inmemory/src/event/presence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ mod tests {
let payload = PresenceUpdate(Presence {
activities: Vec::new(),
client_status: ClientStatus {
desktop: Some(Status::Online),
desktop: Some(Status::ONLINE),
mobile: None,
web: None,
},
guild_id,
status: Status::Online,
status: Status::ONLINE,
user: UserOrId::User(test::user(user_id)),
});
cache.update(&Event::PresenceUpdate(Box::new(payload)));
Expand Down
2 changes: 1 addition & 1 deletion twilight-cache-inmemory/src/event/stage_instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ mod tests {
guild_id: Id::new(2),
guild_scheduled_event_id: Some(Id::new(3)),
id: Id::new(4),
privacy_level: PrivacyLevel::GuildOnly,
privacy_level: PrivacyLevel::GUILD_ONLY,
topic: "topic".into(),
};

Expand Down
10 changes: 5 additions & 5 deletions twilight-cache-inmemory/src/model/sticker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,10 @@ mod tests {
let sticker = Sticker {
available: true,
description: Some("sticker".into()),
format_type: StickerFormatType::Png,
format_type: StickerFormatType::PNG,
guild_id: Some(Id::new(1)),
id: Id::new(2),
kind: StickerType::Guild,
kind: StickerType::GUILD,
name: "stick".into(),
pack_id: Some(Id::new(3)),
sort_value: Some(1),
Expand All @@ -210,7 +210,7 @@ mod tests {
locale: Some("en-us".to_owned()),
mfa_enabled: Some(true),
name: "test".to_owned(),
premium_type: Some(PremiumType::Nitro),
premium_type: Some(PremiumType::NITRO),
public_flags: Some(
UserFlags::PREMIUM_EARLY_SUPPORTER | UserFlags::VERIFIED_DEVELOPER,
),
Expand All @@ -222,10 +222,10 @@ mod tests {
let cached = CachedSticker {
available: true,
description: "sticker".into(),
format_type: StickerFormatType::Png,
format_type: StickerFormatType::PNG,
guild_id: Some(Id::new(1)),
id: Id::new(2),
kind: StickerType::Guild,
kind: StickerType::GUILD,
name: "stick".into(),
pack_id: Some(Id::new(3)),
sort_value: Some(1),
Expand Down
28 changes: 14 additions & 14 deletions twilight-cache-inmemory/src/permission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,9 @@ impl<'a> InMemoryCachePermissions<'a> {
.map_err(ChannelError::from_member_roles)?;

let overwrites = match channel.kind {
ChannelType::AnnouncementThread
| ChannelType::PrivateThread
| ChannelType::PublicThread => self.parent_overwrites(&channel)?,
ChannelType::ANNOUNCEMENT_THREAD
| ChannelType::PRIVATE_THREAD
| ChannelType::PUBLIC_THREAD => self.parent_overwrites(&channel)?,
_ => channel.permission_overwrites.clone().unwrap_or_default(),
};

Expand Down Expand Up @@ -715,11 +715,11 @@ mod tests {
application_id: None,
banner: None,
channels: Vec::new(),
default_message_notifications: DefaultMessageNotificationLevel::Mentions,
default_message_notifications: DefaultMessageNotificationLevel::MENTIONS,
description: None,
discovery_splash: None,
emojis: Vec::new(),
explicit_content_filter: ExplicitContentFilter::AllMembers,
explicit_content_filter: ExplicitContentFilter::ALL_MEMBERS,
features: Vec::new(),
icon: None,
joined_at: None,
Expand All @@ -728,16 +728,16 @@ mod tests {
max_presences: None,
member_count: None,
members: Vec::new(),
mfa_level: MfaLevel::Elevated,
mfa_level: MfaLevel::ELEVATED,
name: "this is a guild".to_owned(),
nsfw_level: NSFWLevel::AgeRestricted,
nsfw_level: NSFWLevel::AGE_RESTRICTED,
owner: Some(false),
owner_id: OWNER_ID,
permissions: None,
preferred_locale: "en-GB".to_owned(),
premium_progress_bar_enabled: false,
premium_subscription_count: Some(0),
premium_tier: PremiumTier::None,
premium_tier: PremiumTier::NONE,
presences: Vec::new(),
public_updates_channel_id: None,
roles: Vec::from([
Expand All @@ -756,7 +756,7 @@ mod tests {
threads: Vec::new(),
rules_channel_id: None,
unavailable: false,
verification_level: VerificationLevel::VeryHigh,
verification_level: VerificationLevel::VERY_HIGH,
voice_states: Vec::new(),
vanity_url_code: None,
widget_channel_id: None,
Expand All @@ -783,7 +783,7 @@ mod tests {
icon: None,
id: CHANNEL_ID,
invitable: None,
kind: ChannelType::GuildText,
kind: ChannelType::GUILD_TEXT,
last_message_id: None,
last_pin_timestamp: None,
member: None,
Expand All @@ -799,13 +799,13 @@ mod tests {
allow: Permissions::empty(),
deny: Permissions::CREATE_INVITE,
id: EVERYONE_ROLE_ID.cast(),
kind: PermissionOverwriteType::Role,
kind: PermissionOverwriteType::ROLE,
},
PermissionOverwrite {
allow: Permissions::EMBED_LINKS,
deny: Permissions::empty(),
id: USER_ID.cast(),
kind: PermissionOverwriteType::Member,
kind: PermissionOverwriteType::MEMBER,
},
])),
position: Some(0),
Expand Down Expand Up @@ -835,7 +835,7 @@ mod tests {
icon: None,
id: THREAD_ID,
invitable: None,
kind: ChannelType::PublicThread,
kind: ChannelType::PUBLIC_THREAD,
last_message_id: None,
last_pin_timestamp: None,
member: None,
Expand All @@ -850,7 +850,7 @@ mod tests {
allow: Permissions::ATTACH_FILES,
deny: Permissions::empty(),
id: EVERYONE_ROLE_ID.cast(),
kind: PermissionOverwriteType::Role,
kind: PermissionOverwriteType::ROLE,
}])),
position: Some(0),
rate_limit_per_user: None,
Expand Down
20 changes: 10 additions & 10 deletions twilight-cache-inmemory/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub fn cache_with_message_and_reactions() -> InMemoryCache {
guild_id: Some(Id::new(1)),
id: Id::new(4),
interaction: None,
kind: MessageType::Regular,
kind: MessageType::REGULAR,
member: Some(PartialMember {
avatar: None,
communication_disabled_until: None,
Expand Down Expand Up @@ -243,7 +243,7 @@ pub fn guild_channel_text() -> (Id<GuildMarker>, Id<ChannelMarker>, Channel) {
icon: None,
id: channel_id,
invitable: None,
kind: ChannelType::GuildText,
kind: ChannelType::GUILD_TEXT,
last_message_id: None,
last_pin_timestamp: None,
member: None,
Expand Down Expand Up @@ -307,10 +307,10 @@ pub const fn sticker(id: Id<StickerMarker>, guild_id: Id<GuildMarker>) -> Sticke
Sticker {
available: false,
description: None,
format_type: StickerFormatType::Png,
format_type: StickerFormatType::PNG,
guild_id: Some(guild_id),
id,
kind: StickerType::Standard,
kind: StickerType::STANDARD,
name: String::new(),
pack_id: None,
sort_value: None,
Expand Down Expand Up @@ -373,11 +373,11 @@ pub fn guild(id: Id<GuildMarker>, member_count: Option<u64>) -> Guild {
approximate_presence_count: None,
banner: None,
channels: Vec::new(),
default_message_notifications: DefaultMessageNotificationLevel::Mentions,
default_message_notifications: DefaultMessageNotificationLevel::MENTIONS,
description: None,
discovery_splash: None,
emojis: Vec::new(),
explicit_content_filter: ExplicitContentFilter::None,
explicit_content_filter: ExplicitContentFilter::NONE,
features: Vec::new(),
icon: None,
id,
Expand All @@ -388,16 +388,16 @@ pub fn guild(id: Id<GuildMarker>, member_count: Option<u64>) -> Guild {
max_video_channel_users: None,
member_count,
members: Vec::new(),
mfa_level: MfaLevel::None,
mfa_level: MfaLevel::NONE,
name: "test".to_owned(),
nsfw_level: NSFWLevel::Default,
nsfw_level: NSFWLevel::DEFAULT,
owner_id: Id::new(1),
owner: None,
permissions: None,
preferred_locale: "en_us".to_owned(),
premium_progress_bar_enabled: false,
premium_subscription_count: None,
premium_tier: PremiumTier::None,
premium_tier: PremiumTier::NONE,
presences: Vec::new(),
public_updates_channel_id: None,
roles: Vec::new(),
Expand All @@ -410,7 +410,7 @@ pub fn guild(id: Id<GuildMarker>, member_count: Option<u64>) -> Guild {
threads: Vec::new(),
unavailable: false,
vanity_url_code: None,
verification_level: VerificationLevel::VeryHigh,
verification_level: VerificationLevel::VERY_HIGH,
voice_states: Vec::new(),
widget_channel_id: None,
widget_enabled: None,
Expand Down
Loading