Skip to content

Commit

Permalink
[New] Added guildDelete event to delete registered slash commands if …
Browse files Browse the repository at this point in the history
…the bot got kicked or the guild is no longer available
  • Loading branch information
naseif committed Aug 29, 2021
1 parent e6ec6af commit 8bbed18
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion events/guildCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ const { registerSlashCommands } = require("../deploy-commands");
module.exports = {
name: "guildCreate",
async execute(guild) {
await registerSlashCommands(guild.client.user.id, guild.id);
await registerSlashCommands(guild.client.user.id, guild.id);
},
};
10 changes: 10 additions & 0 deletions events/guildDelete.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
name: "guildDelete",
async execute(guild) {
try {
await guild.commands.set([]);
} catch (err) {
console.error(`Something went wrong, ${err.message}`);
}
},
};

0 comments on commit 8bbed18

Please sign in to comment.