From 374c521e7116ad5f548da6820489d60e222aacb9 Mon Sep 17 00:00:00 2001 From: bobloy Date: Fri, 3 Sep 2021 15:15:25 -0400 Subject: [PATCH] Convert takes optional masks parameter --- conquest/conquest.py | 7 ++++--- conquest/regioner.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/conquest/conquest.py b/conquest/conquest.py index 8b8f4a8..f12e2d2 100644 --- a/conquest/conquest.py +++ b/conquest/conquest.py @@ -426,9 +426,10 @@ class Conquest(commands.Cog): await ctx.maybe_send_embed(f"Failed to cleanup masks") @_mapmaker_masks.command(name="convert") - async def _mapmaker_masks_convert(self, ctx: Context): + async def _mapmaker_masks_convert(self, ctx: Context, mask_list: Greedy[int]): """ - Converts all mask images into 1-bit black-only masks. + Converts the provided mask images into 1-bit black-only masks. + Processes all masks if mask_list is empty Warning: This may take a while. """ @@ -442,7 +443,7 @@ class Conquest(commands.Cog): return async with ctx.typing(): - result = await self.mm.convert_masks() + result = await self.mm.convert_masks(mask_list) if result: await ctx.maybe_send_embed(f"All masks converted") else: diff --git a/conquest/regioner.py b/conquest/regioner.py index 84f759d..11dbfb3 100644 --- a/conquest/regioner.py +++ b/conquest/regioner.py @@ -504,7 +504,7 @@ class MapMaker(ConquestMap): points = set(list(zip(found[1], found[0]))) return points - async def convert_masks(self): + async def convert_masks(self, regions): async for mask_path in AsyncIter(self.masks_path().iterdir()): # Don't both checking if masks are in self.regions img: Image.Image = Image.open(mask_path).convert(MASK_MODE)