Skip to content

Commit

Permalink
Make entitlements field non-optional; remove it for PING interact…
Browse files Browse the repository at this point in the history
…ions.
  • Loading branch information
mkrasnitski committed Oct 25, 2023
1 parent a7e2b04 commit b67f459
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/model/application/command_interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub struct CommandInteraction {
/// The guild's preferred locale.
pub guild_locale: Option<String>,
/// For monetized applications, any entitlements of the invoking user.
pub entitlements: Option<Vec<Entitlement>>,
pub entitlements: Vec<Entitlement>,
}

#[cfg(feature = "model")]
Expand Down
2 changes: 1 addition & 1 deletion src/model/application/component_interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub struct ComponentInteraction {
/// The guild's preferred locale.
pub guild_locale: Option<String>,
/// For monetized applications, any entitlements of the invoking user.
pub entitlements: Option<Vec<Entitlement>>,
pub entitlements: Vec<Entitlement>,
}

#[cfg(feature = "model")]
Expand Down
8 changes: 4 additions & 4 deletions src/model/application/interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ impl Interaction {
#[must_use]
pub fn entitlements(&self) -> Option<&[Entitlement]> {
match self {
Self::Ping(i) => i.entitlements.as_deref(),
Self::Command(i) | Self::Autocomplete(i) => i.entitlements.as_deref(),
Self::Component(i) => i.entitlements.as_deref(),
Self::Modal(i) => i.entitlements.as_deref(),
Self::Ping(_) => None,
Self::Command(i) | Self::Autocomplete(i) => Some(&i.entitlements),
Self::Component(i) => Some(&i.entitlements),
Self::Modal(i) => Some(&i.entitlements),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/model/application/modal_interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub struct ModalInteraction {
/// The guild's preferred locale.
pub guild_locale: Option<String>,
/// For monetized applications, any entitlements of the invoking user.
pub entitlements: Option<Vec<Entitlement>>,
pub entitlements: Vec<Entitlement>,
}

#[cfg(feature = "model")]
Expand Down
2 changes: 0 additions & 2 deletions src/model/application/ping_interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,4 @@ pub struct PingInteraction {
pub version: u8,
/// The guild's preferred locale.
pub guild_locale: Option<String>,
/// For monetized applications, any entitlements of the invoking user.
pub entitlements: Option<Vec<Entitlement>>,
}

0 comments on commit b67f459

Please sign in to comment.