Documentación / Developers / Cookbook / 7) Reaction-based polls
BuildSDK 0.10.1

7) Reaction-based polls

These docs are public. To publish a plugin you need a YourBot account: sign in to open the Dev Portal.

/poll creates a message with ✓/✗ reactions; tallies via reaction count later.

@plugin.on_slash_command("poll")
def poll(ctx: Context, event: dict):
    opts = {o["name"]: o["value"] for o in event.get("options", [])}
    question = opts.get("question") or "Yes or no?"
    msg = ctx.discord.send_message(channel_id=event["channel_id"], content=f"**Poll:** {question}")
    ctx.discord.add_reaction(channel_id=event["channel_id"], message_id=msg["message_id"], emoji="✅")
    ctx.discord.add_reaction(channel_id=event["channel_id"], message_id=msg["message_id"], emoji="❌")
    ctx.interaction.respond(content="Poll posted!")
YourBot docs Reference tables are generated from the code that is running. Ask in Discord Suggest a correction