K
K
kodbiprog2021-06-09 12:31:07
Bots
kodbiprog, 2021-06-09 12:31:07

How to implement hunger in telegram bot python (telebot, sqlite3, time)?

Please help, I want to make it so that when a user registers in the telegram bot and clicks on the status of his pet, then from now on, for example, every 10 minutes there will be - 1xp.60c08a24e7423972007402.png60c08a2c48d43556954463.png
60c08a563957b986286417.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Endora Blackwell, 2021-06-12
@Allan-BlackWell

You are using an async function, outside of an async function.
Either use aiogram (As I know the asynchronous library for telegram)
Or remove async and await asyncio.sleep(5) replace with time.sleep(5)

def minus_heal(message):
    while True:
        time.sleep(5)
        ...

Also, if you want to use it for more than one person, I advise you to read about the threading library

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question