From 1fd6c2c6916862737b572d9ee30cf5d76c67dd14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 2 Sep 2021 14:39:23 +0300 Subject: [PATCH] Added messageDelete event --- src/Client.ts | 4 ++++ src/client/events/messageDelete.js | 10 ++++++++++ 2 files changed, 14 insertions(+) create mode 100644 src/client/events/messageDelete.js diff --git a/src/Client.ts b/src/Client.ts index 9bb882b..1b7e14c 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -52,6 +52,10 @@ class RadioClient extends Client { require(`${events}messageCreate`).execute(this, msg); }); + this.on("messageDelete", msg => { + require(`${events}messageDelete`).execute(this, msg); + }); + this.on("interactionCreate", interaction => { require(`${events}interactionCreate`).execute(this, interaction); }); diff --git a/src/client/events/messageDelete.js b/src/client/events/messageDelete.js new file mode 100644 index 0000000..9cce584 --- /dev/null +++ b/src/client/events/messageDelete.js @@ -0,0 +1,10 @@ +module.exports = { + name: 'messageDelete', + async execute(client, msg) { + if (!msg.author.bot || !msg.guild) return; + const radio = client.radio.get(msg.guild.id); + if (!radio) return; + if(msg.id != radio.message.id) return; + radio.message = null; + } +} \ No newline at end of file