The community bot powering the official Arduino Discord
Helpful tags, moderation, automod, logs, modmail and server automation β built for the people who keep the server running.
| π·οΈ Slash-command tags | Curated troubleshooting guides (/tag) β AVRDUDE errors, level shifters, powering boards, and more |
| π‘οΈ Image-spam automod | Catches the image-cluster spam wave with burst + cross-channel fan-out + perceptual-hash detection, and a one-click moderator console |
| π« Automod text rules | The server's old YAGPDB rules: phishing/lookalike links, foreign invites, masked links, duplicates and a website denylist β delete + 3h timeout, kick on repeat; plus banned words, mass mentions and Zalgo |
| π¨ Moderation commands | /warn (with optional auto-timeout escalation), /warnings, /timeout, /kick, /ban, /purgeβ¦ every action logged to a mod-action channel |
| π Logs | Message edits/deletes/bulk deletes, member nickname/role/name/timeout changes, join/leave with invite source |
| π¨ Join-raid detection | Alerts on a wave of joins (or of young accounts), with buttons to raise verification or kick the wave; optional minimum account age |
| π¬ Modmail | Members DM the bot; each conversation becomes a staff ticket thread with replies, notes, snippets, scheduled close and transcripts |
| π§° Server automation | Auto-crosspost, join/leave + invite-source logging, role-select buttons, message-link quoting |
| π£οΈ Staff tooling | /say to broadcast rich embeds as the bot |
| π³ One-command deploy | docker compose up β bot + Postgres, migrations applied automatically |
git clone https://github.com/arduinodiscord/bot.git
cd bot
cp .env.example .env # add your BOT_TOKEN (+ any feature channel IDs)
docker compose up -d --build # builds the bot, starts Postgres, applies migrationsThat's it β the bot connects, registers its slash commands, and is ready.
npm install
cp .env.example .env # set BOT_TOKEN
npm run dev # rebuilds on change (tsc -w) and restarts the bot (node --watch)Privileged intents: enable Message Content and Server Members for your application in the Discord Developer Portal. Invite it with the permission set in SETUP.md (section 1), which includes a ready-made invite URL.
Only BOT_TOKEN is required (plus DATABASE_URL, which Docker wires up, for
anything that stores data); every other feature self-disables until it is
configured.
Everything else is a setting stored in the database and changed while the bot runs, no restart needed:
- In Discord: community managers use
/settings menuto browse sections and change settings with pickers, buttons and forms (no setting names needed), or/settings view|get|set|reset|historyby name. Every change is logged to the action log. - On the server:
docker compose exec bot npm run settings -- list(alsoget,set,unset,history,import-env). A few settings can only be changed here.
See SETUP.md, section 6b for who can use /settings,
the role settings, and the CLI-only settings.
All commands are Discord slash commands β type / in the server.
| Command | Description |
|---|---|
/tag name:<tag> [user:@user] |
Post a curated troubleshooting guide, optionally pinging someone |
/solved [helper:@user] |
Mark the current help post solved (and thank a helper); closes the thread |
/openposts |
List open help posts waiting for an answer, oldest first (ephemeral) |
/calc <calculator> |
Electronics and Arduino calculators: expression, ohm, resistor decode|encode, led, divider, rc, capcode, battery, arduino adc|timer|baud|rollover, convert, awg, transistor, regulator. Numbers take SI suffixes (4.7k, 100n, 4k7). Public by default (private:true for only you; 5s cooldown on public replies, helpers exempt) |
/about |
Bot, Node, and version info |
/ping |
Latency & uptime |
/say channel:<#ch> title:β¦ description:β¦ |
Manager β send a custom embed (optional fields as Name::Value | Name::Value, and thumbnail) |
/settings view|get|set|reset|history |
Manage Server or a manager role β view and change bot settings live (ephemeral) |
Plus two right-click (message context-menu, Apps) actions: "Request more
info" posts the needinfo checklist to an asker in one click, and "Explain
error" explains a recognised Arduino/ESP error in a message (privately for
members; helpers post it as a reply).
π¨ Moderation commands (staff; default permission shown, adjustable in Server Settings β Integrations)
| Command | Default permission | Description |
|---|---|---|
/warn user reason |
Moderator | Warn a member: records it, DMs them and logs it (auto-timeout at moderation.warnTimeoutThreshold) |
/warnings user |
Moderator | Show a user's warnings and moderation history (needs the database) |
/delwarn id [reason] |
Moderator | Revoke a warning by its ID (shown in /warnings) |
/modnote add/list/remove |
Moderator | Quiet notes about a member for other moderators; not a warning, the member isn't told. Shown in /warnings |
/clearwarnings user [reason] |
Moderator | Revoke all of a user's active warnings (skips ones issued by a higher rank) |
/reason case reason |
Moderator | Change the reason of a logged case (original moderator, a higher rank, or a manager) |
/timeout user duration [reason] (alias /mute) |
Moderator | Time out a member (e.g. 10m, 1h30m, or a plain number of minutes; max 28 days) |
/untimeout user [reason] (alias /unmute) |
Moderator | Remove a member's timeout |
/kick user reason |
Moderator | Kick a member from the server |
/ban user reason [duration] [delete_messages] |
Moderator | Ban a user (works by ID for users not in the server); with duration (e.g. 7d, max 365d, needs the database) the ban is lifted automatically |
/unban user_id [reason] |
Moderator | Unban a user by their ID (cancels a scheduled temporary-ban unban) |
/purge count [user] [reason] |
Helper | Bulk-delete up to 100 recent messages in this channel, optionally from one user |
/automod filter add|remove|list Β· /automod status |
Manage Server | Edit the banned-word list, website denylist and invite allowlist; show which rules are on and their thresholds |
π¬ Modmail commands (moderators; used inside a ticket thread)
| Command | Description |
|---|---|
/reply message [attachment] |
Reply to the ticket's user (shows your name) |
/areply message [attachment] |
Reply anonymously, as "Arduino Staff Team" |
/note text |
Add an internal note (not sent to the user) |
/snippet send|add|remove|list |
Send or manage saved replies (tags can be sent too; add/remove need Manage Messages) |
/close [delay] [reason] [silent] |
Close now or after a delay (2h, 1d; cancel stops a scheduled close) |
/block user [reason] [duration] Β· /unblock user |
Stop (or allow again) a user opening tickets |
/contact user [message] [anonymous] |
Open a ticket with a user from the staff side |
π Available /tag topics
ai Β· ask Β· avrdude Β· codeblock Β· debounce Β· espcomm Β· help Β·
hid Β· lab Β· language Β· levelShifter Β· libmissing Β· needinfo Β·
ninevolt Β· power Β· pullup Β· reinstall Β· wiki
A wave of spam β both freshly-joined accounts and compromised long-time members β posts clusters of images to advertise. This bot targets exactly that pattern without ever disabling image sharing server-wide.
Detection
- Burst β several image messages from one user in a short window (stricter for new members) β alerts mods.
- Cross-channel fan-out β the same image across multiple channels β high confidence (this is what catches compromised veterans, where account age tells you nothing).
- Known-spam blocklist β once a mod confirms an alert, that image is fingerprinted and future copies are caught instantly.
Each image gets a cheap metadata signature (catches identical re-uploads) and a perceptual hash (dHash from a tiny thumbnail β catches re-encoded / resized copies via Hamming distance).
Response (tiered): high-confidence hits auto-delete + timeout and then alert; bursts only alert. Every alert lands in the mod-log channel with Confirm / Timeout / Ban / Delete / Not spam buttons β a human stays in the loop. Members with Manage Messages (or a configured immune role) are never inspected.
Together with the text rules below, this replaces YAGPDB's AutoMod.
Some users fragment a single thought across a stream of one-word messages
instead of sending it as one message β which buries ongoing conversation and
leaves no room to reply. The bot flags this pattern: N short messages from
one user inside a short window (AUTOMOD_FLOOD_*, defaults: 5 messages β€ 25
chars in 15 s) lands a Message flooding alert in the same mod-log console as
the image automod, with the same Confirm / Timeout / Ban / Delete / Not-spam
buttons. By default it only alerts (flooding is usually a habit, not an attack);
set automod.flood.autoTimeout (on) to also time the user out automatically.
Members with Manage Messages (or a configured immune role) are never flagged.
New members often fire the same question into every channel at once instead
of the one that fits. Two tenure-aware signals catch this (AUTOMOD_CROSSPOST_*):
- Near-identical fan-out (any tenure) β the same question (token-overlap β₯
SIMILARITY_PCT, default 80%) acrossCHANNELS+ channels (default 2) inside the window. High confidence, so the bot auto-deletes the duplicate copies, keeping the first, then alerts. - New-member spread (recent joiners only) β posting substantive messages in
SPREAD_CHANNELS+ channels (default 3) at once, even when reworded enough to dodge the similarity check. Alerts only β these aren't strict duplicates.
Both surface in the same mod-log console with the usual action buttons, reuse
the existing new-member window, and respect the immune-role/permission checks.
Short greetings and reactions (below MIN_CHARS) are ignored.
A port of the server's YAGPDB AutoMod setup (src/utils/automod/rules/). Needs
logs.modChannelId. Moderators are exempt; helpers are exempt except for
dangerous links. Edited and forwarded
messages are checked too.
- Spam (one composite rule): phishing and Discord/Steam lookalike links (plus an optional downloaded phishing list), invites to other servers, masked links that open a different site than they show, the same message repeated in one channel, a staff-managed website denylist, and an invite in a member's name. A hit deletes, DMs, times out for 3 hours, records a violation and alerts mods; 3 violations in 48 hours kick. A burst counts as one violation. A masked link between two ordinary sites, or an invite Discord can't look up right now, only alerts. Discord's own AutoMod hits can be added as a trigger (off by default).
- Banned words (empty by default; code is ignored), mass mentions and
Zalgo text: delete with a short self-deleting notice. An
@everyone/@herefrom someone who can't ping only counts with a link. - Caps and emoji: available, off by default.
Only Spam records violations. Official sites (arduino.cc, github.com, discord.com, youtube.com and others) can't be denylisted.
Each rule's actions and thresholds are tunable, and staff edit the
banned-word list, website denylist and invite allowlist live with
/automod filter (saved to Postgres when connected, in memory otherwise).
Alerts carry Time out / Ban / Not a violation buttons (Ban asks to confirm).
- Moderation commands (see Commands) respect role hierarchy, DM the target where relevant, and post every action to the mod-action log channel (falls back to the automod mod-log). With a database, warnings and actions are kept as moderation history; reaching a configurable number of active warnings can time the member out automatically.
- Message log β edits, deletes and bulk deletes (as a
.txttranscript). Old text comes only from the in-memory message cache, which is capped at 24 hours; it is never written to disk. - Member log β nickname, role, username/display-name and timeout changes.
- Join-raid detection β a burst of joins, or of young accounts, posts one alert per wave to the mod-log with Raise verification level / Restore / Kick listed accounts / Dismiss buttons. A wave ends when joins slow down, after 15 minutes, or when dismissed; the kick only covers accounts that joined during the wave. An optional minimum account age flags (or kicks) brand-new accounts as they join.
Members DM the bot to reach staff. After a "Send this to the staff?"
confirmation, each conversation becomes a private thread (or forum post) in a
staff channel; staff answer with /reply / /areply or the thread buttons,
keep internal /notes, and /close (optionally on a delay). Closed tickets are
logged with a .txt transcript. Includes blocks, saved snippets, a per-user
ticket limit, relayed edits, and retention-based cleanup. Needs Postgres.
Ambient helpers, each self-disabling until configured:
- Auto-crosspost announcement channels, with logging.
- Join/leave logging with invite-source attribution (+ optional analytics when a DB is present).
- Role-select buttons to toggle event / server-update opt-in roles.
- Message-link flattening β quote a linked message inline for context.
- Sticky command guide in the bot-commands channel: a short list of the common commands, moved back to the bottom after
sticky.minMessagesmessages (default 10), at most everysticky.minIntervalSeconds(default 5 minutes). Turn off withsticky.enabled.
Features aimed at taking repetitive load off the community members who answer the most questions:
- Keyword β tag suggestions β when a message matches a known signature
(AVRDUDE, missing-library, ESP upload, level shifters, power, pull-ups, 9V,
HID, debounceβ¦), the bot offers the matching tag via a single button, so
askers self-serve before a helper repeats a canned answer. Each trigger lives
next to its tag in
tags.ts. Per-user cooldown; toggle withsuggest.tagEnabled. Trusted members and up (Trusted, Knowledgeable, helpers, moderators, managers; see theroles.*settings) are never shown suggestions. - Unformatted-code nudge β detects code pasted as plain text and offers the
codeblocktag, the single most-repeated ask. Togglesuggest.codeFormatEnabled. Subject to the same role exemption as keyword suggestions. - "Just ask" nudge β replies to low-effort pings ("can I ask?", "anyone
here?") with the
asktag. Conservative patterns; off by default, turn onsuggest.askEnabled. Subject to the same role exemption as keyword suggestions. - Suggestion ignore list β set
suggest.ignoreChannelIdsto suppress all three suggestions in specific channels (e.g. staff channels). Listing a forum channel's ID silences all its threads. - "Request more info" context-menu β right-click any message β Request more
info to post the
needinfochecklist to the asker in one click. Trusted members and up. - Auto-needinfo on thin posts β when a new help thread lacks substance (no
code, image, URL, or inline code, and the post title + body together are under
help.needinfoMinCharscharacters), the bot sends a concise checklist and the Mark Solved button in a single message. Off by default (turn onhelp.autoNeedinfo). The full/tag needinfochecklist used by helpers is unaffected. - Solve workflow β a Mark Solved button on new help threads (set
help.channelIds) plus/solved [helper:@user], which closes the post and credits whoever helped. - Stale-post nudge & auto-archive β abandoned help posts get a "still need
help?" nudge after a few days, then auto-archive only if no one replies for a
while longer (defaults 3 then 7 days β helpers often take a while; tune with
help.staleNudgeHours/help.staleArchiveHours). /openpostsβ an ephemeral digest of open help posts, oldest-waiting first, so helpers can pick up whatever's been waiting longest.- Error decoder β a curated table of common errors (avrdude sync, sketch too
big, undeclared names, missing headers, ESP upload failures, Guru Meditation
crashes incl. null pointers, ESP reset reasons and exceptions, watchdogs,
brownout, busy or forbidden serial ports, β¦) with a plain explanation and the
likely fixes. In help posts, an error the asker posts is explained once per
error type (at most two replies per post), with a button for the matching tag;
the tag suggester stays quiet on that message. Anywhere, right-click β
Explain error. Settings
help.decoder.autoEnabled/contextMenuEnabled. - Similar solved posts β a new help post's first bot message lists up to 3
recently solved posts (β
title, last
help.similar.lookbackDaysdays) whose title and opening message share uncommon keywords with it. Nothing is shown for weak matches (help.similar.minScore). The index is built in memory from archived threads and refreshed at most every 30 minutes. - Image tips β once per help post, for images in the asker's first few
messages: a tiny or one-line-cropped screenshot whose OCR reads like an IDE
error gets "copy the error text instead" (and the error is decoded), and a
photo too blurry to read gets a tip plus a pointer to a wiring diagram.
Settings
help.imageTips.enabled/blurThreshold.
The help assistants (decoder, similar posts, image tips) only act in help posts, only for the asker, never for Trusted members and up, and fold into the bot's Mark Solved message where they can.
Help channels can be forum or text channels. List both kinds in
help.channelIdsβ forum posts and threads opened inside text help channels get the same Mark-Solved / needinfo / stale-sweep //openpoststreatment. The keyword/code/ask suggestions and Request more info work server-wide regardless of channel type (subject to role exemptions and ignore lists). Plain, thread-less messages in a text channel can't be archived, so the thread lifecycle simply doesn't apply to them.
src/
βββ index.ts # client bootstrap (intents, presence, login)
βββ commands/ # slash commands (tags, help posts, moderation, /automod, modmail)
βββ listeners/ # gateway events (messages, members, invites, logs, automod, modmail DMsβ¦)
βββ interaction-handlers/ # buttons & modals (spam/rule consoles, join raid, modmail, role-select, tags)
βββ utils/
βββ automod/ # spam detection (image, flood, crosspost, join raid) + rules/ (text rules)
βββ moderation/ # moderation commands: actions, escalation, hierarchy, purge, records
βββ modlog/ # message and member logs
βββ calc/ # /calc math: safe expression parser, circuits, color codes, AVR timers (pure, unit-tested)
βββ modmail/ # modmail service, DM flow, transcripts, snippets, blocks, hooks
βββ config.ts # env-driven configuration
βββ db.ts # optional Prisma (pg driver adapter) with in-memory fallback
βββ tags.ts # tag content + schema
βββ embed.ts # shared base embed
prisma/ # schema + migrations
Stack: discord.js v14 Β· Sapphire framework Β· TypeScript 6 Β· Prisma 7 (+ Postgres, optional).
Want to add a tag or a feature? PRs welcome!
- Fork & branch.
- Add a tag: edit
src/utils/tags.tsand add it to the.addChoices()list insrc/commands/tag.ts. npm run buildto type-check.- Open a PR against
stagingwith a clear description.
Found a bug or have an idea? Open an issue.
License: GPL-3.0-or-later Β· Made with β€οΈ by the Arduino Discord community