Last active
October 19, 2020 10:44
-
-
Save ncwhale/a08883b7992995556cd6cd66b69d76c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@dp.message_handler(chat_ctx_filter, commands={'count'}) | |
async def count_handler(event: types.Message, chat_ctx: Chat): | |
'+1s for every call' | |
with db.transaction_manager as trans: | |
trans.note(u"Count") | |
chat_count = chat_ctx.addCount() | |
delay_task = asyncio.create_task(asyncio.sleep(5)) | |
await event.chat.do('typing') | |
await event.delete() | |
await delay_task | |
if chat_count == chat_ctx.count: | |
await event.answer(f"Count: {chat_count}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment