telegram

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 20 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 wraps a Telegram bot with agent pool integration. It implements channel.Channel.

func New

func New(cfg Config, pool *agent.Pool, listFn channel.ModelListFunc, switchFn channel.ModelSwitchFunc) (*Bot, error)

New creates a Telegram bot and registers handlers. Call Start to begin polling.

func (*Bot) Name

func (b *Bot) Name() string

Name returns the channel name. Implements channel.Channel.

func (*Bot) Notify

func (b *Bot) Notify(_ context.Context, n channel.Notification) error

Notify sends a message to the specified chat. Implements channel.Channel.

func (*Bot) Start

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

Start begins long polling. It blocks until ctx is cancelled.

func (*Bot) Stop

func (b *Bot) Stop()

Stop gracefully shuts down the Telegram bot. Implements channel.Channel.

type Config

type Config struct {
	Token      string  // bot token
	NotifyChat string  // default chat ID for proactive notifications
	ChannelID  string  // broadcast channel ID or @username
	GroupMode  string  // "mention" | "always" | "disabled"
	AllowedIDs []int64 // user IDs allowed to use the bot (empty = allow all)
}

Config holds Telegram bot settings.

Jump to

Keyboard shortcuts

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