Polyhydra Skills / Dev Tools
Send the user a Discord DM via their private bot (SpottieClaw#3956, in the "Polyhydra Games Internal" server) using credentials from ~/.config/secrets/discord.env. Use when a long-running task finishes, something needs the user's attention and they may not be watching the terminal, or they explicitly ask to be pinged/notified/messaged on Discord.
Drop this in — save the block below as ~/.claude/skills/discord-notify/SKILL.md, or run:
mkdir -p ~/.claude/skills/discord-notify cat > ~/.claude/skills/discord-notify/SKILL.md <<'EOF' # (paste the full source block below into this file) EOF
# Discord notify Sends a one-way DM to the user through their private Discord bot. This is a plain REST call — it does **not** require the interactive chat service in `~/code/discord-relay` to be running; the two are independent uses of the same bot token. Credentials live in `~/.config/secrets/discord.env` (`DISCORD_BOT_TOKEN`, `DISCORD_SERVER_ID`, `DISCORD_USER_ID`). `DISCORD_USER_ID` is the user's own Discord user ID, used as the DM recipient. ## Hard rule: never print the bot token Don't `cat`/`echo` `~/.config/secrets/discord.env`, don't paste the token into a curl command you display to the user, and don't dump it via any other means. Always `source` the file and reference `$DISCORD_BOT_TOKEN` as a variable — never embed the literal token value in a command string. ## Sending a message ```sh source ~/.config/secrets/discord.env bash ~/.claude/skills/discord-notify/scripts/send-dm.sh "Your message text here" ``` `scripts/send-dm.sh` opens (or reuses — it's idempotent, Discord returns the same channel ID for repeat calls) the DM channel with `$DISCORD_USER_ID`, encodes the message body safely via `python3 -c` (handles quotes/newlines correctly), and posts it. It does not source the env file itself — callers that need their own env-loading behavior (e.g. `codeburn`'s notify script, which unsets stale vars and supports a configurable secrets path before calling this script for its own DM leg) stay in control of that step. ## Checking it landed The script prints `posted -> DM (<channel-id>)` on success. A non-2xx status from Discord makes the underlying `curl -f` exit non-zero, which propagates as the script's exit code — check that rather than parsing output for success.