{"skill":{"slug":"discord-history-reader","displayName":"Discord History Reader","summary":"Read Discord channel and thread message history directly via the Discord Bot API, bypassing OpenClaw's session-based message visibility. Use when you need to...","description":"---\nname: discord-context\ndescription: Read Discord channel and thread message history directly via the Discord Bot API, bypassing OpenClaw's session-based message visibility. Use when you need to read messages from a Discord thread or channel that has no active OpenClaw session, fetch historical context from a conversation you weren't part of, or access thread content that was mentioned but not visible in the current session. Triggers on \"read that thread\", \"what did they say in #channel\", \"fetch Discord messages\", \"get thread history\", \"I can't see that thread\".\n---\n\n# Discord Context\n\n## Problem\n\nOpenClaw is session-based: agents only see messages from conversations where they have an active session. Discord threads that the agent wasn't mentioned in or hasn't interacted with are invisible — there's no built-in tool to read arbitrary channel/thread history.\n\nAdditionally, OpenClaw redacts the Discord bot token from `openclaw config get` and environment variables (by design), so agents cannot make direct Discord API calls using the configured token.\n\n## Solution\n\nStore the Discord bot token in a separate file accessible to the agent, then use `curl` to call the Discord API directly.\n\n### Setup (one-time, run as the user)\n\n```bash\n# Store your bot token in a file outside the workspace (won't be git-committed)\necho 'YOUR_DISCORD_BOT_TOKEN' > ~/.openclaw/.discord-bot-token\nchmod 600 ~/.openclaw/.discord-bot-token\n```\n\nRecord the path in `TOOLS.md` so the agent knows where to find it across sessions.\n\n### Reading Messages\n\n```bash\n# Load token\nDISCORD_TOKEN=$(cat ~/.openclaw/.discord-bot-token)\n\n# Read recent messages from a channel or thread (threads are channels in Discord)\ncurl -s -H \"Authorization: Bot $DISCORD_TOKEN\" \\\n  \"https://discord.com/api/v10/channels/{channel_or_thread_id}/messages?limit=50\" \\\n  | python3 -m json.tool\n\n# Read messages before a specific message ID (pagination)\ncurl -s -H \"Authorization: Bot $DISCORD_TOKEN\" \\\n  \"https://discord.com/api/v10/channels/{channel_id}/messages?limit=50&before={message_id}\" \\\n  | python3 -m json.tool\n\n# List active threads in a guild channel\ncurl -s -H \"Authorization: Bot $DISCORD_TOKEN\" \\\n  \"https://discord.com/api/v10/channels/{parent_channel_id}/threads/active\" \\\n  | python3 -m json.tool\n```\n\n### Finding Thread/Channel IDs\n\n- Enable **Developer Mode** in Discord: User Settings → Advanced → Developer Mode\n- Right-click any channel or thread → **Copy Channel ID**\n- Thread IDs and channel IDs work the same way in the API\n\n### Key Notes\n\n- Discord returns messages newest-first by default\n- Max `limit` is 100 per request; use `before`/`after` params to paginate\n- The bot must be a member of the guild and have **View Channel** + **Read Message History** permissions\n- Rate limits apply: 50 requests/second per route (respect `429` responses and `Retry-After` headers)\n\n### Response Fields\n\nEach message object contains:\n- `content` — message text\n- `author.username` / `author.global_name` — who sent it\n- `timestamp` — when\n- `id` — message ID (for pagination or reply references)\n- `referenced_message` — the message being replied to (if a reply)\n\n### Security Considerations\n\n- The token file is `chmod 600` and outside the git-tracked workspace\n- The bot token grants read/write access to all channels the bot is in — treat it like a password\n- Prefer read-only API calls; do not use this for sending messages (use OpenClaw's native routing instead)\n- If the token is rotated in Discord Developer Portal, update both `openclaw config` and the token file\n","tags":{"latest":"1.0.0"},"stats":{"comments":0,"downloads":952,"installsAllTime":0,"installsCurrent":0,"stars":0,"versions":1},"createdAt":1773615745107,"updatedAt":1779078275654},"latestVersion":{"version":"1.0.0","createdAt":1773615745107,"changelog":"Initial release: read Discord channel/thread history via Bot API, bypassing OpenClaw session-based visibility limits","license":"MIT-0"},"metadata":null,"owner":{"handle":"easonc13","userId":"s17fkwdq9n4cahgs1jfqas4avx884bwy","displayName":"Eason Chen","image":"https://avatars.githubusercontent.com/u/43432631?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1779955966791}}