'Aiogram update message every second
I want to run parallel bot and function, which calc data. I've done this and it was working if i just print in console. I want to send message, but it's async function => upd should be async too => it cant be in another thread anymore. I have spent about 2 hours. Most of examples from internet either dosnt work at all or cant work with aiogram polling.I still cant understand what to do. Help pls
async def upd():
print(1)
while (1):
tick()
echo(get_info())
await bot.send_message(t_id, "asasa")
time.sleep(1)
t = threading.Thread(target=upd)
t.start()
executor.start_polling(dp, skip_updates=True)
and output
https://core.telegram.org/bots/api#markdown-style
bot = Bot(token=bot_token, parse_mode=types.ParseMode.MARKDOWN)
C:\Users\saprykin\AppData\Local\Programs\Python\Python39\lib\threading.py:910: RuntimeWarning: coroutine 'upd' was never awaited
self._target(*self._args, **self._kwargs)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Updates were skipped successfully.
Pls explain me what should i do?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
