Skip to content

Commit

Permalink
fix(Command): set default permission for admin-only commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Kesuaheli committed Jan 1, 2025
1 parent 3edec80 commit a382865
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions modules/adventcalendar/chatCommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func (Chat) AppCmd() *discordgo.ApplicationCommand {
DescriptionLocalizations: *util.TranslateLocalization(tp + "option.draw.description"),
},
},
DefaultMemberPermissions: util.IntZero(), // Set to '0' to deny for everyone by default. See https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-using-default-permissions
}
}

Expand Down
1 change: 1 addition & 0 deletions modules/secretsanta/chatCommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func (Chat) AppCmd() *discordgo.ApplicationCommand {
DescriptionLocalizations: *util.TranslateLocalization(tp + "cmd.option.update.description"),
},
},
DefaultMemberPermissions: util.IntZero(), // Set to '0' to deny for everyone by default. See https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-using-default-permissions
}
}

Expand Down
7 changes: 4 additions & 3 deletions modules/secretsanta/messageCommandSetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ type MsgCmd struct {
// AppCmd (ApplicationCommand) returns the definition of the chat command
func (cmd *MsgCmd) AppCmd() *discordgo.ApplicationCommand {
return &discordgo.ApplicationCommand{
Type: discordgo.MessageApplicationCommand,
Name: lang.GetDefault(tp + "base"),
NameLocalizations: util.TranslateLocalization(tp + "base"),
Type: discordgo.MessageApplicationCommand,
Name: lang.GetDefault(tp + "base"),
NameLocalizations: util.TranslateLocalization(tp + "base"),
DefaultMemberPermissions: util.IntZero(), // Set to '0' to deny for everyone by default. See https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-using-default-permissions
}
}

Expand Down

0 comments on commit a382865

Please sign in to comment.