From dd024201ca14a846b7521befe8f05b521760c912 Mon Sep 17 00:00:00 2001 From: Ran Shaashua <47498956+ranshaa05@users.noreply.github.com> Date: Fri, 2 Feb 2024 20:28:41 +0200 Subject: [PATCH] moved whole reaction handling to async tasks --- screenshot.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/screenshot.py b/screenshot.py index 9984605..71393e5 100644 --- a/screenshot.py +++ b/screenshot.py @@ -66,10 +66,10 @@ async def save_send_screenshot(self, session_id): self.original_message = await self.original_message.fetch() - await self.remove_reaction() + asyncio.create_task(self.remove_reaction()) if self.view: await self.view.wait() - await self.add_reaction() + asyncio.create_task(self.add_reaction()) async def remove_reaction(self): """Removes all reactions from the original message.""" @@ -77,7 +77,7 @@ async def remove_reaction(self): isinstance(self.original_message.channel, nextcord.abc.GuildChannel) and not self.original_message.flags.ephemeral ): # check if message is reactable in the first place - asyncio.create_task(self.original_message.clear_reactions()) + await self.original_message.clear_reactions() async def add_reaction(self): """Adds a reaction to the original message based on the button pressed in the view.""" @@ -94,10 +94,10 @@ async def add_reaction(self): self.view.current_label[i : i + 3] for i in range(0, len(self.view.current_label), 3) ]: - asyncio.create_task(self.original_message.add_reaction(emoji)) + await self.original_message.add_reaction(emoji) else: - asyncio.create_task(self.original_message.add_reaction(self.view.current_label)) - asyncio.create_task(self.original_message.add_reaction("⏳")) + await self.original_message.add_reaction(self.view.current_label) + await self.original_message.add_reaction("⏳") async def get_screenshot_info_by_stage(self, stage, session_id): """Returns the selector, crop, and view based on the stage of the grid, as well as the base64 image if on the last stage."""