added emoji support (#503)

This commit is contained in:
Zman840
2016-08-06 17:29:17 -05:00
committed by abal
parent 0a648e80c9
commit c0ef815f9d
7 changed files with 145 additions and 12 deletions

View File

@@ -13,6 +13,7 @@ import User from "./User";
import TextChannel from "./TextChannel";
import VoiceChannel from "./VoiceChannel";
import Role from "./Role";
import Emoji from "./Emoji";
import {reg} from "../Util/ArgumentRegulariser";
var strictKeys = [
@@ -42,6 +43,7 @@ export default class Server extends Equality {
this.members = new Cache();
this.channels = new Cache();
this.roles = new Cache();
this.emojis = new Cache();
this.icon = data.icon;
this.afkTimeout = data.afk_timeout;
this.afkChannelID = data.afk_channel_id || data.afkChannelID;
@@ -57,6 +59,14 @@ export default class Server extends Equality {
});
}
if (data.emojis instanceof Cache) {
data.emojis.forEach((emoji) => this.emojis.add(emoji));
} else {
data.emojis.forEach((dataEmoji) => {
this.emojis.add(new Emoji(dataEmoji, this));
})
}
if (data.members instanceof Cache) {
data.members.forEach((member) => this.members.add(member));
} else {