telegram

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 21 Imported by: 0

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
}

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

func (b *Bot) AnnounceToSession(sessionKey, text string)

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

func (b *Bot) CanConfirm(sessionKey string) bool

CanConfirm returns true if this bot can reach the given session key.

func (*Bot) ChannelName

func (b *Bot) ChannelName() string

ChannelName returns the channel type name.

func (*Bot) IsConnected

func (b *Bot) IsConnected() bool

IsConnected reports whether the bot is currently polling.

func (*Bot) PairedCount

func (b *Bot) PairedCount() int

PairedCount returns the number of paired users.

func (*Bot) Reconnect

func (b *Bot) Reconnect(ctx context.Context, newCfg config.TelegramConfig) error

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) SendTo

func (b *Bot) SendTo(chatID int64, text string) error

func (*Bot) SendToAllPaired

func (b *Bot) SendToAllPaired(text string)

SendToAllPaired sends a message to all paired users. Used by the system event endpoint when no specific target is given.

func (*Bot) SetSkillManager

func (b *Bot) SetSkillManager(m *skills.Manager)

SetSkillManager wires the skill manager so /status can report skill count.

func (*Bot) SetStartTime

func (b *Bot) SetStartTime(t time.Time)

SetStartTime sets the process start time for /status uptime.

func (*Bot) SetTaskManager

func (b *Bot) SetTaskManager(m *taskqueue.Manager)

SetTaskManager sets the task queue manager for /tasks and /cancel commands.

func (*Bot) SetVersion

func (b *Bot) SetVersion(v string)

SetVersion sets the binary version string for /status.

func (*Bot) Start

func (b *Bot) Start(ctx context.Context) error

Start begins long-polling (blocks until context is cancelled).

func (*Bot) Username

func (b *Bot) Username() string

Username returns the bot's Telegram username.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL