Mutes: don't crash if the loading message for !mutes was already deleted

This commit is contained in:
Dragory 2019-07-11 12:37:49 +03:00
parent 633da55ccf
commit d1a9cf6dc9

View file

@ -8,6 +8,7 @@ import {
DBDateFormat, DBDateFormat,
errorMessage, errorMessage,
INotifyUserResult, INotifyUserResult,
noop,
notifyUser, notifyUser,
NotifyUserStatus, NotifyUserStatus,
stripObjectToScalars, stripObjectToScalars,
@ -433,7 +434,9 @@ export class MutesPlugin extends ZeppelinPlugin<IMutesPluginConfig> {
lines.push( lines.push(
...manuallyMutedMembers.map(member => { ...manuallyMutedMembers.map(member => {
return `<@!${member.id}> (**${member.user.username}#${member.user.discriminator}**, \`${member.id}\`) 🔧 Manual mute`; return `<@!${member.id}> (**${member.user.username}#${member.user.discriminator}**, \`${
member.id
}\`) 🔧 Manual mute`;
}), }),
); );
} }
@ -447,7 +450,7 @@ export class MutesPlugin extends ZeppelinPlugin<IMutesPluginConfig> {
message = hasFilters ? "No mutes found with the specified filters!" : "No active mutes!"; message = hasFilters ? "No mutes found with the specified filters!" : "No active mutes!";
} }
await loadingMessage.delete(); await loadingMessage.delete().catch(noop);
const chunks = chunkMessageLines(message); const chunks = chunkMessageLines(message);
for (const chunk of chunks) { for (const chunk of chunks) {
msg.channel.createMessage(chunk); msg.channel.createMessage(chunk);