Answer the question
In order to leave comments, you need to log in
Checking for different commands?
Hello! I'm coming to you with a question. I don't understand how to do if, elif checks for different words in this bottle. tried if message.text, nothing works.
Here is the code that logs the user into the database.
Or should I do every time --> @bp.on.message(text="balance") ? further the logic of the bot.
The code:
@bp.on.private_message(text="начать")
async def reg_handler(message: Message):
xx = open("data.txt","r", encoding = 'utf-8')
x = xx.read()
xx.close()
if(str(message.from_id) in x):
users = read_bd()
else:
new_user(message.from_id)
save_bd(users)
return "Вы были успешно зарегистрированы! ✔️"
for user in users:
if user.id == message.from_id:
if message.from_id == "баланс":
return f" Ваш баланс: {user.money} монет!"
save_bd(users)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question