Update
This commit is contained in:
parent
c4b4c9cb61
commit
5fe69d4473
1 changed files with 13 additions and 7 deletions
14
starboard.py
14
starboard.py
|
@ -20,14 +20,20 @@ class starboard(commands.Cog):
|
||||||
async def on_raw_reaction_add(self,payload):
|
async def on_raw_reaction_add(self,payload):
|
||||||
print("recieved emoji payload", file=sys.stderr)
|
print("recieved emoji payload", file=sys.stderr)
|
||||||
print(payload.emoji.name, file=sys.stderr)
|
print(payload.emoji.name, file=sys.stderr)
|
||||||
if payload.emoji.name == "⭐":
|
|
||||||
print("Recieved star payload", file=sys.stderr)
|
|
||||||
chann = self.bot.get_channel(payload.channel_id)
|
chann = self.bot.get_channel(payload.channel_id)
|
||||||
message = await chann.fetch_message(payload.message_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)
|
||||||
for r in message.reactions:
|
for r in message.reactions:
|
||||||
if r.emoji == "⭐":
|
if r.emoji == emoji:
|
||||||
|
if r.count == minimumneeded:
|
||||||
await chann.send(f"{r.count} {payload.emoji.name}")
|
await chann.send(f"{r.count} {payload.emoji.name}")
|
||||||
await message.forward(chann)
|
await message.forward(self.bot.get_channel(starchannel))
|
||||||
return
|
return
|
||||||
|
|
||||||
def setup(bot: commands.Bot):
|
def setup(bot: commands.Bot):
|
||||||
|
|
Loading…
Reference in a new issue