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
+15
View File
@@ -71,6 +71,17 @@ type Config struct {
// when the embedded worker is on and worker otherwise.
ProbeMode string `toml:"probe_mode" env:"PROBE_MODE"`
// Support is where /support points users: a @username or a link.
Support string `toml:"support" env:"SUPPORT_CONTACT"`
// MiniApp turns the Mini App links on. It needs PublicURL.
MiniApp bool `toml:"miniapp" env:"MINIAPP_ENABLED"`
// LocalesDir, when set, loads the translation catalogs from this
// directory instead of the ones built into the binary, and makes
// "/reload i18n" pick up edits without a restart.
LocalesDir string `toml:"locales_dir" env:"LOCALES_DIR"`
// PublicURL is the HTTPS base URL this server is reachable at from the
// internet, without a trailing slash. It is used for payment webhooks,
// "open in wallet" links and the Mini App.
@@ -508,6 +519,10 @@ func (c Config) RequiredTags(site string) string {
return strings.Join(tags, ",")
}
// MiniAppEnabled reports whether Mini App links can be shown. The Mini App
// is served from PublicURL, so both are needed.
func (c Config) MiniAppEnabled() bool { return c.MiniApp && c.PublicURL != "" }
// ProbeLocally reports whether the core itself runs metadata lookups.
func (c Config) ProbeLocally() bool {
switch c.ProbeMode {