feat: backport animated emojis support (#2217)

Commit: 84e4dd6a99
This commit is contained in:
SpaceEEC
2018-01-04 01:16:50 +01:00
committed by Crawl
parent c79823002b
commit 659e89e8cd
3 changed files with 19 additions and 14 deletions

View File

@@ -49,6 +49,12 @@ class Emoji {
*/
this.managed = data.managed;
/**
* Whether this emoji is animated
* @type {boolean}
*/
this.animated = data.animated;
this._roles = data.roles;
}
@@ -89,7 +95,7 @@ class Emoji {
* @readonly
*/
get url() {
return Constants.Endpoints.CDN(this.client.options.http.cdn).Emoji(this.id);
return Constants.Endpoints.CDN(this.client.options.http.cdn).Emoji(this.id, this.animated ? 'gif' : 'png');
}
/**
@@ -187,7 +193,11 @@ class Emoji {
* 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}>`;
}
/**