Ephemeral commands + vahter confirmations (Bot API 10.2)#212
Merged
Conversation
Public-chat moderation commands (/ban, /sban, /unban) can now be registered with is_ephemeral so clients send them invisibly to other chat members, and the issuing vahter can get a short self-dismissing ephemeral confirmation in the same chat. Both behind default-off DB-backed flags: - EPHEMERAL_COMMANDS_ENABLED: new BotCommandsSetupService registers the commands with is_ephemeral in the all_group_chats scope on startup; when off, deletes the registration so clients revert to plain visible commands. - EPHEMERAL_CONFIRMATION_ENABLED: after /ban, /sban, /unban the issuing vahter receives an ephemeral confirmation (receiver_user_id, CallIgnore — best-effort, never fails the command). Lives in the AdminCommand dispatch so ML auto-bans never confirm; logs-channel reporting unchanged. Incoming ephemeral commands (TgMessage.IsEphemeral) skip the delete-command-message step — they are invisible and auto-expire; the delete path stays for old clients. Ephemeral /ban ping gets an ephemeral pong. Known risk (accepted): Telegram docs don't say whether an ephemeral command can be a reply (required by /ban and /sban). If broken in practice, flip EPHEMERAL_COMMANDS_ENABLED off. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019QJX5JAiRcLoPsyK7naF8E
Szer
enabled auto-merge (squash)
July 16, 2026 20:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Makes the public-chat moderation commands invisible and gives vahters in-chat feedback, using the ephemeral messages/commands feature from Bot API 10.2 (supported since Funogram.Telegram 10.2.0, #211). Everything is behind two DB-backed flags (
bot_setting, hot-reloadable via/reload-settings), default off in code; ops seeds them ON manually via SQL:EPHEMERAL_COMMANDS_ENABLEDBotCommandsSetupServiceregisters/ban,/sban,/unbanwithis_ephemeral = truein theall_group_chatsscope at startup, so clients send them invisibly to other chat members. When off, deletes the registration (revert requires a restart).EPHEMERAL_CONFIRMATION_ENABLED/ban,/sban,/unbanthe issuing vahter gets a short self-dismissing ephemeral confirmation in the same chat (✅ Banned @user(id),✅ Soft-banned … for 12h,✅ Unbanned …,⚠️ User <id> not found). Applies instantly on reload.How
Req.SendMessage.Make(chatId, text, receiverUserId = vahter.Id)viaCallIgnore— ephemeral delivery is best-effort by design (may not arrive if the vahter is offline) and must never fail the command itself. Placed in theAdminCommanddispatch, so ML auto-bans never confirm; logs-channel reporting is unchanged.TgMessageexposesIsEphemeral/EphemeralMessageId;deleteCmdTaskskipsDeleteMessagefor ephemeral command messages (nothing visible to delete). The delete path stays for old clients that keep sending regular commands./ban pinganswers with an ephemeral pong instead of a public one.softBanDurationhelper soSoftBanMsgand the confirmation text share the/sban [hours]parsing.Tests
tests/VahterBanBot.Tests/EphemeralTests.fs(6 tests on the fake-Telegram infra): confirmation sent/suppressed per flag, unban/softban confirmation content, ephemeral command not deleted while the ban still lands, ephemeral ping/pong.Tg.quickMsg/Tg.replyMsggained?ephemeralMessageId. Flag is restored inDisposeAsyncper theAdminCommandTestsprecedent.Rollout & accepted risk
Flags are seeded ON in prod via a manual
bot_settingupsert (no migration), so both features go live with the deploy. Unverified: Telegram docs don't say whether an ephemeral command can be a reply to a regular message, which/ban//sbanrequire — after deploy, verify/ban-as-reply from an updated client actually reaches the bot with a usable reply target. Kill switches: flipEPHEMERAL_CONFIRMATION_ENABLEDoff (+/reload-settings, instant) and/orEPHEMERAL_COMMANDS_ENABLEDoff (+ restart to re-register plain commands).🤖 Generated with Claude Code
https://claude.ai/code/session_019QJX5JAiRcLoPsyK7naF8E