I'm trying to send message from my bot using pyrogram in Colab, But I can't use main Thread because pyrogram will think I'm running my code in async function and all functions became coroutines.
so I tried to run it from another thread but the problem is it stucks in bot.start()
,when a cell is running.
when all cells finished running. it will run fine and send the message.
The code:
from pyrogram import Client
import threading
bot=Client("Me", bot_token=BOT_TOKEN, api_id=APP_ID, api_hash=API_HASH,no_updates=True)
def main():
bot.start()
bot.send_message(chat_id="...",text="how")
bot.stop()
t=threading.Thread(target=main)
t.start()
I looked at pyrogram module But I couldn't find out why this happening