Skip to content

Commit 9296017

Browse files
authored
Remove Option around Interaction::app_permissions (#3034)
Discord documents this as always present, even with Ping interactions.
1 parent 46c6311 commit 9296017

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

src/model/application/command_interaction.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ pub struct CommandInteraction {
5555
/// Always `1`.
5656
pub version: u8,
5757
/// Permissions the app or bot has within the channel the interaction was sent from.
58-
// TODO(next): This is now always serialized.
59-
pub app_permissions: Option<Permissions>,
58+
pub app_permissions: Permissions,
6059
/// The selected language of the invoking user.
6160
pub locale: FixedString,
6261
/// The guild's preferred locale.

src/model/application/component_interaction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub struct ComponentInteraction {
5353
/// The message this interaction was triggered by, if it is a component.
5454
pub message: Box<Message>,
5555
/// Permissions the app or bot has within the channel the interaction was sent from.
56-
pub app_permissions: Option<Permissions>,
56+
pub app_permissions: Permissions,
5757
/// The selected language of the invoking user.
5858
pub locale: FixedString,
5959
/// The guild's preferred locale.

src/model/application/interaction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ impl Interaction {
5656

5757
/// Permissions the app or bot has within the channel the interaction was sent from.
5858
#[must_use]
59-
pub fn app_permissions(&self) -> Option<Permissions> {
59+
pub fn app_permissions(&self) -> Permissions {
6060
match self {
61-
Self::Ping(_) => None,
61+
Self::Ping(i) => i.app_permissions,
6262
Self::Command(i) | Self::Autocomplete(i) => i.app_permissions,
6363
Self::Component(i) => i.app_permissions,
6464
Self::Modal(i) => i.app_permissions,

src/model/application/modal_interaction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub struct ModalInteraction {
5151
#[serde(skip_serializing_if = "Option::is_none")]
5252
pub message: Option<Box<Message>>,
5353
/// Permissions the app or bot has within the channel the interaction was sent from.
54-
pub app_permissions: Option<Permissions>,
54+
pub app_permissions: Permissions,
5555
/// The selected language of the invoking user.
5656
pub locale: FixedString,
5757
/// The guild's preferred locale.

src/model/application/ping_interaction.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ pub struct PingInteraction {
1717
pub token: FixedString,
1818
/// Always `1`.
1919
pub version: u8,
20+
/// Permissions the app or bot has within the channel the interaction was sent from.
21+
pub app_permissions: Permissions,
2022
}

0 commit comments

Comments
 (0)