From a18b96780ed28577a19f7a317c71a05cd6aa2d9d Mon Sep 17 00:00:00 2001 From: Rykov7 Date: Wed, 27 Mar 2024 23:59:00 +0300 Subject: [PATCH] add check_asyncio command --- src/commands.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/commands.py b/src/commands.py index 047f7f1..9c37632 100644 --- a/src/commands.py +++ b/src/commands.py @@ -1,3 +1,4 @@ +import asyncio import logging import logging.handlers @@ -375,6 +376,19 @@ async def handle_hello(message: types.Message): """Send the rule if member name is message is just Hello.""" await _neprivet(message, forced_reply=True) +test_var = 0 + + +@bot.message_handler(func=is_admin, commands=["check_asyncio"]) +async def check_asyncio(message: types.Message): + global test_var + test_var += 1 + coroutine_no = test_var + + await bot.send_message(message.chat.id, f'⬜️ Начало корутиночки {coroutine_no}.') + await asyncio.sleep(15) + await bot.send_message(message.chat.id, f'🟩 Конец корутиночки {coroutine_no}.') + """ [ COUNTER ] """