From 62343ea56287c5f4dbb28f0f07fa69da214fb4c0 Mon Sep 17 00:00:00 2001 From: Paillat Date: Mon, 4 Sep 2023 10:51:11 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(ChatProcess.py):=20remove=20?= =?UTF-8?q?"=F0=9F=A4=94"=20reaction=20after=20processing=20the=20message?= =?UTF-8?q?=20to=20improve=20user=20experience=20=F0=9F=90=9B=20fix(ChatPr?= =?UTF-8?q?ocess.py):=20handle=20error=20when=20removing=20"=F0=9F=A4=94"?= =?UTF-8?q?=20reaction=20in=20case=20it=20was=20already=20removed=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(ChatProcess.py):=20improve=20error=20message?= =?UTF-8?q?=20when=20an=20error=20occurs=20during=20message=20processing?= =?UTF-8?q?=20=F0=9F=90=9B=20fix(ChatProcess.py):=20set=20delete=5Fafter?= =?UTF-8?q?=20parameter=20to=204=20seconds=20for=20error=20message=20to=20?= =?UTF-8?q?automatically=20delete=20after=20a=20short=20period=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(cogs/chat.py):=20fix=20typo=20in=20message.c?= =?UTF-8?q?hannel.send()=20method=20call?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ChatProcess.py | 11 +++++++++-- src/cogs/chat.py | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ChatProcess.py b/src/ChatProcess.py index fb748ea..75bada8 100644 --- a/src/ChatProcess.py +++ b/src/ChatProcess.py @@ -193,15 +193,22 @@ class Chat: return try: await self.message.channel.trigger_typing() + await self.message.add_reaction("🤔") await self.formatContext() await self.createThePrompt() await self.getResponse() await self.processResponse() + await self.message.remove_reaction("🤔", self.message.guild.me) except Exception as e: + try: + self.message.remove_reaction("🤔", self.message.guild.me) + except: + pass await self.message.channel.send( - f"""An error occured while processing your message. Please check your settings and try again. If the issue persists, please join uor discord server here: https://discord.gg/pB6hXtUeDv and send the following logs: + f"""An error occured while processing your message, we are sorry about that. Please check your settings and try again. If the issue persists, please join uor discord server here: https://discord.gg/pB6hXtUeDv and send the following logs: ``` {e} -```""" +```""", + delete_after=4, ) raise e diff --git a/src/cogs/chat.py b/src/cogs/chat.py index 3082453..d67529a 100644 --- a/src/cogs/chat.py +++ b/src/cogs/chat.py @@ -107,7 +107,7 @@ class Chat(discord.Cog): if message.content.startswith("botator!unban"): user2ban = message.content.split(" ")[1] await banusr.unbanuser(user2ban) - await message.chafnnel.send(f"User {user2ban} unbanned !") + await message.channel.send(f"User {user2ban} unbanned !") return if str(message.author.id) in banusr.banend_users: await asyncio.sleep(2)