From b567de22772d44d49e3d2d152f7635a553610ef6 Mon Sep 17 00:00:00 2001 From: JandereDev Date: Tue, 19 Apr 2022 12:01:14 +0200 Subject: [PATCH] minor trolling --- bridge/src/revolt/events.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bridge/src/revolt/events.ts b/bridge/src/revolt/events.ts index f92b112..9152b71 100644 --- a/bridge/src/revolt/events.ts +++ b/bridge/src/revolt/events.ts @@ -22,9 +22,13 @@ client.on('message/delete', async id => { const targetMsg = await discordFetchMessage(bridgedMsg.discord.messageId, bridgeCfg.discord); if (!targetMsg) return logger.debug(`Revolt: Could not fetch message from Discord`); - const client = new WebhookClient({ id: bridgeCfg.discordWebhook.id, token: bridgeCfg.discordWebhook.token }); - await client.deleteMessage(bridgedMsg.discord.messageId); - client.destroy(); + if (targetMsg.webhookId && targetMsg.webhookId == bridgeCfg.discordWebhook.id) { + const client = new WebhookClient({ id: bridgeCfg.discordWebhook.id, token: bridgeCfg.discordWebhook.token }); + await client.deleteMessage(bridgedMsg.discord.messageId); + client.destroy(); + } else if (targetMsg.deletable) { + targetMsg.delete(); + } else logger.debug(`Revolt: Unable to delete Discord message`); } catch(e) { console.error(e); }