Skip to content

Commit

Permalink
Remove deprecated CreateInteractionResponse::PremiumRequired variant (
Browse files Browse the repository at this point in the history
#2928)

This was deprecated on `current` in #2905, so it can be removed here on
`next`.
  • Loading branch information
mkrasnitski authored and GnomedDev committed Aug 16, 2024
1 parent 58e270d commit 3605dc1
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions src/builder/create_interaction_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,12 @@ pub enum CreateInteractionResponse<'a> {
///
/// Corresponds to Discord's `MODAL`.
Modal(CreateModal<'a>),
/// Not valid for autocomplete and Ping interactions. Only available for applications with
/// monetization enabled.
///
/// Responds to the interaction with an upgrade button.
///
/// Corresponds to Discord's `PREMIUM_REQUIRED'.
#[deprecated = "use premium button components via `CreateButton::new_premium` instead"]
PremiumRequired,
}

impl serde::Serialize for CreateInteractionResponse<'_> {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> StdResult<S::Ok, S::Error> {
use serde::ser::Error as _;

#[allow(deprecated)]
#[allow(clippy::match_same_arms)] // hurts readability
json!({
"type": match self {
Expand All @@ -81,7 +72,6 @@ impl serde::Serialize for CreateInteractionResponse<'_> {
Self::UpdateMessage(_) => 7,
Self::Autocomplete(_) => 8,
Self::Modal(_) => 9,
Self::PremiumRequired => 10,
},
"data": match self {
Self::Pong => Value::Null,
Expand All @@ -91,7 +81,6 @@ impl serde::Serialize for CreateInteractionResponse<'_> {
Self::UpdateMessage(x) => serde_json::to_value(x).map_err(S::Error::custom)?,
Self::Autocomplete(x) => serde_json::to_value(x).map_err(S::Error::custom)?,
Self::Modal(x) => serde_json::to_value(x).map_err(S::Error::custom)?,
Self::PremiumRequired => Value::Null,
}
})
.serialize(serializer)
Expand Down

0 comments on commit 3605dc1

Please sign in to comment.