E
E
Emin7772020-09-11 14:03:41
Bots
Emin777, 2020-09-11 14:03:41

How to write validation for telegram bot using pyTelegramBotAPI library?

Hello.
There is a bot that needs to send nicknames in Latin. At the beginning of the nickname, there must be an @ symbol.
If the nickname is spelled incorrectly, a notice of incorrectness should pop up.
How to implement it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
soremix, 2020-09-11
@soremix

msg.startswith('@')
msg[0] == '@'

K
kirillinyakin, 2020-09-11
@kirillinyakin

You can do it with regular expressions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question