The essence of the following:
A simple bot to pyTelegramBotAPI. There is a SQLite database, in which each a group is stored the data you want to send to the user upon request.
Algorithm such: the user triggers the check himself in the group command /register, then sends a group number that is stored in shelve storage. Then the other team gets the right data for your group.
Here is an example handler for message /register:
bot.send_message(message.chat.id, "Please state your group number (looks something like 2xxx).")
group = message.text
match = re.match('2[1-5][1-5][1-5]', group, flags=0)
if len(match)>0 :
bot.send_message(message.chat.id "Invalid group number, please register again.")
with shelve.open(slocal) as storage:
storage[str(chat_id)] = group
bot.send_message(message.chat.id, "Group updated successfully.")
How do the handlers of messages, i.e. inside the handler consistently "listen to messages"? For example, now there are after the command /register from the processing of the entire block. You need to create for each message a separate/attached handler? I can not understand how best to implement a dialogue with the client.