From 6f6e924d488c77938151d4fbe792a26cbf00e7a3 Mon Sep 17 00:00:00 2001 From: oh_finks Date: Fri, 5 Jan 2024 14:38:05 -0500 Subject: [PATCH 1/4] https://github.com/v1rbox/discox any reaction emoji can put something on the starboard, not just stars. --- bot/events/on_raw_reaction_add.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/events/on_raw_reaction_add.py b/bot/events/on_raw_reaction_add.py index 0cf4e50..bf9fda2 100644 --- a/bot/events/on_raw_reaction_add.py +++ b/bot/events/on_raw_reaction_add.py @@ -75,8 +75,8 @@ async def starboard(self, payload: discord.RawReactionActionEvent) -> None: IMAGE_REGEX = "http(s)?:([\/|.|\w|\s]|-)*\.(?:jpg|gif|png|jpeg)(\?(.[^\s]*))?" REACTION = "⭐" starboard = await self.bot.fetch_channel(Config.starboard_channel) - if payload.emoji.name != REACTION: - return + #if payload.emoji.name != REACTION: + # return channelObj = await self.bot.fetch_channel(payload.channel_id) messageObj = await channelObj.fetch_message(payload.message_id) if messageObj.author.id == self.bot.user.id: From 7325f9f0b70368c9a19bcd95a96c33066d21167b Mon Sep 17 00:00:00 2001 From: oh_finks Date: Fri, 5 Jan 2024 15:02:51 -0500 Subject: [PATCH 2/4] starboard now ignores welcome channel --- bot/config.py | 3 +++ bot/events/on_raw_reaction_add.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/bot/config.py b/bot/config.py index c03d47d..b64426c 100644 --- a/bot/config.py +++ b/bot/config.py @@ -97,6 +97,9 @@ class Config: starboard_channel: int = int( getenv("DISCOX_STARBOARD_CHANNEL", "0") ) # starboard channel + welcome_channel: int = int( + getenv("SERVER_WELCOME_CHANNEL", "1056171331059732541") + ) # welcome channel minecraft_url: str = getenv("MINECRAFT_URL", "minecraft.virbos.xyz") minecraft_port: int = getenv("MINECRAFT_PORT", 25565) diff --git a/bot/events/on_raw_reaction_add.py b/bot/events/on_raw_reaction_add.py index bf9fda2..d04d145 100644 --- a/bot/events/on_raw_reaction_add.py +++ b/bot/events/on_raw_reaction_add.py @@ -77,6 +77,8 @@ async def starboard(self, payload: discord.RawReactionActionEvent) -> None: starboard = await self.bot.fetch_channel(Config.starboard_channel) #if payload.emoji.name != REACTION: # return + if payload.channel_id == Config.welcome_channel: + return channelObj = await self.bot.fetch_channel(payload.channel_id) messageObj = await channelObj.fetch_message(payload.message_id) if messageObj.author.id == self.bot.user.id: From 5164435b7e119decbe8af7c131aff2ed1b9a1259 Mon Sep 17 00:00:00 2001 From: xsnowstorm <118460071+xsnowstorm@users.noreply.github.com> Date: Sun, 7 Jan 2024 00:05:49 +0000 Subject: [PATCH 3/4] fix bug where non-star reactions are ignored --- bot/events/on_raw_reaction_add.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/events/on_raw_reaction_add.py b/bot/events/on_raw_reaction_add.py index d04d145..4d702a9 100644 --- a/bot/events/on_raw_reaction_add.py +++ b/bot/events/on_raw_reaction_add.py @@ -84,8 +84,8 @@ async def starboard(self, payload: discord.RawReactionActionEvent) -> None: if messageObj.author.id == self.bot.user.id: return for reaction in messageObj.reactions: - if reaction.emoji != REACTION: - continue + #if reaction.emoji != REACTION: + # continue if reaction.count >= 5: already = await self.db.raw_exec_select( "SELECT message_id FROM starboard WHERE message_id = ?", From d248ffa12fb4d3ac0866398b385575c71d746e47 Mon Sep 17 00:00:00 2001 From: Code beautifier Date: Sun, 7 Jan 2024 00:06:52 +0000 Subject: [PATCH 4/4] Beautified --- bot/events/on_raw_reaction_add.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/events/on_raw_reaction_add.py b/bot/events/on_raw_reaction_add.py index 4d702a9..d096228 100644 --- a/bot/events/on_raw_reaction_add.py +++ b/bot/events/on_raw_reaction_add.py @@ -75,7 +75,7 @@ async def starboard(self, payload: discord.RawReactionActionEvent) -> None: IMAGE_REGEX = "http(s)?:([\/|.|\w|\s]|-)*\.(?:jpg|gif|png|jpeg)(\?(.[^\s]*))?" REACTION = "⭐" starboard = await self.bot.fetch_channel(Config.starboard_channel) - #if payload.emoji.name != REACTION: + # if payload.emoji.name != REACTION: # return if payload.channel_id == Config.welcome_channel: return @@ -84,7 +84,7 @@ async def starboard(self, payload: discord.RawReactionActionEvent) -> None: if messageObj.author.id == self.bot.user.id: return for reaction in messageObj.reactions: - #if reaction.emoji != REACTION: + # if reaction.emoji != REACTION: # continue if reaction.count >= 5: already = await self.db.raw_exec_select(