Fixed text handling in captcha
This commit is contained in:
		| @ -269,8 +269,15 @@ func checkCaptcha(b *bot, update *echotron.Update) error { | |||||||
| 				return nil | 				return nil | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		text_runes := []rune(message.Text) | 		userText := message.Text | ||||||
| 		guess := string(text_runes[0]) | 		if userText == "" { | ||||||
|  | 			userText = message.Caption | ||||||
|  | 		} | ||||||
|  | 		text_runes := []rune(userText) | ||||||
|  | 		guess := "" | ||||||
|  | 		if len(text_runes) > 0 { | ||||||
|  | 			guess = string(text_runes[0]) | ||||||
|  | 		} | ||||||
| 		solved := false | 		solved := false | ||||||
| 		if num, err := strconv.Atoi(guess); err == nil { | 		if num, err := strconv.Atoi(guess); err == nil { | ||||||
| 			if num == int(user.CorrectAnswer) { | 			if num == int(user.CorrectAnswer) { | ||||||
|  | |||||||
| @ -69,8 +69,8 @@ func (b *bot) Update(update *echotron.Update) { | |||||||
| 					return | 					return | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 			checkCaptcha(b, update) |  | ||||||
| 		} | 		} | ||||||
|  | 		checkCaptcha(b, update) | ||||||
| 		checkAdminTopics(b, update) | 		checkAdminTopics(b, update) | ||||||
| 	} | 	} | ||||||
| 	if update.ChatMember != nil { | 	if update.ChatMember != nil { | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user