Docker-compose edited, users are saving to db
This commit is contained in:
parent
079b255d09
commit
f62aa2093e
|
@ -1,3 +1,3 @@
|
|||
bin
|
||||
.env
|
||||
*.env
|
||||
.vscode
|
|
@ -14,3 +14,8 @@ type User struct {
|
|||
CorrectAnswer int8 `bson:"correct_answer"`
|
||||
IsBanned bool `bson:"is_banned"`
|
||||
}
|
||||
|
||||
type Captcha struct {
|
||||
MessageId int `bson:"message_id"`
|
||||
CorrectAnswer int8 `bson:"correct_answer"`
|
||||
}
|
||||
|
|
|
@ -8,13 +8,12 @@ services:
|
|||
depends_on:
|
||||
- mongo
|
||||
env_file:
|
||||
- .env
|
||||
- bot.env
|
||||
mongo:
|
||||
image: mongo
|
||||
restart: always
|
||||
environment:
|
||||
MONGO_INITDB_ROOT_USERNAME: root
|
||||
MONGO_INITDB_ROOT_PASSWORD: example
|
||||
env_file:
|
||||
- mongo.env
|
||||
ports:
|
||||
- 127.0.0.1:28001:27017
|
||||
|
||||
|
@ -23,7 +22,5 @@ services:
|
|||
restart: always
|
||||
ports:
|
||||
- 127.0.0.1:8089:8081
|
||||
environment:
|
||||
ME_CONFIG_MONGODB_ADMINUSERNAME: root
|
||||
ME_CONFIG_MONGODB_ADMINPASSWORD: example
|
||||
ME_CONFIG_MONGODB_URL: mongodb://root:example@mongo:27017/
|
||||
env_file:
|
||||
- mongo.env
|
||||
|
|
|
@ -21,6 +21,10 @@ func userJoined(c tb.Context) error {
|
|||
ChatId: m.Chat.ID,
|
||||
CorrectAnswer: 0,
|
||||
}
|
||||
d := db.GetDatabase()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
d.NewUser(ctx, user)
|
||||
log.Print(user)
|
||||
str := fmt.Sprintf("%v", user)
|
||||
c.Bot().Send(&tb.User{ID: 60441930}, str)
|
||||
|
|
Loading…
Reference in New Issue