telegram

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package telegram provides a Telegram bot interface for Chronos agents.

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 a Telegram bot that receives messages via long polling and routes them to an agent.

func New

func New(token string, handler MessageHandler) *Bot

New creates a new Telegram bot. token is the Telegram Bot API token from @BotFather. handler is called for each incoming message.

func (*Bot) SendInlineKeyboard

func (b *Bot) SendInlineKeyboard(ctx context.Context, chatID int64, text string, buttons [][]Button) error

SendInlineKeyboard sends a message with an inline keyboard for HITL confirmations.

func (*Bot) SendMessage

func (b *Bot) SendMessage(ctx context.Context, chatID int64, text string) error

SendMessage sends a text message to a Telegram chat.

func (*Bot) Start

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

Start begins long polling for updates.

func (*Bot) Stop

func (b *Bot) Stop()

Stop signals the bot to stop polling.

func (*Bot) WebhookHandler

func (b *Bot) WebhookHandler() http.Handler

WebhookHandler returns an http.Handler for receiving Telegram webhook updates.

type Button

type Button struct {
	Text         string `json:"text"`
	CallbackData string `json:"callback_data"`
}

Button represents an inline keyboard button.

type MessageHandler

type MessageHandler func(ctx context.Context, chatID int64, userID int64, text string) (string, error)

MessageHandler processes incoming messages and returns a response.

Jump to

Keyboard shortcuts

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