Skip to content

Add named chat management commands (/chats, /addchat, /rmchat, /defaultchat) - #72

Merged
EngDawood merged 2 commits into
mainfrom
claude/admin-chat-subscriptions-ur457j
Sep 24, 2026
Merged

EngDawood merged 2 commits into
mainfrom
claude/admin-chat-subscriptions-ur457j

Conversation

@EngDawood

Copy link
Copy Markdown
Owner

Summary

Adds a new set of Telegram bot commands for managing named chats—manual/AI-agent post targets that are distinct from auto-post channel subscriptions. Users can now create, list, set defaults, and remove named chats via dedicated commands.

Key Changes

  • New command module (chat-commands.ts): Implements four new commands:

    • /chats — List all configured named chats with their IDs, types, and default status
    • /addchat name @user_or_id [type] [default] — Add or update a named chat, optionally setting it as default
    • /rmchat name — Remove a named chat by name
    • /defaultchat name — Set a named chat as the default post target
  • Database integration: Leverages existing chats table operations (getChats, getChatByName, upsertChat, removeChat, setDefaultChat)

  • Channel resolution: Uses resolveChannel helper to convert usernames/IDs to chat IDs, supporting both numeric IDs and @username format

  • Bot registration: Integrated into bot factory (bot-factory.ts) alongside other command modules

  • Help documentation: Updated /help and /start commands to document the new chat management feature and distinguish it from channel subscriptions

  • Command metadata: Added command descriptions to BOT_COMMANDS for Telegram's command menu

Implementation Details

  • Commands use HTML parsing for safe display of user-provided names and IDs
  • /addchat supports optional type parameter (defaults to channel) and default flag for setting as default in a single operation
  • Proper error handling for missing chats, invalid targets, and malformed input
  • User-friendly feedback with emoji indicators (✅ for success, 🗑️ for removal, ⭐ for default status)

https://claude.ai/code/session_01PkN4eRaXuCCNtezToQTFNn

The `chats` table (named post targets, one marked default, used by
post_message/post_to_telegram) was previously only manageable via MCP
tools or the Admin Action API, with no way to manage it from Telegram
itself. Add /chats, /addchat, /defaultchat, /rmchat commands mirroring
the existing channel-commands.ts pattern, and sync BOT_COMMANDS plus
the /start and /help text per project convention.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkN4eRaXuCCNtezToQTFNn
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
🔵 In progress
View logs
rss-bridge 632269a Sep 24 2026, 10:03 PM

/set_default only covered message formatting; the check interval for
newly registered channels was hardcoded to 30 minutes with no way to
change it. Add a global config key (default_check_interval_minutes,
via getGlobalCheckInterval/setGlobalCheckInterval) and wire it into
/set_default delay <minutes>, replacing the hardcoded 30 in both
auto-register-on-/sub and /add flows. Existing channels are unaffected
and still use /delay @channel to change their own interval.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkN4eRaXuCCNtezToQTFNn
@EngDawood
EngDawood marked this pull request as ready for review September 24, 2026 22:03
@EngDawood
EngDawood merged commit 4282997 into main Sep 24, 2026
1 of 2 checks passed
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