mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-20 02:26:32 +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):
|
class OtherCog(commands.Cog):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
self.lock = asyncio.Lock()
|
||||||
|
|
||||||
async def screenshot_website(
|
async def screenshot_website(
|
||||||
self,
|
self,
|
||||||
|
@ -513,9 +514,10 @@ class OtherCog(commands.Cog):
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
await ctx.edit(content=f"Screenshotting {textwrap.shorten(url.geturl(), 100)}... (33%)")
|
await ctx.edit(content=f"Screenshotting {textwrap.shorten(url.geturl(), 100)}... (33%)")
|
||||||
try:
|
try:
|
||||||
screenshot, driver, fetch_time, screenshot_time = await self.screenshot_website(
|
async with self.lock:
|
||||||
ctx, url.geturl(), browser, render_timeout, window_height, window_width, capture_whole_page
|
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:
|
except TimeoutError:
|
||||||
return await ctx.edit(content="Rendering screenshot timed out. Try using a smaller resolution.")
|
return await ctx.edit(content="Rendering screenshot timed out. Try using a smaller resolution.")
|
||||||
except WebDriverException as e:
|
except WebDriverException as e:
|
||||||
|
|
Loading…
Reference in a new issue