Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
func NewBot ¶
func NewBot(token string, chatID int64, manager *engine.Manager, control *controlapi.Client) (*Bot, error)
NewBot creates a Telegram bot. manager powers read-only queries (/status, /rules, /detail). control is the control API client used for write actions (/reload, /stop, /start_rule, /toggle); when nil or without a token the bot runs in read-only mode and write commands report that control is disabled.
type Manager ¶ added in v0.3.0
type Manager struct {
// contains filtered or unexported fields
}
Manager implements controlapi.BotController, owning the Telegram bot goroutine lifecycle so the bot can be reconfigured at runtime without restarting the daemon.
func NewManager ¶ added in v0.3.0
func NewManager(manager *engine.Manager, controlFn func(string) *controlapi.Client, logger *slog.Logger) *Manager
NewManager creates a bot lifecycle manager. controlFn builds a control API client for a given control token (used by the bot for write actions); it may return nil when no token is configured, in which case the bot runs read-only.
func (*Manager) Apply ¶ added in v0.3.0
func (m *Manager) Apply(settings controlapi.BotSettings) error
Apply stops any running bot and starts a new one with settings. With an empty token or chat ID the bot is stopped and not restarted.