From 4249df23593402d61602c4c0671c9e8859379321 Mon Sep 17 00:00:00 2001 From: Fedor Lapshin Date: Sun, 10 Oct 2021 17:59:59 +0300 Subject: [PATCH] Channel type restriction (#1015) --- examples/slash_commands/main.go | 7 ++++++- interactions.go | 7 ++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/slash_commands/main.go b/examples/slash_commands/main.go index 64e37bfc6..1cb3dead0 100644 --- a/examples/slash_commands/main.go +++ b/examples/slash_commands/main.go @@ -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, diff --git a/interactions.go b/interactions.go index 1bb244ec3..49e62151b 100644 --- a/interactions.go +++ b/interactions.go @@ -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.