Skip to content

Commit

Permalink
Implement From<Into<String>> for AutocompleteChoice (#2618)
Browse files Browse the repository at this point in the history
This moves all the Poise `AutocompleteChoice` functionality into Serenity,
so Poise's wrapper can be removed when updating to 0.12.
  • Loading branch information
GnomedDev authored and arqunis committed Nov 24, 2023
1 parent f8327f5 commit 8d8831e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/builder/create_interaction_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,14 @@ impl AutocompleteChoice {
}
}

impl<S: Into<String>> From<S> for AutocompleteChoice {
fn from(value: S) -> Self {
let value = value.into();
let name = value.clone();
Self::new(name, value)
}
}

/// [Discord docs](https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-autocomplete)
#[derive(Clone, Debug, Default, Serialize)]
#[must_use]
Expand Down

0 comments on commit 8d8831e

Please sign in to comment.