From 7ada70f856debf03be3ae30603c868260f649a00 Mon Sep 17 00:00:00 2001 From: Amish Shah Date: Sat, 13 Aug 2016 16:41:06 +0100 Subject: [PATCH] update back to v6 (again) and start work patching the lib --- src/structures/datastore/ClientDataStore.js | 6 +++--- src/util/Constants.js | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/structures/datastore/ClientDataStore.js b/src/structures/datastore/ClientDataStore.js index 4d0dd0a87..b62e97af5 100644 --- a/src/structures/datastore/ClientDataStore.js +++ b/src/structures/datastore/ClientDataStore.js @@ -46,15 +46,15 @@ class ClientDataStore extends AbstractDataStore { let guild = $guild; const already = this.get('channels', data.id); let channel; - if (data.is_private) { + if (data.type === Constants.ChannelTypes.DM) { channel = new DMChannel(this.client, data); } else { guild = guild || this.get('guilds', data.guild_id); if (guild) { - if (data.type === 'text') { + if (data.type === Constants.ChannelTypes.text) { channel = new TextChannel(guild, data); guild.store.add('channels', channel); - } else if (data.type === 'voice') { + } else if (data.type === Constants.ChannelTypes.voice) { channel = new VoiceChannel(guild, data); guild.store.add('channels', channel); } diff --git a/src/util/Constants.js b/src/util/Constants.js index 69780c241..bfaf84e57 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -10,7 +10,7 @@ exports.DefaultOptions = { $referring_domain: '', }, }, - protocol_version: 5, + protocol_version: 6, max_message_cache: 200, rest_ws_bridge_timeout: 5000, }; @@ -22,6 +22,13 @@ exports.Status = { IDLE: 3, }; +exports.ChannelTypes = { + text: 0, + DM: 1, + voice: 2, + groupDM: 3, +}; + exports.Package = require('../../package.json'); exports.Errors = {