diff --git a/db/db.go b/db/db.go index 3879cd7..13b6ca3 100644 --- a/db/db.go +++ b/db/db.go @@ -30,7 +30,7 @@ func AddChat(chatID int64) error { collection := client.Database(cfg.DBName).Collection(cfg.ChatsCollectionName) - result := collection.FindOne(ctx, bson.E{Key: "chat_id", Value: chatID}) + result := collection.FindOne(ctx, bson.M{"chat_id": chatID}) if result.Err() == mongo.ErrNoDocuments { if _, err := collection.InsertOne(ctx, &chatDTO{ChatID: chatID}); err != nil { return err @@ -56,7 +56,7 @@ func AddUserInChat(chatID int64, username string) error { collection := client.Database(cfg.DBName).Collection(cfg.ChatsCollectionName) _, err = collection.UpdateOne( ctx, - bson.E{Key: "chat_id", Value: chatID}, + bson.M{"chat_id": chatID}, bson.M{"addToSet": bson.M{"users": username}}, ) return err diff --git a/main.go b/main.go index 1004cc2..469b960 100644 --- a/main.go +++ b/main.go @@ -89,7 +89,7 @@ func run() { command := commands.Command(strings.Replace(text, opts.Name, "", 1)) switch command { case commands.Start: - _, _ = bot.Send(tgbot.NewMessage(chatID, fmt.Sprintf("Здравствуйте, я Волтер (v1.0.2), ваш дворецкий (%d).", chatID))) + _, _ = bot.Send(tgbot.NewMessage(chatID, fmt.Sprintf("Здравствуйте, я Волтер (v1.1.0), ваш дворецкий (%d).", chatID))) _ = db.AddChat(chatID) case commands.Help: _, _ = bot.Send(tgbot.NewMessage(chatID, "Вот что я умею:\n\n1) Позвать всех"))