Skip to content

Commit

Permalink
feat(interactions#GuildAllChannelsID): error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
FedorLap2006 committed Apr 28, 2022
1 parent 20dfaef commit 0960a2e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions interactions.go
Expand Up @@ -134,9 +134,14 @@ type ApplicationCommandPermissions struct {

// 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-1, 10)
func GuildAllChannelsID(guild string) (id string, err error) {
var v uint64
v, err = strconv.ParseUint(guild, 10, 64)
if err != nil {
return
}

return strconv.FormatUint(v-1, 10), nil
}

// ApplicationCommandPermissionsList represents a list of ApplicationCommandPermissions, needed for serializing to JSON.
Expand Down

0 comments on commit 0960a2e

Please sign in to comment.