Phase 5: groups

Group wallets, group passes, spending rules and admin-only settings.

- Groups recorded from my_chat_member; admin rights verified with
  getChatMember and cached for five minutes
- Group context in entitlement resolution: group pass, group credits under
  the spending rule (anyone, admins only, capped per person per day) and
  the group's daily cap; refunds go back to the wallet that paid
- Group gate before any lookup: bot on or off, who may use it, allowed
  and blocked sites, plus the owner's maintenance mode
- /settings with inline toggles checked on every press, /grouplang,
  /autodetect, /allow, /block, /spending, /groupwallet, /grouppass,
  /groupstats
- Deep links with the target pre-selected: paying for a group happens in
  the private chat; a refused download in a group offers "Buy for me" and
  "Add group credits"
- Optional link detection, tidy mode, default quality and language per
  group; per-member usage
- /quality, /language, /app, /privacy, /terms, /support
- Remaining owner tools: /stats, /queue all, /user, /group, /ban, /unban,
  /grant (passes and gift codes), /credit, /refund, /blocklist,
  /broadcast with confirmation, /maint, /reload i18n

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Michilis
2026-11-18 09:46:32 +00:00
co-authored by Claude Fable 5.2
parent 7d4893bc3f
commit 51371da0e0
23 changed files with 3231 additions and 81 deletions
+29 -2
View File
@@ -3,8 +3,8 @@
A Telegram bot that downloads video and audio from links, in private chats
and in groups. Written in Go on top of yt-dlp.
> Status: Phase 4 of 8 (core bot, payments, cache, scale-out). Group
> settings, the Mini App and more languages follow. See
> Status: Phase 5 of 8 (core bot, payments, cache, scale-out, groups).
> The Mini App and more languages follow. See
> [docs/ASSUMPTIONS.md](docs/ASSUMPTIONS.md) for the decisions made so far.
## What works today
@@ -33,6 +33,9 @@ and in groups. Written in Go on top of yt-dlp.
ports, per-worker revocable tokens, tags to route sites to the right
network, drain, automatic requeue when a worker dies.
- SQLite or Postgres, local disk or S3, chosen by configuration.
- Groups: a group wallet and group pass, spending rules, admin-only
settings with inline toggles, allowed and blocked sites, optional link
detection, per-member usage.
- Friendly, translated error messages. Raw tool output stays in the logs.
## Quick start with docker compose
@@ -95,6 +98,22 @@ curl localhost:8080/healthz
| `/referral` | Your invite link and how many joined (private chat) |
| `/donate` | Send a tip (private chat) |
| `/quality` | Your default format, to skip the card |
| `/language` | Change the bot's language |
| `/privacy`, `/terms`, `/support` | Short texts (private chat) |
In groups:
| Command | Who | What it does |
| --- | --- | --- |
| `/groupwallet`, `/grouppass` | anyone | Group balance and pass, with a link to top up |
| `/settings` | admins | Quick switches |
| `/grouplang <code>` | admins | Language of the bot in the group |
| `/autodetect on\|off` | admins | Fetch pasted links without a command |
| `/allow <site>`, `/block <site>` | admins | Site lists |
| `/spending <rule>` | admins | Who may spend group credits |
| `/groupstats` | admins | Usage by member, last 7 days |
Owner commands (private chat, only for the IDs in `OWNER_IDS`):
| Command | What it does |
@@ -104,6 +123,14 @@ Owner commands (private chat, only for the IDs in `OWNER_IDS`):
| `/workers` | Workers, their state, load, tags and yt-dlp version |
| `/drain <worker>` | Let a worker finish its jobs and take no new ones |
| `/ytdlp update` | Update yt-dlp on every worker now |
| `/stats`, `/queue all` | Numbers, and every active job |
| `/user <id>`, `/group <id>` | Look up a user or a group |
| `/ban <id>`, `/unban <id>` | Ban a user |
| `/grant`, `/credit`, `/refund` | Passes, credits and gift codes |
| `/blocklist` | Block sites or single videos |
| `/broadcast <text>` | Message every user, after a confirmation |
| `/maint on\|off` | Maintenance mode |
| `/reload i18n` | Reload translations from `LOCALES_DIR` |
### Turning on payments