build(docker): support of force command registration

This commit is contained in:
Anhgelus Morhtuuzh 2024-04-27 18:36:42 +02:00
parent 31930986fb
commit ad129e8ae4
No known key found for this signature in database
GPG key ID: CF4550297832A29F
5 changed files with 12 additions and 8 deletions

View file

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

3
.gitignore vendored
View file

@ -24,4 +24,5 @@ go.work
.idea
.env
tmp
config/**.toml
data

View file

@ -10,4 +10,6 @@ RUN go mod tidy && go build -o app .
ENV TOKEN=""
CMD ./app -token $TOKEN
ENV FORCE_COMMAND_REGISTRATION="false"
CMD ./app -token $TOKEN -forge-command-registration $FORCE_COMMAND_REGISTRATION

View file

@ -4,7 +4,7 @@ services:
env_file:
- .env
volumes:
- ./tmp:/app/config
- ./config:/app/config
depends_on:
- redis
- postgres

10
main.go
View file

@ -12,8 +12,8 @@ import (
)
var (
token string
forgeCmdRegistering bool
token string
forceCmdRegistration bool
)
const (
@ -23,8 +23,8 @@ const (
func init() {
flag.StringVar(&token, "token", "", "token of the bot")
flag.BoolVar(
&forgeCmdRegistering,
"forge-command-registering",
&forceCmdRegistration,
"forge-command-registration",
false,
"force the registration of command",
)
@ -164,7 +164,7 @@ func main() {
},
AfterInit: afterInit,
}
bot.Start(forgeCmdRegistering)
bot.Start(forceCmdRegistration)
xp.CloseRedisClient()
}