This document explains how to use the Reaction Roles Manager (implemented via the /reaction command with subcommands), expected formats for emoji, examples, and a manual test checklist for maintainers.
The bot exposes a single admin command: /reaction with subcommands:
create — Attach a reaction-role mapping to an existing message.
channel (Channel) — channel containing the target messagemessage_id (String) — ID of the message to attach toemoji (String) — emoji to watch for (unicode or custom name:id)role (Role) — role to assign when reactedlabel (String, optional) — small human-readable label stored with the mappinglist — List mappings for the guild.
delete — Delete a mapping by its _id (returned by create or shown in list).✅, 👍).name:id format (for example cool_emoji:123456789012345678).
name:id representation for server (custom) emoji. Examples:
party_parrot:827364827364827364my_cool_emoji:123456789012345678guild.emojis.cache.get(id) to find the emoji nameguild.emojis.cache.find(e => e.name === name) to resolve an idname:id will only succeed if the bot can use that emoji (it must be available to the bot’s account). If not available, the bot’s .react() call will fail with a permission or invalid emoji error.Common failure modes and diagnostics:
1) Missing ‘Add Reactions’ — attempting to add a reaction will throw a DiscordAPIError (50013) or fail silently. Check the bot’s channel-level permissions and grant “Add Reactions”.
2) Missing ‘Manage Roles’ — the role assignment will fail when trying to add/remove roles. Ensure the bot has Manage Roles and its role is higher than any role it needs to assign.
3) Rate limits (HTTP 429) — if the bot reacts quickly across many messages it may hit rate limits. The implementation uses exponential backoff for .react(); if you see repeated 429s, reduce batching or add delays.
4) Invalid custom emoji — if the admin supplies an emoji that doesn’t exist or the bot cannot access it, .react() will fail. Prefer normalizing inputs to name:id and verifying the emoji via guild.emojis.cache during create.
5) Message deleted / missing — the cleanup job should remove stale mappings; if a mapping references a deleted message, reaction attempts will be skipped and a debug log entry may be emitted.
/reaction create and watch the bot’s attempt in the channel.sendGuildLog.create persists a document: { guildId, channelId, messageId, emoji, roleId, label }.create will attempt to react to the target message (best-effort) so the emoji is present on the message for users to click.reactionRolesAdd event handler consults the DB and assigns the configured role(s). The inverse handler removes the role on reaction removal./reaction create channel:#some-channel message_id:123456789012345678 emoji:✅ role:@Member./reaction list and confirm the mapping is present with the _id, channel, message id, emoji, and role mention./reaction delete id:<mappingId> and confirm it returns success./reaction list no longer shows the mapping.emoji:doesnotexist — the command should still create a mapping (it stores the string) but the bot may not be able to react; document limitations.The convenience subcommand /reaction create_message accepts a required message_content string and will post that content into the specified channel, then create the mapping using the new message’s id. Example:
/reaction create_message channel:#announcements message_content:”Welcome! React to get Member role” emoji:✅ role:@Member
Notes:
create_message is the explicit UI for creating a message and mapping it. It replaces the previous inline message_content option on the create subcommand.Below are copy-paste examples you can run in a server where the bot is installed (admin required).
Create mapping on existing message:
/reaction create channel:#announcements message_id:123456789012345678 emoji:✅ role:@Member
Expected reply (ephemeral): “Created mapping with id
Create a message and mapping in one step:
/reaction create_message channel:#announcements message_content:”Welcome! React to get Member role” emoji:✅ role:@Member
Expected reply (ephemeral): “Created mapping with id
Screenshot placeholders (optional):
Add a screenshot above named create_mapping_example.png into docs/images/ to show an example UI.
README.md or docs/reactionRoles.md with screenshots and example commands.ChanLogger).create to accept a message_content option so the bot can create the message itself and pre-react (improves UX).create to accept a message_content option so the bot can create the message itself and pre-react (improves UX). (Implemented)