3 Commits
Author SHA1 Message Date
Thieu Nguyenandviettranx 0dab087fa3 feat(telegram): add yield mention mode for multi-bot group support (#471)
* feat(telegram): add yield mention mode for multi-bot group support

- Add "yield" mention_mode: bot responds to all messages unless another
  bot is explicitly @mentioned, enabling shared groups where bots coexist
- Skip messages from other bots (user.IsBot) in yield mode to prevent
  infinite cross-bot loops
- Enter mention gate for yield mode even when require_mention is false
- Add display_name to channel instance update allowlist
- Change default dev postgres port to 5444 to avoid conflicts

* fix(telegram): address yield mode review — pairing guard, mention check, naming

- Add pairing guard to bot-skip path in yield mode (prevent history
  recording in unpaired groups — matches existing security pattern)
- Check detectMention before skipping other bots' messages (allow
  cross-bot @commands like "@my_bot help" from another bot)
- Rename hasOtherBotMention → hasOtherMention (function yields on any
  @mention, not just bots — name now matches behavior)
- Remove dead MentionMode field from SlackConfig (no Slack handler uses it)
- Add mention_mode validation with warning log for unknown values

* fix(ui): swap mention_mode and require_mention field order

* fix(i18n): add translations for require_mention disabled hint

* fix(ui): apply mention_mode disabled hint to group override tab

* fix(i18n): improve mention_mode UI labels for clarity

Replace developer jargon (Strict/Yield) with user-friendly labels:
- "Mention Mode" → "Group Response Behavior"
- "Strict" → "Default (follow @mention setting)"
- "Yield" → "Multi-bot (respond unless another bot is @mentioned)"

---------

Co-authored-by: viettranx <viettranx@gmail.com>
2026-03-26 18:08:36 +07:00
viettranx 278a98ba74 feat: Add tool allow list configuration and enforcement for Telegram channels, allowing per-group/topic tool restrictions. 2026-03-02 21:17:19 +07:00
viettranxandClaude Opus 4.6 5bd486882d feat(telegram): port forum topic features from TS — per-topic config, DM threads, thread fallback, createForumTopic tool, Web UI
Port 4 missing Telegram forum/topic features from TypeScript OpenClaw:

1. Thread-not-found fallback: retry sends without message_thread_id when
   a topic is deleted (sendHTML, sendPhoto, sendVideo, sendAudio,
   sendDocument, stream flush).

2. Per-topic config: hierarchical config resolution (global → wildcard
   group "*" → specific group → specific topic) for groupPolicy,
   requireMention, allowFrom, enabled, skills, systemPrompt.
   New TelegramGroupConfig/TelegramTopicConfig structs, resolveTopicConfig()
   with 10 unit tests.

3. DM topic support: preserve message_thread_id in private chats for
   session isolation. New BuildDMThreadSessionKey, parseRawChatID handles
   🧵 suffix.

4. createForumTopic agent tool: ForumTopicCreator interface decoupled
   from telego, lazy bot resolution via channel manager.

5. Web UI: structured group/topic config form with tri-state booleans
   (Inherit/Yes/No), nested collapsible group and topic entries.

Also fix: forum group pairing reply and approval notification now
correctly set MessageThreadID so messages land in the right topic.
Send() extracts threadID from localKey suffix as fallback for cases
where metadata is absent (e.g. pairing approval via SendToChannel).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 13:45:21 +07:00