mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 17:13:31 +01:00
ESLint stuff...
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user