diff options
| author | 2021-03-05 22:05:56 +0000 | |
|---|---|---|
| committer | 2021-03-05 22:05:56 +0000 | |
| commit | 64576f56a69ec26406d7eaa11956d93db642fc3a (patch) | |
| tree | ef8b7099e40fc3d1a258b7b16bdb5b01b24be6fd | |
| parent | Merge branch 'master' into Enforce-image-processing-concurrency (diff) | |
Rename in_thread fuction for clarity.
| -rw-r--r-- | bot/exts/evergreen/profile_pic_modification/pfp_modify.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/bot/exts/evergreen/profile_pic_modification/pfp_modify.py b/bot/exts/evergreen/profile_pic_modification/pfp_modify.py index f3e8d426..df5005c9 100644 --- a/bot/exts/evergreen/profile_pic_modification/pfp_modify.py +++ b/bot/exts/evergreen/profile_pic_modification/pfp_modify.py @@ -18,7 +18,7 @@ log = logging.getLogger(__name__) _EXECUTOR = ThreadPoolExecutor(10) -async def in_thread(func: t.Callable, *args) -> asyncio.Future: +async def in_executor(func: t.Callable, *args) -> asyncio.Future: """Allows non-async functions to work in async functions.""" log.trace(f"Running {func.__name__} in an executor.") loop = asyncio.get_event_loop() @@ -48,7 +48,7 @@ class PfpModify(commands.Cog): """Pixelates your avatar and changes the palette to an 8bit one.""" async with ctx.typing(): image_bytes = await ctx.author.avatar_url.read() - file = await in_thread( + file = await in_executor( PfpEffects.apply_effect, image_bytes, PfpEffects.eight_bitify_effect @@ -96,7 +96,7 @@ class PfpModify(commands.Cog): ctx.send = send_message # Reassigns ctx.send image_bytes = await ctx.author.avatar_url_as(size=256).read() - file = await in_thread( + file = await in_executor( PfpEffects.apply_effect, image_bytes, PfpEffects.easterify_effect, @@ -122,7 +122,7 @@ class PfpModify(commands.Cog): ) -> None: """Gets and sends the image in an embed. Used by the pride commands.""" async with ctx.typing(): - file = await in_thread( + file = await in_executor( PfpEffects.apply_effect, image_bytes, PfpEffects.pridify_effect, @@ -218,7 +218,7 @@ class PfpModify(commands.Cog): async with ctx.typing(): image_bytes = await ctx.author.avatar_url.read() - file = await in_thread(PfpEffects.apply_effect, image_bytes, spookifications.get_random_effect) + file = await in_executor(PfpEffects.apply_effect, image_bytes, spookifications.get_random_effect) embed = discord.Embed( title="Is this you or am I just really paranoid?", |