aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me>2024-04-27 18:32:42 +0200
committerAnhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me>2024-04-27 18:32:42 +0200
commit31930986fbff968d8517da0187c0de65d85ab79f (patch)
tree1088470fbf8a54b3145a002e55907b8da991706a /main.go
parent460e2ee8815be4f809b1df9fd7894f9804ad9c81 (diff)
feat(deps): update to gokord v0.4.0
Diffstat (limited to 'main.go')
-rw-r--r--main.go23
1 files changed, 17 insertions, 6 deletions
diff --git a/main.go b/main.go
index 5baeab7..a33fe30 100644
--- a/main.go
+++ b/main.go
@@ -11,14 +11,23 @@ import (
"time"
)
-var token string
+var (
+ token string
+ forgeCmdRegistering bool
+)
const (
- Version = "2.2.2" // git version: 0.2.2 (it's the v2 of the bot)
+ Version = "2.2.3" // git version: 0.2.3 (it's the v2 of the bot)
)
func init() {
flag.StringVar(&token, "token", "", "token of the bot")
+ flag.BoolVar(
+ &forgeCmdRegistering,
+ "forge-command-registering",
+ false,
+ "force the registration of command",
+ )
flag.Parse()
}
@@ -33,6 +42,8 @@ func main() {
panic(err)
}
+ adm := gokord.AdminPermission
+
rankCmd := gokord.NewCommand("rank", "Affiche le niveau d'un copaing").
HasOption().
AddOption(gokord.NewOption(
@@ -98,7 +109,7 @@ func main() {
"Salon textuel par défaut",
).IsRequired()).
SetHandler(commands.ConfigFallbackChannel),
- ).SetPermission(gokord.AdminPermission)
+ ).SetPermission(&adm)
topCmd := gokord.NewCommand("top", "Copaings les plus actifs").
HasOption().
@@ -107,7 +118,7 @@ func main() {
resetCmd := gokord.NewCommand("reset", "Reset l'xp").
HasOption().
SetHandler(commands.Reset).
- SetPermission(gokord.AdminPermission)
+ SetPermission(&adm)
resetUserCmd := gokord.NewCommand("reset-user", "Reset l'xp d'un utilisation").
HasOption().
@@ -117,7 +128,7 @@ func main() {
"Copaing a reset",
).IsRequired()).
SetHandler(commands.ResetUser).
- SetPermission(gokord.AdminPermission)
+ SetPermission(&adm)
creditsCmd := gokord.NewCommand("credits", "Crédits").
HasOption().
@@ -153,7 +164,7 @@ func main() {
},
AfterInit: afterInit,
}
- bot.Start()
+ bot.Start(forgeCmdRegistering)
xp.CloseRedisClient()
}