Documentation
¶
Index ¶
- type Bot
- func (b *Bot) AnnounceToSession(sessionKey, text string)
- func (b *Bot) CanConfirm(sessionKey string) bool
- func (b *Bot) ChannelName() string
- func (b *Bot) IsConnected() bool
- func (b *Bot) PairedCount() int
- func (b *Bot) Reconnect(ctx context.Context, newCfg config.TelegramConfig) error
- func (b *Bot) SendConfirmPrompt(ctx context.Context, sessionKey, command, pattern string) (bool, error)
- func (b *Bot) SendTo(chatID int64, text string) error
- func (b *Bot) SendToAllPaired(text string)
- func (b *Bot) SetSkillManager(m *skills.Manager)
- func (b *Bot) SetStartTime(t time.Time)
- func (b *Bot) SetTaskManager(m *taskqueue.Manager)
- func (b *Bot) SetVersion(v string)
- func (b *Bot) Start(ctx context.Context) error
- func (b *Bot) Username() string
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
}
Bot is the Telegram channel handler.
func New ¶
func New(logger *zap.SugaredLogger, cfg config.TelegramConfig, msgCfg config.Messages, fullCfg *config.Root, ag agent.PrimaryAgent, sm *session.Manager, cronMgr *cron.Manager) (*Bot, error)
New creates and starts a Telegram bot.
func (*Bot) AnnounceToSession ¶
SendTo sends a message to a specific Telegram chat by ID. Used by the system event endpoint to deliver agent responses. AnnounceToSession sends a message to the chat associated with a session key. Session keys have the format "<agentID>:telegram:<chatID>" (user scope), "<agentID>:telegram:channel:<chatID>" (channel scope), or "<agentID>:telegram:global" (global scope — not deliverable).
func (*Bot) CanConfirm ¶
CanConfirm returns true if this bot can reach the given session key.
func (*Bot) ChannelName ¶
ChannelName returns the channel type name.
func (*Bot) IsConnected ¶
IsConnected reports whether the bot is currently polling.
func (*Bot) PairedCount ¶
PairedCount returns the number of paired users.
func (*Bot) Reconnect ¶
Reconnect stops the current bot and starts a new one with the updated token.
func (*Bot) SendConfirmPrompt ¶
func (b *Bot) SendConfirmPrompt(ctx context.Context, sessionKey, command, pattern string) (bool, error)
SendConfirmPrompt sends an inline-button confirmation prompt to the chat associated with the session key and blocks until the user responds or the context expires.
func (*Bot) SendToAllPaired ¶
SendToAllPaired sends a message to all paired users. Used by the system event endpoint when no specific target is given.
func (*Bot) SetSkillManager ¶
SetSkillManager wires the skill manager so /status can report skill count.
func (*Bot) SetStartTime ¶
SetStartTime sets the process start time for /status uptime.
func (*Bot) SetTaskManager ¶
SetTaskManager sets the task queue manager for /tasks and /cancel commands.
func (*Bot) SetVersion ¶
SetVersion sets the binary version string for /status.