Update
This commit is contained in:
parent
c4b4c9cb61
commit
5fe69d4473
1 changed files with 13 additions and 7 deletions
20
starboard.py
20
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))
|
Loading…
Reference in a new issue