build(deps): update to gokord 0.5.0

#6
This commit is contained in:
Anhgelus Morhtuuzh 2024-05-03 11:35:39 +02:00
parent f923f36dbf
commit fed5dde8e2
No known key found for this signature in database
GPG key ID: CF4550297832A29F
6 changed files with 39 additions and 22 deletions

View file

@ -9,4 +9,3 @@ POSTGRES_DB=les-copaings
# Bot #
##############
TOKEN=your_token
FORCE_COMMAND_REGISTRATION=false # force registration of command

View file

@ -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

4
go.mod
View file

@ -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

6
go.sum
View file

@ -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=

36
main.go
View file

@ -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()
}

10
updates.json Normal file
View file

@ -0,0 +1,10 @@
[
{
"versions": "2.3.0",
"commands": {
"added": [],
"removed": [],
"updated": []
}
}
]