mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
Add a lock to /screenshot because matthew and ferdi are twats <3
This commit is contained in:
parent
93bb959bf8
commit
1a34a004d4
1 changed files with 5 additions and 3 deletions
|
@ -34,6 +34,7 @@ from utils import console
|
|||
class OtherCog(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.lock = asyncio.Lock()
|
||||
|
||||
async def screenshot_website(
|
||||
self,
|
||||
|
@ -513,9 +514,10 @@ class OtherCog(commands.Cog):
|
|||
await asyncio.sleep(1)
|
||||
await ctx.edit(content=f"Screenshotting {textwrap.shorten(url.geturl(), 100)}... (33%)")
|
||||
try:
|
||||
screenshot, driver, fetch_time, screenshot_time = await self.screenshot_website(
|
||||
ctx, url.geturl(), browser, render_timeout, window_height, window_width, capture_whole_page
|
||||
)
|
||||
async with self.lock:
|
||||
screenshot, driver, fetch_time, screenshot_time = await self.screenshot_website(
|
||||
ctx, url.geturl(), browser, render_timeout, window_height, window_width, capture_whole_page
|
||||
)
|
||||
except TimeoutError:
|
||||
return await ctx.edit(content="Rendering screenshot timed out. Try using a smaller resolution.")
|
||||
except WebDriverException as e:
|
||||
|
|
Loading…
Reference in a new issue