Hello guys, i've managed to make my Flask app run with my bot using the code below:
# Create two threads, one for the Flask app and one for the Discord bot
flask_thread = threading.Thread(target=run_flask)
discord_thread = threading.Thread(target=run_discord)
# Start both threads
discord_thread.start()
flask_thread.start()
# Wait for both threads to finish
flask_thread.join()
discord_thread.join()
So, Flask and bot starts successfully with no problem.
So then i created the following Flask route:
async def test():
data = request.get_json()
ch_id = 975470215578132531
ch = await bot.fetch_channel(ch_id)
await ch.send(f"{data}")
return "", 200
Which should work perfectly.
But i'm having the following error:
RuntimeError: Timeout context manager should be used inside a task
Could any of you gimme a hand on that please?