aboutsummaryrefslogtreecommitdiff
path: root/rolereact/rolereact.go
diff options
context:
space:
mode:
Diffstat (limited to 'rolereact/rolereact.go')
-rw-r--r--rolereact/rolereact.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/rolereact/rolereact.go b/rolereact/rolereact.go
index dce4e81..44aad2a 100644
--- a/rolereact/rolereact.go
+++ b/rolereact/rolereact.go
@@ -3,6 +3,7 @@ package rolereact
import (
"context"
"slices"
+ "strconv"
"git.anhgelus.world/anhgelus/les-copaings-bot/config"
"git.anhgelus.world/anhgelus/les-copaings-bot/dynamicid"
@@ -54,9 +55,9 @@ func HandleCommand(ctx context.Context, dg bot.Session, i *interaction.Applicati
}
o := i.OptionMap()
c := o["salon"]
- var channelID string
+ var channelID uint64
if c != nil {
- channelID = c.Value.(string)
+ channelID = c.ChannelValue(ctx, dg.ChannelState()).ID
} else {
channelID = i.ChannelID
}
@@ -362,7 +363,12 @@ func HandleSetRole(ctx context.Context, dg bot.Session, i *interaction.MessageCo
},
}
} else {
- role.RoleID = i.Data.Values[0]
+ var err error
+ role.RoleID, err = strconv.ParseUint(i.Data.Values[0], 10, 64)
+ if err != nil {
+ // panic because must ensure before that the value is valid
+ panic(err)
+ }
responseData = MessageModifyRoleData(ctx, i.Interaction, params, "")
}
err := interaction.Respond(i.Interaction, &interaction.Response{