feat: admin-scoped Telegram menu

setMyCommands now runs at default scope (user commands only) plus once
per ADMIN_ID with scope:{type:'chat'} carrying the full set, so admin
commands (/addgroup, /delgroup, /listgroup) are hidden from non-admins'
menu. requireAdminUser remains the actual auth gate; this is UI cleanup.

parseAdminIds extracted to src/util/parse-admin-ids.js — shared between
config loading and the register script. ADMIN_IDS now required by
register-webhook.js (.env.deploy.example updated). Per-admin call uses
allowFail to gracefully skip admins who haven't DMed the bot yet.
This commit is contained in:
tiennm99 committed 2026-05-10 02:46:04 +07:00
1 parent 34354a93a7
commit 1ed82578c0
4 files changed
+60 -30

No files matched your search

+4
View File
@@ -6,6 +6,10 @@
TELEGRAM_BOT_TOKEN=
TELEGRAM_WEBHOOK_SECRET=
# Comma-separated Telegram user IDs (must match Vercel ADMIN_IDS).
# register-webhook.js sets a chat-scoped menu (with admin commands) per ID.
ADMIN_IDS=
# Where Telegram should send webhook updates.
# Format: https://<your-vercel-url>/api/webhook
WORKER_URL=https://store-scraper-bot.vercel.app/api/webhook