ESLint stuff...

This commit is contained in:
Amish Shah
2016-08-13 14:44:49 +01:00
parent 53d767ec04
commit b8db4c4f4b
74 changed files with 2574 additions and 2956 deletions

View File

@@ -1,51 +1,43 @@
'use strict';
const Action = require('./Action');
const Constants = require('../../util/Constants');
const Message = require('../../structures/Message');
class MessageDeleteAction extends Action {
constructor(client) {
super(client);
this.timeouts = [];
this.deleted = {};
}
constructor(client) {
super(client);
this.timeouts = [];
this.deleted = {};
}
handle(data) {
let client = this.client;
let channel = client.store.get('channels', data.channel_id);
if (channel) {
let message = channel.store.get('messages', data.id);
handle(data) {
const client = this.client;
const channel = client.store.get('channels', data.channel_id);
if (channel) {
let message = channel.store.get('messages', data.id);
if (message) {
if (message) {
channel.store.remove('messages', message.id);
this.deleted[channel.id + message.id] = message;
this.scheduleForDeletion(channel.id, message.id);
} else if (this.deleted[channel.id + data.id]) {
message = this.deleted[channel.id + data.id];
}
channel.store.remove('messages', message.id);
this.deleted[channel.id + message.id] = message;
this.scheduleForDeletion(channel.id, message.id);
return {
m: message,
};
}
} else if (this.deleted[channel.id + data.id]) {
return {
m: null,
};
}
message = this.deleted[channel.id + data.id];
}
return {
m: message,
};
}
return {
m: null,
};
}
scheduleForDeletion(channelID, messageID) {
this.timeouts.push(
setTimeout(() => delete this.deleted[channelID + messageID],
this.client.options.rest_ws_bridge_timeout)
);
}
};
scheduleForDeletion(channelID, messageID) {
this.timeouts.push(
setTimeout(() => delete this.deleted[channelID + messageID],
this.client.options.rest_ws_bridge_timeout)
);
}
}
module.exports = MessageDeleteAction;