From a382865d688cf32867bae216df10d8498dcfd5f7 Mon Sep 17 00:00:00 2001 From: Kesuaheli Date: Wed, 1 Jan 2025 19:32:51 +0100 Subject: [PATCH] fix(Command): set default permission for admin-only commands --- modules/adventcalendar/chatCommand.go | 1 + modules/secretsanta/chatCommand.go | 1 + modules/secretsanta/messageCommandSetup.go | 7 ++++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/adventcalendar/chatCommand.go b/modules/adventcalendar/chatCommand.go index d9ab10a..b1fcd8e 100644 --- a/modules/adventcalendar/chatCommand.go +++ b/modules/adventcalendar/chatCommand.go @@ -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 } } diff --git a/modules/secretsanta/chatCommand.go b/modules/secretsanta/chatCommand.go index f6cf17e..f5b5cd5 100644 --- a/modules/secretsanta/chatCommand.go +++ b/modules/secretsanta/chatCommand.go @@ -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 } } diff --git a/modules/secretsanta/messageCommandSetup.go b/modules/secretsanta/messageCommandSetup.go index dd7da1e..ae0a6c9 100644 --- a/modules/secretsanta/messageCommandSetup.go +++ b/modules/secretsanta/messageCommandSetup.go @@ -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 } }