Im using the discord.py library and im developing a discord bot.
Basically, i need my bot to go to a website every hour and get some info with selenium. I want to do it in a thread to avoid blocking the bot during the info gathering.
@tasks.loop(hours=1)
async def getwebsiteinfo(self):
thr = threading.Thread(target=self.getwebsiteinfofunc)
thr.start()
getwebsiteinfofunc:
def getwebsiteinfofunc(self):
...
channel.send(f"```sometext```")
..
Here is the problem: channel.send needs to be called with await but i cant call it with await because its not inside an async function.
But i cant either define getwebsiteinfofunc as async because i cant use async functions with threads.
I tried asyncio but i never used it and i failed.
Any ideas?