animated emojis (#2182)

This commit is contained in:
Gus Caplan
2017-12-31 13:20:52 -06:00
committed by Crawl
parent 59d5c5a947
commit 84e4dd6a99
3 changed files with 21 additions and 8 deletions

View File

@@ -45,6 +45,12 @@ class Emoji extends Base {
*/
this.managed = data.managed;
/**
* Whether this emoji is animated
* @type {boolean}
*/
this.animated = data.animated;
this._roles = data.roles;
}
@@ -85,7 +91,7 @@ class Emoji extends Base {
* @readonly
*/
get url() {
return this.client.rest.cdn.Emoji(this.id);
return this.client.rest.cdn.Emoji(this.id, this.animated ? 'gif' : 'png');
}
/**
@@ -198,7 +204,11 @@ class Emoji extends Base {
* msg.reply(`Hello! ${emoji}`);
*/
toString() {
return this.requiresColons ? `<:${this.name}:${this.id}>` : this.name;
if (!this.id || !this.requiresColons) {
return this.name;
}
return `<${this.animated ? 'a' : ''}:${this.name}:${this.id}>`;
}
/**