@commands.Cog.listener() async def on_raw_reaction_add(self, payload): data = await self.bot.get_data(payload.guild_id) starboard = self.bot.get_channel(data[27]) stars = await self.bot.get_star(payload.message_id) star_reactions = ["⭐", ":questionable_star:", ":star_struck:", ":star2:", ":StarPiece:", ":purple_star:"] reactions_count = 0 for star in star_reactions: if payload.emoji.name == star: stared_message = await self.bot.get_channel(payload.channel_id).fetch_message(payload.message_id) if not stared_message.author.bot and payload.member.id != stared_message.author.id: embed = discord.Embed(title = f"Starred message", description = f"[{stared_message.content}](stared_message.jump_url)" or "See attachment", colour = stared_message.author.colour, timestamp = datetime.datetime.utcnow()) embed.set_author(name = stared_message.author, icon_url = stared_message.author.avatar_url) if len(stared_message.attachments): embed.set_image(url = stared_message.attachments[0].url) post = await starboard.send(embed = embed) if stared_message.id != stars[0]: embed.set_footer(text = f"Stars: {str(star.count)}") async with self.bot.pool.acquire() as conn: await conn.execute("UPDATE starboard SET stars=$1 WHERE id=$2", star.count, payload.message_id) await conn.execute("UPDATE starboard SET post=$1 WHERE id=$2", post.id, payload.message_id) else: star_count = stars[1] + 1 embed.set_footer(text = f"Stars: {str(star_count)}") async with self.bot.pool.acquire() as conn: await conn.execute("UPDATE starboard SET stars=$1 WHERE id=$2", star_count, payload.message_id) else: await stared_message.remove_reaction(payload.emoji, payload.member)