bot will now delete command replies if command is deleted

This commit is contained in:
derpystuff 2022-12-30 00:20:18 +01:00
parent a50e70fb1c
commit 39fa324789

View file

@ -55,6 +55,11 @@ const { maintower } = require('./logging');
const { icon } = require('./utils/markdown'); const { icon } = require('./utils/markdown');
const { editOrReply } = require('./utils/message'); 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}) => { commandClient.on('commandRunError', async ({context, error}) => {
try{ try{
// Log the error via our maintower service // Log the error via our maintower service