From 6b19d2a842657770fb1d50d43bc8d3a4814d62db Mon Sep 17 00:00:00 2001 From: sfu69 <65554180+sfu69@users.noreply.github.com> Date: Fri, 27 Dec 2024 00:23:04 +0100 Subject: [PATCH 1/2] Added emoji check --- main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 54a2077..e07f600 100755 --- a/main.py +++ b/main.py @@ -40,9 +40,11 @@ async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent) -> message = await channel.fetch_message(payload.message_id) # Check if the message was sent by the bot - if message.author == self.user: + if message.author == self.user and payload.emoji.name == "👎": await message.delete() - + else: + await message.remove_reaction(payload.emoji, payload.member) + async def on_message(self, message: discord.Message) -> None: """Command to search and find the fanfiction by scraping google""" # TODO: Re-evaluate logging for messages containing "-log". From c7866c36e7da0662224560301047e9c1db74e704 Mon Sep 17 00:00:00 2001 From: sfu69 <65554180+sfu69@users.noreply.github.com> Date: Fri, 27 Dec 2024 12:34:46 +0100 Subject: [PATCH 2/2] refactoring --- main.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index e07f600..dd0b42b 100755 --- a/main.py +++ b/main.py @@ -40,10 +40,11 @@ async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent) -> message = await channel.fetch_message(payload.message_id) # Check if the message was sent by the bot - if message.author == self.user and payload.emoji.name == "👎": - await message.delete() - else: - await message.remove_reaction(payload.emoji, payload.member) + if message.author == self.user: + if payload.emoji.name == "👎": + await message.delete() + else: + await message.remove_reaction(payload.emoji, payload.member) async def on_message(self, message: discord.Message) -> None: """Command to search and find the fanfiction by scraping google"""