Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Option around Interaction::app_permissions #3034

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/model/application/command_interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ pub struct CommandInteraction {
/// Always `1`.
pub version: u8,
/// Permissions the app or bot has within the channel the interaction was sent from.
// TODO(next): This is now always serialized.
pub app_permissions: Option<Permissions>,
pub app_permissions: Permissions,
/// The selected language of the invoking user.
pub locale: FixedString,
/// The guild's preferred locale.
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 @@ -53,7 +53,7 @@ pub struct ComponentInteraction {
/// The message this interaction was triggered by, if it is a component.
pub message: Box<Message>,
/// Permissions the app or bot has within the channel the interaction was sent from.
pub app_permissions: Option<Permissions>,
pub app_permissions: Permissions,
/// The selected language of the invoking user.
pub locale: FixedString,
/// The guild's preferred locale.
Expand Down
4 changes: 2 additions & 2 deletions src/model/application/interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ impl Interaction {

/// Permissions the app or bot has within the channel the interaction was sent from.
#[must_use]
pub fn app_permissions(&self) -> Option<Permissions> {
pub fn app_permissions(&self) -> Permissions {
match self {
Self::Ping(_) => None,
Self::Ping(i) => i.app_permissions,
Self::Command(i) | Self::Autocomplete(i) => i.app_permissions,
Self::Component(i) => i.app_permissions,
Self::Modal(i) => i.app_permissions,
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 @@ -51,7 +51,7 @@ pub struct ModalInteraction {
#[serde(skip_serializing_if = "Option::is_none")]
pub message: Option<Box<Message>>,
/// Permissions the app or bot has within the channel the interaction was sent from.
pub app_permissions: Option<Permissions>,
pub app_permissions: Permissions,
/// The selected language of the invoking user.
pub locale: FixedString,
/// The guild's preferred locale.
Expand Down
2 changes: 2 additions & 0 deletions src/model/application/ping_interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ pub struct PingInteraction {
pub token: FixedString,
/// Always `1`.
pub version: u8,
/// Permissions the app or bot has within the channel the interaction was sent from.
pub app_permissions: Permissions,
}
Loading