Q: How to make tasks in Discord.py 2.0 I updated my discord bot to dis.py 2.0 and im getting this error only since i updated to discord.py 2.0 heres my code
code:
bot = commands.Bot(command_prefix=get_prefix,
                   help_command=None,
                   intents=discord.Intents.all())

@tasks.loop(seconds=30)
async def checkforvideos():
  # Checks for new yt videos

checkforvideos.start()
def run():
 
    bot.loop.create_task(checkforvideos())

    server.run()
    for extension in bot.initial_extensions:
        bot.load_extension(extension)
    bot.run(os.getenv("TOKEN"), bot=True, reconnect=True)

if __name__ == '__main__':
  run()

error:
Traceback (most recent call last):
  File "main.py", line 339, in <module>
    if __name__ == '__main__': run()
  File "main.py", line 319, in run
    checkforvideos.start()
  File "/home/runner/bot/venv/lib/python3.8/site-packages/discord/ext/tasks/__init__.py", line 400, in start
    self._task = asyncio.create_task(self._loop(*args, **kwargs))
  File "/nix/store/p21fdyxqb3yqflpim7g8s1mymgpnqiv7-python3-3.8.12/lib/python3.8/asyncio/tasks.py", line 381, in create_task
    loop = events.get_running_loop()
RuntimeError: no running event loop

This worked on 1.7.3 of discord.py and i have no ideas whats wrong i even tried example from the docs and those didn't work if you guys could help me that would be great!
