-1

im fairly new to discord.py (currently using nextcord) and id like to create a simple function that takes a moment. however if this command is already running and another person runs the command. the bot will wait for the first one to finish before going to the next one. is there a way to run this function twice in parreral without blocking eachother?

    async def get_screenshot(ctx, url):
        options = Options()
        driver = webdriver.Firefox(options=options)
        driver.get(url)
        asyncio.sleep(timetowait)
        driver.screenshot('picture.png')
        file = nextcord.File('picture.png', filename='picture.png')
        await ctx.send(file=file, "test")
        driver.quit()
nicky
  • 1
  • Does this answer your question? [using Subprocess to avoid long-running task from disconnecting discord.py bot?](https://stackoverflow.com/questions/53587063/using-subprocess-to-avoid-long-running-task-from-disconnecting-discord-py-bot) – Benjin Jun 01 '22 at 08:19
  • `webdriver` isn't async. This may help you: https://stackoverflow.com/questions/50303797/python-webdriver-and-asyncio – Eric Jin Jun 04 '22 at 13:28

0 Answers0