fix(command): not handling config interaction
This commit is contained in:
parent
1975321016
commit
9a58e3db84
3 changed files with 22 additions and 5 deletions
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module github.com/anhgelus/les-copaings-bot
|
|||
go 1.24
|
||||
|
||||
require (
|
||||
github.com/anhgelus/gokord v0.11.1-0.20250807111049-5de23912c524
|
||||
github.com/anhgelus/gokord v0.11.1-0.20250821115246-50e5f7d17717
|
||||
github.com/bwmarrin/discordgo v0.29.0
|
||||
github.com/joho/godotenv v1.5.1
|
||||
github.com/pelletier/go-toml/v2 v2.2.4
|
||||
|
|
2
go.sum
2
go.sum
|
@ -12,6 +12,8 @@ github.com/anhgelus/gokord v0.11.1-0.20250806143823-567c33f63688 h1:0ngeLQxHr80X
|
|||
github.com/anhgelus/gokord v0.11.1-0.20250806143823-567c33f63688/go.mod h1:4xpwLzIG34/XG9QZiPsnYScQhckiCpQMAI0CjP0Nc2k=
|
||||
github.com/anhgelus/gokord v0.11.1-0.20250807111049-5de23912c524 h1:mK7UtqJPNYhStRVeZ2N4c89tjlhlRZX0LcLs7TAB34I=
|
||||
github.com/anhgelus/gokord v0.11.1-0.20250807111049-5de23912c524/go.mod h1:4xpwLzIG34/XG9QZiPsnYScQhckiCpQMAI0CjP0Nc2k=
|
||||
github.com/anhgelus/gokord v0.11.1-0.20250821115246-50e5f7d17717 h1:KfcBHUpwbffRO6aIITq7iN7cP7KcKmUnIE+eWiwsYYw=
|
||||
github.com/anhgelus/gokord v0.11.1-0.20250821115246-50e5f7d17717/go.mod h1:4xpwLzIG34/XG9QZiPsnYScQhckiCpQMAI0CjP0Nc2k=
|
||||
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
||||
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
|
||||
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
||||
|
|
23
main.go
23
main.go
|
@ -138,8 +138,26 @@ func main() {
|
|||
}
|
||||
|
||||
// interaction: /config
|
||||
bot.HandleMessageComponent(func(s *discordgo.Session, i *discordgo.InteractionCreate, data discordgo.MessageComponentInteractionData, resp *cmd.ResponseBuilder) {
|
||||
if len(data.Values) != 1 {
|
||||
logger.Alert("main.go - Handle config modify", "invalid data values", "values", data.Values)
|
||||
return
|
||||
}
|
||||
switch data.Values[0] {
|
||||
case config.ModifyXpRole:
|
||||
config.HandleModifyXpRole(s, i, data, resp)
|
||||
case config.ModifyFallbackChannel:
|
||||
config.HandleModifyFallbackChannel(s, i, data, resp)
|
||||
case config.ModifyDisChannel:
|
||||
config.HandleModifyDisChannel(s, i, data, resp)
|
||||
case config.ModifyTimeReduce:
|
||||
config.HandleModifyPeriodicReduce(s, i, data, resp)
|
||||
default:
|
||||
logger.Alert("main.go - Detecting value", "unkown value", "value", data.Values[0])
|
||||
return
|
||||
}
|
||||
}, commands.ConfigModify)
|
||||
// xp role related
|
||||
bot.HandleMessageComponent(config.HandleModifyXpRole, config.ModifyXpRole)
|
||||
bot.HandleMessageComponent(config.HandleXpRoleAddEdit, config.XpRoleAdd)
|
||||
bot.HandleMessageComponent(config.HandleXpRoleAddEdit, config.XpRoleEdit)
|
||||
bot.HandleMessageComponent(config.HandleXpRoleAddRole, config.XpRoleAddRole)
|
||||
|
@ -149,15 +167,12 @@ func main() {
|
|||
bot.HandleModal(config.HandleXpRoleLevel, config.XpRoleAddLevel)
|
||||
bot.HandleModal(config.HandleXpRoleLevel, config.XpRoleEditLevel)
|
||||
// channel related
|
||||
bot.HandleMessageComponent(config.HandleModifyFallbackChannel, config.ModifyFallbackChannel)
|
||||
bot.HandleMessageComponent(config.HandleFallbackChannelSet, config.FallbackChannelSet)
|
||||
bot.HandleMessageComponent(config.HandleModifyDisChannel, config.ModifyDisChannel)
|
||||
bot.HandleMessageComponent(config.HandleDisChannel, config.DisChannelAdd)
|
||||
bot.HandleMessageComponent(config.HandleDisChannel, config.DisChannelDel)
|
||||
bot.HandleMessageComponent(config.HandleDisChannelAddSet, config.DisChannelAddSet)
|
||||
bot.HandleMessageComponent(config.HandleDisChannelDelSet, config.DisChannelDelSet)
|
||||
// reduce related
|
||||
bot.HandleMessageComponent(config.HandleModifyPeriodicReduce, config.ModifyTimeReduce)
|
||||
bot.HandleModal(config.HandleTimeReduceSet, config.TimeReduceSet)
|
||||
|
||||
// xp handlers
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue