Fix unknown message error due to failed reaction
This commit is contained in:
parent
36a19c4ba8
commit
5a50b41426
1 changed files with 17 additions and 9 deletions
|
@ -23,12 +23,17 @@ class MessageInvalidListener extends Listener {
|
||||||
|
|
||||||
let reaction;
|
let reaction;
|
||||||
if (!message.guild || message.channel.permissionsFor(this.client.user).has('ADD_REACTIONS')) {
|
if (!message.guild || message.channel.permissionsFor(this.client.user).has('ADD_REACTIONS')) {
|
||||||
|
try {
|
||||||
await Promise.all(message.reactions.filter(r => r.me).map(r => r.users.remove()));
|
await Promise.all(message.reactions.filter(r => r.me).map(r => r.users.remove()));
|
||||||
reaction = await message.react('📝');
|
reaction = await message.react('📝');
|
||||||
|
} catch (e) {
|
||||||
|
// Ignore.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const [ok, response] = await this.client.myriad.postEval(parse.language, parse.code);
|
const [ok, response] = await this.client.myriad.postEval(parse.language, parse.code);
|
||||||
if (!message.guild || message.channel.permissionsFor(this.client.user).has('ADD_REACTIONS')) {
|
if (!message.guild || message.channel.permissionsFor(this.client.user).has('ADD_REACTIONS')) {
|
||||||
|
try {
|
||||||
if (reaction) {
|
if (reaction) {
|
||||||
reaction.users.remove();
|
reaction.users.remove();
|
||||||
}
|
}
|
||||||
|
@ -38,6 +43,9 @@ class MessageInvalidListener extends Listener {
|
||||||
} else {
|
} else {
|
||||||
message.react('✖');
|
message.react('✖');
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Ignore.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const output = `\`\`\`\n${response}\n\`\`\``;
|
const output = `\`\`\`\n${response}\n\`\`\``;
|
||||||
|
|
Loading…
Reference in a new issue