read-channel
Read recent messages from a Discord channel using the Hermes bot token
Files2
View on GitHubSKILL.mdskills/discord/read-channel/SKILL.md
GitHubDiscord Read Channel Skill
Read recent messages from a Discord channel using the existing Hermes bot token.
Usage
Call with: read discord channel <channel_id> [limit]
Parameters:
channel_id(required): The numeric ID of the Discord channel to readlimit(optional, default 50): Maximum number of messages to retrieve
Implementation
The script lives at /home/lumi/.hermes/scripts/read_discord_channel.py <channel_id> [limit].
It uses discord.py from the Hermes venv (it inserts the venv site-packages path itself).
The token is stored in /home/lumi/.hermes/.env as DISCORD_BOT_TOKEN.
How to actually run it
CRITICAL: The DISCORD_BOT_TOKEN is NOT available in execute_code sandboxes or
in fresh terminal shells automatically. The .env file does NOT use export prefixes,
so plain source sets variables but does NOT export them to child processes.
You MUST use set -a to auto-export:
set -a && source /home/lumi/.hermes/.env && set +a && python3 /home/lumi/.hermes/scripts/read_discord_channel.py <channel_id> [limit]
DO NOT use execute_code — the Python sandbox does not inherit shell env vars.
DO NOT use plain source /home/lumi/.hermes/.env — variables won't be exported to the python3 child process.
DO use set -a && source ... && set +a to ensure export, then terminal tool.
Pitfalls
- The .env file masks the token in terminal output (shows
MTM2Nz...dn4A), but the full token IS present and works fine. Don't let the ellipsis fool you. - If the script says
Error: DISCORD_BOT_TOKEN not set, plainsourcedoesn't export variables — useset -a && source /home/lumi/.hermes/.env && set +ainstead. execute_codePython sandbox lacks access to the token — always useterminalwith source.cat /proc/<pid>/environmay not show Discord env vars if Hermes loads them at runtime internally rather than from shell env.- The token in
/home/lumi/.hermes/.envappears truncated when printed but is complete.
Example Output
{
"channel": "🏠・lumi's-house",
"messages": [
{
"id": "1489703331608789013",
"author": "adora.witch",
"author_id": "221767496145960960",
"content": "Hi Lu, I see you looking in here now <3",
"timestamp": "2026-04-03T19:09:11.605000+00:00",
"attachments": [],
"embeds": 0
}
]
}
Requirements
discord.pyinstalled in the Hermes venv (already present)- Bot has
Read MessagesandView Channelpermissions - Target channel accessible to the bot