telegram

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package telegram implements the gateway.Adapter for Telegram Bot API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter implements gateway.Adapter for Telegram.

func New

func New(token, mode string) *Adapter

New creates a new Telegram adapter with the default name "telegram".

func NewNamed added in v0.2.0

func NewNamed(name, token, mode string) *Adapter

NewNamed creates a Telegram adapter with a custom name (e.g. "telegram:trade_research"). This allows registering multiple Telegram bots in the same gateway manager.

func (*Adapter) AddChat

func (a *Adapter) AddChat(chatID int64, name string)

AddChat manually registers a chat ID → name mapping. Used when the bot hasn't received any messages yet but we know about the group.

func (*Adapter) Channels

func (a *Adapter) Channels(_ context.Context) ([]gateway.ExternalChannel, error)

func (*Adapter) DiscoverViaUpdate

func (a *Adapter) DiscoverViaUpdate() error

DiscoverViaUpdate processes a single getUpdates call to discover groups the bot has been added to. Called before Start to populate initial channels.

func (*Adapter) Health

func (a *Adapter) Health(_ context.Context) error

func (*Adapter) Name

func (a *Adapter) Name() string

func (*Adapter) Send

func (a *Adapter) Send(_ context.Context, channelID, sender, content string) error

func (*Adapter) Start

func (a *Adapter) Start(ctx context.Context, onMessage func(gateway.InboundMessage)) error

func (*Adapter) Status

func (a *Adapter) Status() gateway.AdapterStatus

Status returns the current connection state.

func (*Adapter) Stop

func (a *Adapter) Stop(_ context.Context) error

Jump to

Keyboard shortcuts

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