Error when attempting to run bot with new discord py version?

Viewed 35

I am returning to discord py after a small break of not using for awhile. I have since updated my python to 3.10.x and discordpy to the latest version. I changed my bot run event and cogs to the new required async stuff, as well as updating the setup in the cogs themselves.

async def load_extentions():
  for filename in os.listdir('./cogs'):
      if filename.endswith(".py"):
          await bot.load_extension(f'cogs.{filename[0:-3]}')

async def main():
    async with bot:
        await load_extentions()
        await bot.start("my token")

asyncio.run(main())

When I run this, it spits out a ton of errors. The main one I think is this:

discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.events' raised an error: RuntimeError: asyncio.run() cannot be called from a running event loop
sys:1: RuntimeWarning: coroutine 'main' was never awaited

Anyway, Im super confused and would appreciate some help as to what could be going on here. PLZ HELP

0 Answers
Related