Linked Questions

Popular Questions

I'm trying to make a starboard-like cog in my bot.

Say a message receives one "star" emoji reaction, the bot will take the message and embed it in the starboard channel, the embed shows the content, the channel, and the user who starred it.

However, when the message receives more than one reaction, can I edit the embedded message to show the additional users?

    async def on_raw_reaction_add(self, payload):
        if str(payload.emoji) == "\U00002B50":
            channel =
            message = await channel.fetch_message(payload.message_id)

            user =
            reactions = discord.utils.get(message.reactions,
            if reactions and reactions.count == 1:
                starboard_channel_id = 1141847109528735866
                starboard_channel =

                if starboard_channel:
                    reacted_users = await reactions.users().flatten()
                    mentions = ' '.join([u.mention for u in reacted_users])
                if starboard_channel:
                    embed =  discord.Embed(description=message.content,color=discord.Color.blurple())
                    embed.add_field(name="Starred by", value=mentions, inline=True)
                    embed.add_field(name="Starred in", value=channel.mention, inline=True)
                    embed.add_field(name="Jump to message", value=f"[Click here]({message.jump_url})", inline=True)
                    await starboard_channel.send(embed=embed)
                    if reactions and reactions.count > 1:
                        updated_users = await reactions.users().flatten()
                        updated_mentions = ' '.join([u.mention for u in updated_users])

                        embed_new = discord.Embed(description=message.content,color=discord.Color.blurple())
                        embed_new.add_field(name="Starred by", value=updated_mentions, inline=True)
                        embed_new.add_field(name="Starred in", value=channel.mention, inline=True)
                        embed_new.add_field(name="Jump to message", value=f"[Click here]({message.jump_url})", inline=True)
                        await starboard_channel.edit(embed=embed_new)

I tried adding print statements to print the initial mention of the user who starred the message, and it prints. The second print statement does not, referring to the print(updated_mentions.

Related Questions