Documentation
¶
Overview ¶
Package bot contains Telegram command handlers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommandName ¶
CommandName returns the lower-cased bot command without a bot suffix.
func IsAdminCallback ¶
IsAdminCallback reports whether callback data belongs to owner commands.
Types ¶
type AdminSyncFunc ¶
AdminSyncFunc runs reconciliation from an owner command.
type ChatTitleResolver ¶
ChatTitleResolver resolves a chat's live Telegram title for owner-facing diagnostics such as /chats. It returns false when the title cannot be read, letting callers fall back to the bare chat id.
type CommandDeps ¶
type CommandDeps struct {
Users *store.Users
Subscriptions *store.Subscriptions
Grants *store.Grants
Audit *store.Audit
Whitelist *store.Whitelist
Revocations *store.Revocations
Outbox *store.Outbox
Alerts *store.Alerts
Ops *store.Ops
ChatRoles []ChatRole
ChatInfo ChatTitleResolver
StatusEngine *engine.Engine
Members engine.MemberChecker
Preflight *engine.Snapshot
AdminSync AdminSyncFunc
// SubscribeLinks carries the deployment-specific subscription URLs the
// /boosty and /tribute pages render. Sourced from config via the router.
SubscribeLinks messages.SubscribeLinks
// OperatorLog, when set, receives durable operator events emitted in the
// command transaction. Optional: a nil writer disables the feed.
OperatorLog *operatorlog.Writer
}
CommandDeps are transaction-bound dependencies for bot commands.
type Reply ¶
type Reply struct {
ChatID int64
TGID int64
Text string
ParseMode string
Plain bool
DM bool
Buttons [][]Button
}
Reply is a post-commit Telegram message effect.
type UserCommands ¶
type UserCommands struct {
// contains filtered or unexported fields
}
UserCommands handles user and owner bot commands.
func NewCommands ¶
func NewCommands(deps CommandDeps, ownerIDs []int64) *UserCommands
NewCommands returns command handlers bound to one handleTx dependency set.
func NewUserCommands ¶
func NewUserCommands(users *store.Users, ownerIDs []int64) *UserCommands
NewUserCommands returns user command handlers bound to users.
func (*UserCommands) HandleCallback ¶
func (h *UserCommands) HandleCallback( ctx context.Context, query *models.CallbackQuery, ) (Result, error)
HandleCallback routes owner confirmation callbacks.
func (*UserCommands) HandleHere ¶
func (h *UserCommands) HandleHere(msg *models.Message) Result
HandleHere returns chat id/type for owners in non-private chats.
func (*UserCommands) HandlePrivate ¶
HandlePrivate routes a private message to supported commands.
type WhoisTarget ¶
WhoisTarget is a resolved /whois argument.
func ResolveWhoisTarget ¶
func ResolveWhoisTarget( ctx context.Context, users *store.Users, text string, ) (WhoisTarget, error)
ResolveWhoisTarget resolves a /whois argument using only local data.