From 5fe69d4473e07ee6fd47d1a79ed034322f5ac44e Mon Sep 17 00:00:00 2001 From: insert Date: Thu, 26 Dec 2024 12:43:40 -0500 Subject: [PATCH] Update --- starboard.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/starboard.py b/starboard.py index 71c1de9..7cc7f19 100644 --- a/starboard.py +++ b/starboard.py @@ -20,15 +20,21 @@ class starboard(commands.Cog): async def on_raw_reaction_add(self,payload): print("recieved emoji payload", file=sys.stderr) print(payload.emoji.name, file=sys.stderr) - if payload.emoji.name == "⭐": + chann = self.bot.get_channel(payload.channel_id) + message = await chann.fetch_message(payload.message_id) + res = await.cur.execute(f"SELECT emoji, starchannel, minimumneeded, selfstar FROM starsettings WHERE serverid = {message.guild.id}") + try: + emoji, starchannel, minimumneeded, selfstar = await res.fetchone() + except TypeError: + return + if payload.emoji.name == emoji: print("Recieved star payload", file=sys.stderr) - chann = self.bot.get_channel(payload.channel_id) - message = await chann.fetch_message(payload.message_id) for r in message.reactions: - if r.emoji == "⭐": - await chann.send(f"{r.count}{payload.emoji.name}") - await message.forward(chann) - return + if r.emoji == emoji: + if r.count == minimumneeded: + await chann.send(f"{r.count} {payload.emoji.name}") + await message.forward(self.bot.get_channel(starchannel)) + return def setup(bot: commands.Bot): bot.add_cog(starboard(bot)) \ No newline at end of file