Skip to content

Commit

Permalink
Support animated emojis in Emoji's Display impl (serenity-rs#891)
Browse files Browse the repository at this point in the history
  • Loading branch information
zack37 committed Jun 22, 2020
1 parent 3965e00 commit 08d0608
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/model/guild/emoji.rs
Expand Up @@ -221,9 +221,14 @@ impl Display for Emoji {
/// Formats the emoji into a string that will cause Discord clients to
/// render the emoji.
///
/// This is in the format of: `<:NAME:EMOJI_ID>`.
/// This is in the format of either `<:NAME:EMOJI_ID>` for normal emojis,
/// or `<a:NAME:EMOJI_ID>` for animated emojis.
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
f.write_str("<:")?;
if self.animated {
f.write_str("<a:")?;
} else {
f.write_str("<:")?;
}
f.write_str(&self.name)?;
FmtWrite::write_char(f, ':')?;
Display::fmt(&self.id, f)?;
Expand Down

0 comments on commit 08d0608

Please sign in to comment.