J
J
johnvorms2020-08-16 13:05:52
Python
johnvorms, 2020-08-16 13:05:52

How to implement "I agree with the rules" in a telegram bot in Python?

I'm just starting to learn python, I wanted to create my own telegram bot, but I can't implement "I agree with the rules" so that until you accept them, you can't do anything, you have to reload the code to make it work

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kirillinyakin, 2020-08-16
@johnvorms

You can, for example, enter the Inline keyboard with the text I agree with the rules and some kind of callback data, then if he presses this button, then remember that he has already pressed this button. That is, look at the user's id and save what he previously clicked on it, for example, in a dictionary, or in a database, if you already know how to use it

D
Dmitry Shevchenko, 2020-08-20
@ZER0x32

create a user database of the dictionary type where the key is the user ID and the value is 1 or 0, and until the user agrees with the rules, on the contrary, his key is 0 and all other parts of the code set the condition that base_name [ID] == 1 or just ignore.
and yes, the database should be stored in a separate file, preferably, and when the bot is started (the start command), a new key should be added to the database + checking if it is not there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question