discord_bot/commands/misc/say.js
SileNce5k a82b62340e
Fix say command failing when permissions are missing
Bot tries to delete the say message of the author, but if the bot does
not have permissions to delete messages, it will crash the bot.
2023-12-06 13:28:46 +01:00

18 lines
No EOL
407 B
JavaScript

module.exports = {
name: 'say',
description: 'Repeats arguments',
execute({message, args}) {
if(args.length == 0)
message.channel.send("Can't send empty message");
else{
message.channel.send(args.join(" "))
try{
message.delete()
}catch{
console.log(this.name, ": An error happened while trying to delete the original message.\nProbably because of permissions.")
}
}
}
};