3.6 KiB
3.6 KiB
name, description
| name | description |
|---|---|
| discord-dm | Send a Discord message to an org member's DMs or to a team channel via the ClaudeTools bot. Use this whenever you need to hand a person something copy-paste-friendly that the terminal would wrap or mangle — consent links, long single-line commands, URLs, tokens-to-rotate notices — or to ping someone directly. Prepopulated with every org member's user ID and the team channel IDs, so you address people by name (mike/howard/rob/winter) not raw snowflakes. Invoke on: "DM me/<person> in discord", "send <person> a discord message", "message <person> on discord", "discord DM", "send that link to my discord", "ping <person>". For one-line [SYNCRO]/[RMM] status alerts to the alert channels, prefer post-bot-alert.sh; use this for direct/person-targeted delivery. |
discord-dm — direct Discord messaging to the org
Thin wrapper over the Discord bot API. The engine is
.claude/scripts/discord-dm.sh; this doc is the usage contract.
When to use
- Wrapped command lines — Mike's standing rule: any wrapped/long single-line
output (M365 consent links, long CLI one-liners, URLs with query strings) gets
DM'd to him in Discord so it's cleanly copy-pasteable, not mangled by terminal
wrapping. Default target for that is
mike. - Pinging a specific teammate with something actionable.
- Posting to a team channel when you want to choose the channel explicitly
(
#bot-alerts/#dev-alerts).
For routine one-line [SYNCRO] / [RMM] status alerts, keep using
post-bot-alert.sh (it auto-routes by prefix). This skill is for person-targeted
DMs and deliberate channel posts.
Usage
bash .claude/scripts/discord-dm.sh <recipient> "message text"
echo "message text" | bash .claude/scripts/discord-dm.sh <recipient>
bash .claude/scripts/discord-dm.sh list # print known users + channels
<recipient>:
| Form | Effect |
|---|---|
mike howard rob winter |
opens/uses that user's DM channel |
#bot-alerts / bot |
posts to #bot-alerts (whole team) |
#dev-alerts / dev |
posts to #dev-alerts (Howard + Mike, private) |
chan:<id> |
posts to an arbitrary channel by ID |
<17-19 digit id> |
treated as a user DM |
Prepopulated directory (from .claude/users.json + post-bot-alert.sh)
| Name | Discord user ID | Channel | ID | |
|---|---|---|---|---|
| mike | 264814939619721216 | #bot-alerts | 624710699771232265 | |
| howard | 624667664501178379 | #dev-alerts | 1509998508198068484 | |
| rob | 261978810713505792 | |||
| winter | 624666486362996755 |
Keep this table and the USERS/CHANNELS maps in the script in sync with
.claude/users.json when people are added/removed.
Implementation notes / gotchas
- Bot token resolves from the SOPS vault
(
projects/discord-bot/bot-token.sops.yamlfieldcredentials.bot_token), falling back toprojects/discord-bot/.envDISCORD_TOKEN. Works from any machine, not just BEAST. - DMs require opening the user's DM channel first
(
POST /users/@me/channels {recipient_id}) then posting to that channel id. - Multiline payloads: always build JSON with
jq -nc --argand feed curl viaprintf '%s' "$payload" | curl ... --data-binary @-. Passing the JSON directly with-d "$(...)"mangled multiline content and returned Discord error50109 invalid JSON body(hit 2026-06-15 sending the CryoWeave consent link). - Not soft-fail: unlike
post-bot-alert.sh, a send failure exits non-zero — a requested DM is load-bearing, so surface the error. - The bot must share a server with the user and the user must allow DMs from server members, or the DM-channel open / send can 403.