Reasons unrelated to this, I needed to connect my bot to a webserver.
I use Sanic for my webserver client, and to run the bot I have the following code:
from thorny import bot # I import the bot from another file where all my listeners and events are configured
app = Sanic("thorny_bot_app")
@app.listener('after_server_start')
async def start_bot(application: Sanic):
asyncio.get_event_loop().create_task(coro=bot.start(token=TOKEN, reconnect=True),
name="Discord Client")
app.run(host="0.0.0.0")