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:
co-authored by
Claude Fable 5.2
parent
7d4893bc3f
commit
51371da0e0
+14
-2
@@ -5,6 +5,7 @@ package app
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"log/slog"
|
||||
"os"
|
||||
"strings"
|
||||
@@ -188,10 +189,20 @@ func New(ctx context.Context, opts Options) (*App, error) {
|
||||
return fail(fmt.Errorf("app: unknown storage backend %q", cfg.Storage.Backend))
|
||||
}
|
||||
|
||||
tr, err := i18n.Load(locales.FS, log)
|
||||
// Catalogs are built in. LOCALES_DIR loads them from disk instead, so
|
||||
// a translator can edit and "/reload i18n" without a new build.
|
||||
var catalogs fs.FS = locales.FS
|
||||
var reload func() error
|
||||
if cfg.LocalesDir != "" {
|
||||
catalogs = os.DirFS(cfg.LocalesDir)
|
||||
}
|
||||
tr, err := i18n.Load(catalogs, log)
|
||||
if err != nil {
|
||||
return fail(err)
|
||||
}
|
||||
if cfg.LocalesDir != "" {
|
||||
reload = func() error { return tr.Reload(os.DirFS(cfg.LocalesDir)) }
|
||||
}
|
||||
|
||||
a.runner = opts.Runner
|
||||
if a.runner == nil {
|
||||
@@ -254,6 +265,7 @@ func New(ctx context.Context, opts Options) (*App, error) {
|
||||
I18n: tr,
|
||||
Log: log,
|
||||
WorkerSlots: func() int { return cfg.Worker.Concurrency },
|
||||
ReloadI18n: reload,
|
||||
})
|
||||
if err != nil {
|
||||
return fail(err)
|
||||
@@ -289,7 +301,7 @@ func New(ctx context.Context, opts Options) (*App, error) {
|
||||
}
|
||||
|
||||
// allowedUpdates is the list of update types the bot asks Telegram for.
|
||||
var allowedUpdates = []string{"message", "callback_query"}
|
||||
var allowedUpdates = []string{"message", "callback_query", "my_chat_member"}
|
||||
|
||||
// Run starts every loop and blocks until ctx ends. Shutdown is ordered:
|
||||
// updates stop first, then the worker hands back its jobs, then the
|
||||
|
||||
Reference in New Issue
Block a user