Migration to Tongo, new logic for user storage #3
| @ -55,10 +55,7 @@ func userJoined(b *bot, update *echotron.Update) error { | ||||
| 		log.Printf("Error creating captcha bytes: %v", bytes) | ||||
| 		b.SendMessage("Не могу создать капчу, @nefrace, проверь логи.", update.Message.Chat.ID, &echotron.MessageOptions{MessageThreadID: int64(update.Message.ThreadID)}) | ||||
| 	} | ||||
|  | ||||
| 	// user.CorrectAnswer = int8(captcha.CorrectAnswer) | ||||
| 	log.Print(user) | ||||
| 	msg := fmt.Sprintf("Приветствую тебя, *[%s](tg://user?id=%d)*\\!\nДля подтверждения, что ты человек, выбери логотип движка, которому посвящен данный чат, и отправь его номер сюда\\.\n*_Я дам тебе десять минут на это\\._*", EscapeText(echotron.MarkdownV2, user.FirstName), user.UserId) | ||||
| 	msg := fmt.Sprintf("Приветствую тебя, *%s*\\!\nДля подтверждения, что ты человек, выбери логотип движка, которому посвящен данный чат, и отправь его номер сюда\\.\n*_Я дам тебе десять минут на это\\._*", UserMention(usr)) | ||||
| 	options := echotron.PhotoOptions{ | ||||
| 		Caption:   msg, | ||||
| 		ParseMode: echotron.MarkdownV2, | ||||
| @ -110,7 +107,12 @@ func checkCaptcha(b *bot, update *echotron.Update) error { | ||||
| 	// d := db.GetDatabase() | ||||
| 	ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) | ||||
| 	defer cancel() | ||||
| 	if user, err := store.GetOne(ctx, tongo.E("user_id", sender.ID), tongo.E("chat_id", message.Chat.ID), tongo.E("is_joined", false)); err == nil { //d.GetUser(ctx, db.User{UserId: sender.ID, ChatId: message.Chat.ID}); err == nil { | ||||
|  | ||||
| 	if user, err := store.GetOne(ctx, | ||||
| 		tongo.E("user_id", sender.ID), | ||||
| 		tongo.E("chat_id", message.Chat.ID), | ||||
| 		tongo.E("is_joined", false), | ||||
| 	); err == nil { //d.GetUser(ctx, db.User{UserId: sender.ID, ChatId: message.Chat.ID}); err == nil { | ||||
| 		chat, err := chatStore.GetOne(ctx, tongo.E("chat_id", message.Chat.ID)) | ||||
| 		if err != nil { | ||||
| 			return err | ||||
|  | ||||
		Reference in New Issue
	
	Block a user