From 9339f70a8692c130d1601ca6792179538bd457b7 Mon Sep 17 00:00:00 2001 From: Will Hunt <half-shot@molrams.com> Date: Thu, 14 Sep 2017 09:46:28 +0100 Subject: [PATCH] Delete message from discord --- src/bot.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/bot.ts b/src/bot.ts index fbdf291..88f3897 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -254,7 +254,13 @@ export class DiscordBot { } const channel = <Discord.TextChannel> this.bot.guilds.get(storeEvent.GuildId) .channels.get(storeEvent.ChannelId); - await channel.fetchMessage(storeEvent.DiscordId); + const msg = await channel.fetchMessage(storeEvent.DiscordId); + try { + await msg.delete(); + log.info("DiscordBot", `Deleted message`); + } catch (ex) { + log.warn("DiscordBot", `Failed to delete message`, ex); + } } } -- GitLab