Skip to content

Commit

Permalink
Feat(Permissions): Set default command permissions (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
JaronZ authored Aug 28, 2021
1 parent 7cd294c commit 776aee1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/events/ready.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,26 @@ module.exports = class extends ClientEvent {
} catch (error) {
CustomConsole.log(error);
}

try {
CustomConsole.log("Setting default permission for guild (/) commands.");

for(const command of (await (await client.guilds.fetch(guildId)).commands.fetch()).values()){
await command.permissions.add({
permissions: [
{
id: process.env.OWNER,
type: "USER",
permission: true
}
]
});
}

CustomConsole.log("Successfully set default permission for guild (/) commands.");
} catch (error) {
CustomConsole.log(error);
}

CustomConsole.log(`${client.user.username} is ready`);
}
Expand Down

0 comments on commit 776aee1

Please sign in to comment.