Migrate most of the Client Data Store to Clien

This commit is contained in:
Amish Shah
2016-08-19 22:21:30 +01:00
parent ad8b4c7698
commit 82ab92ca2a
31 changed files with 75 additions and 55 deletions

View File

@@ -10,7 +10,7 @@ class ChannelDeleteAction extends Action {
handle(data) {
const client = this.client;
let channel = client.store.get('channels', data.id);
let channel = client.channels.get(data.id);
if (channel) {
client.store.killChannel(channel);

View File

@@ -6,7 +6,7 @@ class ChannelUpdateAction extends Action {
handle(data) {
const client = this.client;
const channel = client.store.get('channels', data.id);
const channel = client.channels.get(data.id);
if (channel) {
const oldChannel = cloneObject(channel);

View File

@@ -11,7 +11,7 @@ class GuildDeleteAction extends Action {
handle(data) {
const client = this.client;
let guild = client.store.get('guilds', data.id);
let guild = client.guilds.get(data.id);
if (guild) {
if (guild.available && data.unavailable) {
@@ -26,7 +26,7 @@ class GuildDeleteAction extends Action {
};
}
// delete guild
client.store.remove('guilds', guild);
client.guilds.delete(guild.id);
this.deleted[guild.id] = guild;
this.scheduleForDeletion(guild.id);
} else if (this.deleted[data.id]) {

View File

@@ -11,7 +11,7 @@ class GuildMemberRemoveAction extends Action {
handle(data) {
const client = this.client;
const guild = client.store.get('guilds', data.guild_id);
const guild = client.guilds.get(data.guild_id);
if (guild) {
let member = guild.members.get(data.user.id);
if (member) {

View File

@@ -6,7 +6,7 @@ class GuildRoleCreate extends Action {
handle(data) {
const client = this.client;
const guild = client.store.get('guilds', data.guild_id);
const guild = client.guilds.get(data.guild_id);
if (guild) {
const already = guild.roles.get(data.role.id);

View File

@@ -11,7 +11,7 @@ class GuildRoleDeleteAction extends Action {
handle(data) {
const client = this.client;
const guild = client.store.get('guilds', data.guild_id);
const guild = client.guilds.get(data.guild_id);
if (guild) {
let exists = guild.roles.get(data.role_id);

View File

@@ -6,7 +6,7 @@ class GuildRoleUpdateAction extends Action {
handle(data) {
const client = this.client;
const guild = client.store.get('guilds', data.guild_id);
const guild = client.guilds.get(data.guild_id);
const roleData = data.role;

View File

@@ -12,7 +12,7 @@ class GuildUpdateAction extends Action {
handle(data) {
const client = this.client;
const guild = client.store.get('guilds', data.id);
const guild = client.guilds.get(data.id);
if (guild) {
const oldGuild = cloneObject(guild);

View File

@@ -5,7 +5,7 @@ class MessageCreateAction extends Action {
handle(data) {
const client = this.client;
const channel = client.store.get('channels', data.channel_id);
const channel = client.channels.get(data.channel_id);
if (channel) {
const message = channel._cacheMessage(new Message(channel, data, client));

View File

@@ -10,7 +10,7 @@ class MessageDeleteAction extends Action {
handle(data) {
const client = this.client;
const channel = client.store.get('channels', data.channel_id);
const channel = client.channels.get(data.channel_id);
if (channel) {
let message = channel.messages.get(data.id);

View File

@@ -6,7 +6,7 @@ class MessageUpdateAction extends Action {
handle(data) {
const client = this.client;
const channel = client.store.get('channels', data.channel_id);
const channel = client.channels.get(data.channel_id);
if (channel) {
const message = channel.messages.get(data.id);