Compare commits

..

2 Commits

Author SHA1 Message Date
2f8e15ee4a Fixed text handling in captcha 2023-12-28 23:17:51 +03:00
3aeefc2b2d Added captions 2023-12-28 22:51:34 +03:00
2 changed files with 14 additions and 4 deletions

View File

@ -269,8 +269,15 @@ func checkCaptcha(b *bot, update *echotron.Update) error {
return nil
}
}
text_runes := []rune(message.Text)
guess := string(text_runes[0])
userText := message.Text
if userText == "" {
userText = message.Caption
}
text_runes := []rune(userText)
guess := ""
if len(text_runes) > 0 {
guess = string(text_runes[0])
}
solved := false
if num, err := strconv.Atoi(guess); err == nil {
if num == int(user.CorrectAnswer) {

View File

@ -38,7 +38,10 @@ func (b *bot) Update(update *echotron.Update) {
userLeft(b, update)
return
}
if update.Message.Text != "" {
if update.Message.Text != "" || update.Message.Caption != "" {
if update.Message.Text == "" {
update.Message.Text = update.Message.Caption
}
res, err := b.GetChatMember(update.ChatID(), update.Message.From.ID)
if err != nil {
log.Println("Kicker 44: can't get user member: ", err)
@ -66,8 +69,8 @@ func (b *bot) Update(update *echotron.Update) {
return
}
}
checkCaptcha(b, update)
}
checkCaptcha(b, update)
checkAdminTopics(b, update)
}
if update.ChatMember != nil {