Skip to content

feat(client): discord.js client + structured READY logging - #2

Merged
mortik merged 1 commit into
mainfrom
feat/discord-client
May 26, 2026
Merged

feat(client): discord.js client + structured READY logging#2
mortik merged 1 commit into
mainfrom
feat/discord-client

Conversation

@mortik

@mortik mortik commented May 26, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds src/env.ts (zod-validated DISCORD_TOKEN / LOG_LEVEL / CONFIG_PATH).
  • Adds src/logger.ts (pino, ISO timestamps, configurable level).
  • Adds src/client.ts — minimal discord.js Client with just the Guilds intent. Reaction intents (GuildMessageReactions) and the privileged GuildMembers intent will be added in step 5 alongside the actual reaction handlers, so this step doesn't require any Developer Portal changes yet.
  • Adds src/events/ready.ts — logs bot tag, connected guilds, and verification count when the gateway fires READY.
  • Wires bootstrap into src/index.ts with graceful SIGINT/SIGTERM shutdown.

Implements step 3 of docs/exec-plans/v1.md.

Test plan

  • pnpm test — adds 4 env tests on top of the 8 config tests (12 total)
  • pnpm lint, pnpm typecheck, pnpm build clean
  • Manual smoke (fake token): bootstrap completes, fatal logs cleanly on TokenInvalid
  • Manual smoke (real token): connected to FleetYardsNet, READY event logged structured JSON, SIGTERM shut down cleanly

Follow-ups

  • Step 4: port the sweep from the original bash script (uses REST, no extra intent needed).
  • Step 5: reaction handlers — at that point we'll add GuildMessageReactions + GuildMembers intent + message/channel/reaction partials, and the Server Members Intent toggle in the Developer Portal becomes required.

🤖 Generated with Claude Code

Adds the gateway connection plumbing:
- src/env.ts validates DISCORD_TOKEN, LOG_LEVEL, CONFIG_PATH with zod
- src/logger.ts exports a pino instance with ISO timestamps
- src/client.ts builds the discord.js Client with the Guilds intent
  (reaction intents land alongside the reaction handlers in step 5)
- src/events/ready.ts logs bot tag, guild list, and verification count
- src/index.ts wires bootstrap + graceful SIGINT/SIGTERM shutdown

Verified end-to-end against the live bot: ready event fired and logged
"Yards Bot#6673" connected to FleetYardsNet.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mortik
mortik merged commit 13d2ebf into main May 26, 2026
1 check passed
@mortik
mortik deleted the feat/discord-client branch May 26, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant