aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/model/channel/reaction.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/model/channel/reaction.rs b/src/model/channel/reaction.rs
index fbc02ad..a9d17fa 100644
--- a/src/model/channel/reaction.rs
+++ b/src/model/channel/reaction.rs
@@ -241,6 +241,33 @@ impl ReactionType {
}
}
+impl From<char> for ReactionType {
+ /// Creates a `ReactionType` from a `char`.
+ ///
+ /// # Examples
+ ///
+ /// Reacting to a message with an apple:
+ ///
+ /// ```rust,no_run
+ /// # use serenity::model::ChannelId;
+ /// # use std::error::Error;
+ /// #
+ /// # fn try_main() -> Result<(), Box<Error>> {
+ /// # let message = ChannelId(0).get_message(0)?;
+ /// #
+ /// message.react('🍎')?;
+ /// # Ok(())
+ /// # }
+ /// #
+ /// # fn main() {
+ /// # try_main().unwrap();
+ /// # }
+ /// ```
+ fn from(ch: char) -> ReactionType {
+ ReactionType::Unicode(ch.to_string())
+ }
+}
+
impl From<Emoji> for ReactionType {
fn from(emoji: Emoji) -> ReactionType {
ReactionType::Custom {