N
N
Nikita Mikaev2017-04-11 22:00:11
Python
Nikita Mikaev, 2017-04-11 22:00:11

Telegram Bot Api, how to conduct a session with a user? How to write multiplayer bots?

I use the PyTelegramBotApi library. I assume that this library does not automatically open a session on each user, and I'm afraid that collisions may occur. How to be? How to create and maintain a session with a user?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey, 2017-04-24
@lolobrigita

I did for my bot https://telegram.me/Weekendflybot by storing the status in the database:
Entered start, start, /start anywhere - the status was reset to 0 and the user can start a new search.

X
xdgadd, 2017-04-11
@xdgadd

Use state machines . Simply put, you need to store the state of the user at every point in time. For example, using db.

V
Vitaly, 2017-04-22
@MrCute

To store user data, you can use regular txt files (which is the easiest way to store) and databases. Here I can advise SQLite - the simplest, single-file database that is easy to edit and very easy to use. I use it myself in my bot.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question