E
E
Emil Timerbaev2020-08-28 16:14:28
Python
Emil Timerbaev, 2020-08-28 16:14:28

How to assign a variable to a specific chat?

During the creation of the telegram bot, I ran into the problem that the variable changes for everyone, but I need the variable to be different for each dialog, and not common

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lesha, 2020-08-28
@MrDlop

so that each dialog has its own variable

Store data along with chat_id. On further requests, you will check the chat ID (dialogue) and interact with the desired variable.

T
Timur Pokrovsky, 2020-08-28
@Makaroshka007

use dictionaries

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question