From fcfd0e655340079b5b44e907cebedcf9deb7fc5f Mon Sep 17 00:00:00 2001 From: janderedev Date: Mon, 24 Jan 2022 17:17:42 +0100 Subject: [PATCH] motherfuck --- src/bot/commands/purge.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bot/commands/purge.ts b/src/bot/commands/purge.ts index 0ede4f6..1eb09c0 100644 --- a/src/bot/commands/purge.ts +++ b/src/bot/commands/purge.ts @@ -77,15 +77,16 @@ export default { messages = messages.filter(m => users.find(u => u?._id == m.author_id)); } - let m = await message.reply(`Deleting ${messages.length} messages...`); + let m = await (message.channel?.sendMessage(`Deleting ${messages.length} messages...`)?.catch(console.error)); let res = await Promise.allSettled(messages.map(m => m.delete())); let failures = res.filter(r => r.status == 'rejected').length; await m?.edit({ content: `Deleted ${messages.length} messages.` - + `${failures > 0 ? `\n${failures} message${failures == 1 ? '' : 's'} failed to delete.` : ''}` }); + + `${failures > 0 ? `\n${failures} message${failures == 1 ? '' : 's'} failed to delete.` : ''}` }) + .catch(console.error); } catch(e) { - message.reply(`An error has occurred: ${e}`); + message.channel?.sendMessage(`An error has occurred: ${e}`); } } } as Command;