Channel type restriction (#1015)

This commit is contained in:
Fedor Lapshin 2021-10-10 17:59:59 +03:00 committed by GitHub
parent 842ddb357a
commit 4249df2359
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View file

@ -76,7 +76,12 @@ var (
Type: discordgo.ApplicationCommandOptionChannel, Type: discordgo.ApplicationCommandOptionChannel,
Name: "channel-option", Name: "channel-option",
Description: "Channel option", Description: "Channel option",
Required: false, // Channel type mask
ChannelTypes: []discordgo.ChannelType{
discordgo.ChannelTypeGuildText,
discordgo.ChannelTypeGuildVoice,
},
Required: false,
}, },
{ {
Type: discordgo.ApplicationCommandOptionUser, Type: discordgo.ApplicationCommandOptionUser,

View file

@ -89,9 +89,10 @@ type ApplicationCommandOption struct {
// NOTE: This feature was on the API, but at some point developers decided to remove it. // 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. // So I commented it, until it will be officially on the docs.
// Default bool `json:"default"` // Default bool `json:"default"`
Required bool `json:"required"` Required bool `json:"required"`
Choices []*ApplicationCommandOptionChoice `json:"choices"` Choices []*ApplicationCommandOptionChoice `json:"choices"`
Options []*ApplicationCommandOption `json:"options"` Options []*ApplicationCommandOption `json:"options"`
ChannelTypes []ChannelType `json:"channel_types"`
} }
// ApplicationCommandOptionChoice represents a slash command option choice. // ApplicationCommandOptionChoice represents a slash command option choice.