Objective
I am trying to create a python trading bot that can listen for messages from some telegram channels and at the same it should have an infinite loop that perform some function based on certain conditions
what I have achieved
Currently I'm able to listen for messages and perform decisions based on the receive messages from telegram using python pyrogram library
Below is the my code
from pyrogram import Client, filters
bot = Client(TELEGRAM_BOT_NAME, api_id=TELEGRAM_API_ID,api_hash=TELEGRAM_API_HASH)
@bot.on_message(filters.channel)
def my_handler(client, message):
#....... code here
bot.run()
#infinite loop
while True:
#--code here
The problem I'm not able to run infinite loop (not evening running) while listening for the message from telegram at the same time.
How can this be achieved ?