telegram

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package telegram is tomo's Telegram channel. It long-polls getUpdates, so there is no webhook to expose, and it answers approvals with inline buttons. Only allowlisted chats are served; an unknown chat is ignored, not replied to, so the bot token leaking does not hand anyone an agent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Telegram

type Telegram struct {
	Token   string
	Allow   []int64 // chat ids permitted to talk to the bot
	BaseURL string  // default https://api.telegram.org, overridable for tests
	Client  *http.Client
	// contains filtered or unexported fields
}

Telegram serves an allowlisted set of chats through the Bot API.

func (*Telegram) Caps

func (t *Telegram) Caps() channel.Caps

Caps implements channel.Channel. Text is sent whole (no live editing yet), and approvals render as inline buttons.

func (*Telegram) Name

func (t *Telegram) Name() string

Name implements channel.Channel.

func (*Telegram) Post

func (t *Telegram) Post(ctx context.Context, chat, text string) error

Post pushes a message to a chat outside a reply, for scheduled runs. It implements schedule.Poster.

func (*Telegram) Run

func (t *Telegram) Run(ctx context.Context, h channel.Handler) error

Run long-polls until ctx is cancelled.

Jump to

Keyboard shortcuts

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