When a message collects enough ⭐ reactions, celebrate it in a dedicated channel. The KV counter crosses the threshold exactly once, so no dedup flag is needed. Reaction emoji arrive only with events:message_content (recipe 2's caveat applies).
from yourbot_sdk.events import ReactionAdd
STAR = "⭐"
THRESHOLD = 3
@plugin.on_slash_command("starboard-here")
def set_board(ctx: Context, event: dict):
ctx.kv.set("starboard_channel_id", event["channel_id"])
ctx.interaction.respond(content="This is now the starboard.")
@plugin.on_event("reaction_add")
def count_star(ctx: Context, event: ReactionAdd):
if event.get("user_bot") or event.get("emoji") != STAR:
return
n = ctx.kv.increment(f"stars:{event['message_id']}")
board = ctx.kv.get("starboard_channel_id")
if n != THRESHOLD or not board or str(board) == str(event["channel_id"]):
return
link = (f"https://discord.com/channels/"
f"{event.get('guild_id') or ctx.server_id}"
f"/{event['channel_id']}/{event['message_id']}")
ctx.discord.send_message(channel_id=str(board),
content=f"{STAR} A message just hit {THRESHOLD} stars: {link}")