Skip to content

Commit

Permalink
Channel type restriction (#1015)
Browse files Browse the repository at this point in the history
  • Loading branch information
FedorLap2006 committed Oct 10, 2021
1 parent 842ddb3 commit 4249df2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 6 additions & 1 deletion examples/slash_commands/main.go
Expand Up @@ -76,7 +76,12 @@ var (
Type: discordgo.ApplicationCommandOptionChannel,
Name: "channel-option",
Description: "Channel option",
Required: false,
// Channel type mask
ChannelTypes: []discordgo.ChannelType{
discordgo.ChannelTypeGuildText,
discordgo.ChannelTypeGuildVoice,
},
Required: false,
},
{
Type: discordgo.ApplicationCommandOptionUser,
Expand Down
7 changes: 4 additions & 3 deletions interactions.go
Expand Up @@ -89,9 +89,10 @@ type ApplicationCommandOption struct {
// NOTE: This feature was on the API, but at some point developers decided to remove it.
// So I commented it, until it will be officially on the docs.
// Default bool `json:"default"`
Required bool `json:"required"`
Choices []*ApplicationCommandOptionChoice `json:"choices"`
Options []*ApplicationCommandOption `json:"options"`
Required bool `json:"required"`
Choices []*ApplicationCommandOptionChoice `json:"choices"`
Options []*ApplicationCommandOption `json:"options"`
ChannelTypes []ChannelType `json:"channel_types"`
}

// ApplicationCommandOptionChoice represents a slash command option choice.
Expand Down

0 comments on commit 4249df2

Please sign in to comment.