diff --git a/interactions.go b/interactions.go index 28a9b1d80..61944bcda 100644 --- a/interactions.go +++ b/interactions.go @@ -8,8 +8,8 @@ import ( "fmt" "io" "io/ioutil" - "math/big" "net/http" + "strconv" "time" ) @@ -48,13 +48,6 @@ type ApplicationCommand struct { Options []*ApplicationCommandOption `json:"options"` } -// GuildAllChannelsID is function which returns guild_id-1. -// It is used in ApplicationCommandPermission to target all the channels within a guild -func GuildAllChannelsID(guild string) (id string) { - res, _ := new(big.Int).SetString(guild, 10) - return res.Sub(res, big.NewInt(1)).String() -} - // ApplicationCommandOptionType indicates the type of a slash command's option. type ApplicationCommandOptionType uint8 @@ -139,6 +132,13 @@ type ApplicationCommandPermissions struct { Permission bool `json:"permission"` } +// GuildAllChannelsID is a helper function which returns guild_id-1. +// It is used in ApplicationCommandPermissions to target all the channels within a guild +func GuildAllChannelsID(guild string) (id string) { + v, _ := strconv.ParseUint(guild, 10, 64) + return strconv.FormatUint(v, 10) +} + // ApplicationCommandPermissionsList represents a list of ApplicationCommandPermissions, needed for serializing to JSON. type ApplicationCommandPermissionsList struct { Permissions []*ApplicationCommandPermissions `json:"permissions"`