Skip to content

Commit

Permalink
Implement From<EmojiId | EmojiIdentifier> for ReactionType (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
fenhl authored and arqunis committed Nov 13, 2017
1 parent a359f77 commit 68156c9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/model/channel/reaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,24 @@ impl From<Emoji> for ReactionType {
}
}

impl From<EmojiId> for ReactionType {
fn from(emoji_id: EmojiId) -> ReactionType {
ReactionType::Custom {
id: emoji_id,
name: None
}
}
}

impl From<EmojiIdentifier> for ReactionType {
fn from(emoji_id: EmojiIdentifier) -> ReactionType {
ReactionType::Custom {
id: emoji_id.id,
name: Some(emoji_id.name)
}
}
}

impl From<String> for ReactionType {
fn from(unicode: String) -> ReactionType { ReactionType::Unicode(unicode) }
}
Expand Down

0 comments on commit 68156c9

Please sign in to comment.