These notes make AI agents productive immediately in this Hubot project (bot name: "batpoet"). Keep answers specific to this codebase.
- A Node.js Hubot bot that runs on Slack and Discord. Local development uses the shell adapter via hubot-dotenv.
- State is persisted with Redis (hubot-redis-brain). Docker Compose provides Redis; production can use any REDIS_URL.
- External capabilities are pulled in via
external-scripts.jsonand configured by environment variables (see each script’s README).
- Local CLI:
npm run local(loads.envvia hubot-dotenv; alias is!; name isbatpoet). - Slack:
npm run start:slack(adapter slack; requires Slack credentials in env). - Discord:
npm run start:discord(adapter discord; requires Discord credentials in env). - Docker:
docker compose upuses theDockerfileentrypointbin/start.shto launch Slack and Discord concurrently; both setPORT=0to avoid conflicts. - Procfile:
web: npm run startfor PaaS that honor Procfiles. - Tests:
npm testonly checks env configuration via hubot-dotenv’s--config-check.
package.json- Node pinned via Volta:
20.17.0. - Scripts:
start:slack,start:discord,local,test. Prefer these commands over hand-rolled node invocations.
- Node pinned via Volta:
bin/hubotwraps hubot startup, prepends local binaries to PATH; used by start scripts.bin/start.shspawns Slack and Discord in background and waits; this is the container entrypoint.external-scripts.jsonlists installed Hubot scripts loaded at startup.scripts/holds custom behaviors:ftfy.jsrewrites messages that start with.to the correct alias (!) usingTextMessageandrobot.receive().deploy.jstriggers a Jenkins job; uses Slack thread replies (thread_ts) and attachment formatting. This is Slack-specific.
- Core env you’ll likely need:
- Redis:
REDIS_URL=redis://...for hubot-redis-brain. In Docker Compose, service DNS isnashvillest-redis. Note: Compose setsREDIS_URL=redis://nashvillest-redis:16379(non-default port); default Redis is 6379. - Adapters: Slack/Discord tokens and secrets per adapter docs (do not guess names; consult
hubot-slackandhubot-discord). - hubot logging: set
HUBOT_LOG_LEVEL=debugfor verbose logs.
- Redis:
- Local config flows through
.env(copy from.env-distif present) and is loaded byhubot-dotenv.
- New bot features live in
scripts/*.jsand export(robot) => { ... }using Hubot APIs:robot.hear,robot.respond,robot.router, etc. - Favor Slack threads for long-running actions when interacting in Slack (see
deploy.js’s use ofthread_ts). - If adding third-party scripts:
- add the package to
dependencies, - list it in
external-scripts.json, - document required env vars in
README.mdand.env-dist.
- add the package to
- The container starts both Slack and Discord; ensure credentials for both or disable one by overriding the entrypoint/command.
PORT=0in start scripts is intentional to avoid binding conflicts. Don’t remove unless you know the adapter’s network needs.- Some external scripts (weather, hockey, etc.) require API keys; missing keys can cause runtime warnings or disabled commands, not crashes.
- When using Redis in Compose, verify
REDIS_URLhost and port match the running service; Compose usesnashvillest-redis:16379.
- Create
scripts/hello.jsexporting a function that registersrobot.respond(/hello/i, (msg) => msg.reply('Hi!')). - Run locally with
npm run localand test with! hello.
If anything here is unclear (e.g., adapter env names, Redis setup, or deploy flow), tell me what you want to improve and I’ll refine these instructions.