Skip to content

Add EQNotify feature under /eqnotify command#263

Merged
ebm5025 merged 1 commit into
mainfrom
claude/eqnotify-castle-bot-integration-5c7l4s
Jul 24, 2026
Merged

Add EQNotify feature under /eqnotify command#263
ebm5025 merged 1 commit into
mainfrom
claude/eqnotify-castle-bot-integration-5c7l4s

Conversation

@ebm5025

@ebm5025 ebm5025 commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Merges the standalone EQNotify batphone-notification bot into castle as a native feature under a new /eqnotify slash command. Subscribers register a delivery channel and a set of keyword tags; batphones posted in the batphone channel are matched against each subscriber's tags (buff / last-hour RTE calls filtered out) and an alert is pushed to their phone.

Ported from a v11-era standalone discord.js bot to castle's conventions: TypeScript, discord.js v14, Command/Subcommand classes, and Prisma/Postgres persistence (replacing the original users.json).

Commands

All commands moved to subcommands under /eqnotify:

  • Self-service: register, unregister, add-tag, remove-tag, list-tags, clear-tags, test
  • Officer/Mod/Knight-gated: add-user, remove-user

The original prefix commands map as: !addadd-tag, !removeremove-tag, !listlist-tags, !cleartagsclear-tags, !adduseradd-user, !testmsgtest.

Delivery backends

Two backends are selected per-subscriber and dispatched through a pluggable notifier that switches on type:

  • WirePusher (Android only) — carried over from the original.
  • Telegram (iOS/Android/desktop) — closes the WirePusher Android-only gap. Sending is a single authenticated POST to the Bot API; no new dependencies. Requires TELEGRAM_BOT_TOKEN; when unset, Telegram is offered nowhere and WirePusher works standalone.

Notable implementation detail

The original was a separate bot, so it saw castle's batphones as another bot's messages. Integrated, batphones are authored by castle itself (via /bp send), and messageCreateListener early-returns on bot authors — so the EQNotify dispatch runs before that guard, filtered to the watched channel. The buff/RTE content filter, substring tag-matching, and the all tag are all preserved. The watched channel defaults to the batphone channel and is overridable via eqnotifyChannelId.

Changes

  • New eqnotify_subscriber Prisma model + migration (20260724000000_add_eqnotify_subscribers).
  • New feature under src/features/eqnotify/: command + subcommands, service, notifiers (WirePusher/Telegram/dispatcher), and a channel message-action.
  • Pure matching/filtering logic extracted to matcher.ts with unit tests.
  • New config: TELEGRAM_BOT_TOKEN (optional), eqnotifyChannelId (optional).
  • README updated (feature list, env vars, EQNotify usage section).

Deployment notes

  • Run the new migration (prisma migrate deploy — already wired as the postdeploy step).
  • To enable Telegram: create a bot via @Botfather and set TELEGRAM_BOT_TOKEN. Users get their numeric chat ID (e.g. from @userinfobot) and paste it into /eqnotify register.

Testing

  • yarn test:ci — 71 tests pass (11 new for the matcher).
  • yarn tsc — clean.

🤖 Generated with Claude Code


Generated by Claude Code

Ports the standalone EQNotify batphone-notification bot into castle as a
native feature. Subscribers register a delivery channel and a set of keyword
tags; batphones posted in the batphone channel are matched against each
subscriber's tags (buff / last-hour RTE calls filtered out) and an alert is
pushed to their phone.

- New /eqnotify slash command with subcommands: register, unregister,
  add-tag, remove-tag, list-tags, clear-tags, test, plus officer-gated
  add-user / remove-user (Officer/Mod/Knight).
- Two delivery backends selected per-subscriber: WirePusher (Android) and
  Telegram (iOS/Android/desktop), dispatched via a pluggable notifier.
  Telegram requires TELEGRAM_BOT_TOKEN; when unset it is offered nowhere.
- Persists subscribers in Postgres via a new eqnotify_subscriber Prisma
  model + migration, replacing the original users.json.
- Dispatch runs from the message-create listener before the bot-author
  guard, since castle posts batphones itself via /bp send. Watched channel
  defaults to the batphone channel, overridable via eqnotifyChannelId.
- Pure matching/filtering logic extracted to matcher.ts with unit tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BWXRmPbtEz35wquwFd8Cu7
@ebm5025
ebm5025 merged commit 85a64e1 into main Jul 24, 2026
1 check passed
@ebm5025
ebm5025 deleted the claude/eqnotify-castle-bot-integration-5c7l4s branch July 24, 2026 15:05
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.

2 participants