From 39fa324789a2d1167e7c620e780e254aebaf3a2a Mon Sep 17 00:00:00 2001 From: derpystuff <3515180-derpystuff@users.noreply.gitlab.com> Date: Fri, 30 Dec 2022 00:20:18 +0100 Subject: [PATCH] bot will now delete command replies if command is deleted --- labscore/client.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/labscore/client.js b/labscore/client.js index 85549bc..5233754 100644 --- a/labscore/client.js +++ b/labscore/client.js @@ -55,6 +55,11 @@ const { maintower } = require('./logging'); const { icon } = require('./utils/markdown'); const { editOrReply } = require('./utils/message'); +// Delete command responses if the user chooses to delete their trigger or edits the command away +commandClient.on('commandDelete', async ({context, reply}) => { + if(context.message?.deleted && !reply.deleted || !context.message.content.startsWith(commandPrefix)) reply.delete(); +}) + commandClient.on('commandRunError', async ({context, error}) => { try{ // Log the error via our maintower service