This commit is contained in:
insert 2024-12-26 12:43:40 -05:00
parent c4b4c9cb61
commit 5fe69d4473
Signed by: insert
GPG key ID: A70775C389ACF105

View file

@ -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))