aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.env.example1
-rw-r--r--Dockerfile4
-rw-r--r--go.mod4
-rw-r--r--go.sum6
-rw-r--r--main.go36
-rw-r--r--updates.json10
6 files changed, 39 insertions, 22 deletions
diff --git a/.env.example b/.env.example
index a98e8bb..cd13f27 100644
--- a/.env.example
+++ b/.env.example
@@ -9,4 +9,3 @@ POSTGRES_DB=les-copaings
# Bot #
##############
TOKEN=your_token
-FORCE_COMMAND_REGISTRATION=false # force registration of command
diff --git a/Dockerfile b/Dockerfile
index 59103c4..b56e430 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -10,6 +10,4 @@ RUN go mod tidy && go build -o app .
ENV TOKEN=""
-ENV FORCE_COMMAND_REGISTRATION="false"
-
-CMD ./app -token $TOKEN -forge-command-registration $FORCE_COMMAND_REGISTRATION
+CMD ./app -token $TOKEN
diff --git a/go.mod b/go.mod
index bdd9995..ede661a 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@ module github.com/anhgelus/les-copaings-bot
go 1.22
require (
- github.com/anhgelus/gokord v0.4.0
+ github.com/anhgelus/gokord v0.5.0
github.com/bwmarrin/discordgo v0.28.1
github.com/redis/go-redis/v9 v9.5.1
gorm.io/gorm v1.25.10
@@ -19,7 +19,7 @@ require (
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
- github.com/pelletier/go-toml/v2 v2.2.1 // indirect
+ github.com/pelletier/go-toml/v2 v2.2.2 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sync v0.7.0 // indirect
diff --git a/go.sum b/go.sum
index d734336..9f919d4 100644
--- a/go.sum
+++ b/go.sum
@@ -4,8 +4,12 @@ github.com/anhgelus/gokord v0.2.1 h1:yFn7WM9PJHdMyfGH2GQ2Ubu+qMvfLJ7gUSzfm9zzihY
github.com/anhgelus/gokord v0.2.1/go.mod h1:CRyk26IhIZ/0Mkc5/5WOU8C08mGCOqzKzR6eDFfPisI=
github.com/anhgelus/gokord v0.3.0 h1:6Ubo9zlNSJONpfHiL03oynWqWth9mOG0SDUGNKfEJRU=
github.com/anhgelus/gokord v0.3.0/go.mod h1:CRyk26IhIZ/0Mkc5/5WOU8C08mGCOqzKzR6eDFfPisI=
+github.com/anhgelus/gokord v0.4.0-1 h1:psGnnLgV3iLeHBwppcZqEXQjsvTMcI/ZkHOSda62RbA=
+github.com/anhgelus/gokord v0.4.0-1/go.mod h1:CRyk26IhIZ/0Mkc5/5WOU8C08mGCOqzKzR6eDFfPisI=
github.com/anhgelus/gokord v0.4.0 h1:Q6qY8AKBKMaq6y5pyC1bNCgrENwI3oTVxwzJdXvBYgw=
github.com/anhgelus/gokord v0.4.0/go.mod h1:CRyk26IhIZ/0Mkc5/5WOU8C08mGCOqzKzR6eDFfPisI=
+github.com/anhgelus/gokord v0.5.0 h1:pqHmWNcT6sPa8XpSkFdMBhGscCwlkkAVvxe4X2QyfPw=
+github.com/anhgelus/gokord v0.5.0/go.mod h1:KrMDE60/TONlcio08fsizjdf6rlncl2SedKSnhPH4s8=
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=
@@ -36,6 +40,8 @@ github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/pelletier/go-toml/v2 v2.2.1 h1:9TA9+T8+8CUCO2+WYnDLCgrYi9+omqKXyjDtosvtEhg=
github.com/pelletier/go-toml/v2 v2.2.1/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
+github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
+github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/redis/go-redis/v9 v9.5.1 h1:H1X4D3yHPaYrkL5X06Wh6xNVM/pX0Ft4RV0vMGvLBh8=
diff --git a/main.go b/main.go
index 9964269..e4a9e25 100644
--- a/main.go
+++ b/main.go
@@ -1,6 +1,7 @@
package main
import (
+ _ "embed"
"flag"
"github.com/anhgelus/gokord"
"github.com/anhgelus/gokord/utils"
@@ -12,22 +13,18 @@ import (
)
var (
- token string
- forceCmdRegistration bool
-)
-
-const (
- Version = "2.2.3" // git version: 0.2.3 (it's the v2 of the bot)
+ token string
+ //go:embed updates.json
+ updatesData []byte
+ Version = gokord.Version{
+ Major: 2,
+ Minor: 3,
+ Patch: 0,
+ } // git version: 0.3.0 (it's the v2 of the bot)
)
func init() {
flag.StringVar(&token, "token", "", "token of the bot")
- flag.BoolVar(
- &forceCmdRegistration,
- "forge-command-registration",
- false,
- "force the registration of command",
- )
flag.Parse()
}
@@ -134,6 +131,11 @@ func main() {
HasOption().
SetHandler(commands.Credits)
+ innovations, err := gokord.LoadInnovationFromJson(updatesData)
+ if err != nil {
+ panic(err)
+ }
+
bot := gokord.Bot{
Token: token,
Status: []*gokord.Status{
@@ -143,7 +145,7 @@ func main() {
},
{
Type: gokord.GameStatus,
- Content: "dev par @anhgelus",
+ Content: "ĂȘtre dev par @anhgelus",
},
{
Type: gokord.ListeningStatus,
@@ -151,7 +153,7 @@ func main() {
},
{
Type: gokord.GameStatus,
- Content: "Les Copaings Bot " + Version,
+ Content: "Les Copaings Bot " + Version.String(),
},
},
Commands: []*gokord.GeneralCommand{
@@ -162,9 +164,11 @@ func main() {
resetUserCmd,
creditsCmd,
},
- AfterInit: afterInit,
+ AfterInit: afterInit,
+ Innovations: innovations,
+ Version: &Version,
}
- bot.Start(forceCmdRegistration)
+ bot.Start()
xp.CloseRedisClient()
}
diff --git a/updates.json b/updates.json
new file mode 100644
index 0000000..72733fa
--- /dev/null
+++ b/updates.json
@@ -0,0 +1,10 @@
+[
+ {
+ "versions": "2.3.0",
+ "commands": {
+ "added": [],
+ "removed": [],
+ "updated": []
+ }
+ }
+] \ No newline at end of file