tg

package
v0.0.0-...-fce5618 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tg is the embedded shared Telegram bot. It runs in the same process as the API (long polling) and handles the /bind flow: a user opens the bot via a deep link carrying a one-time code, and the bot ties that chat_id to the user's telegram channel by writing directly to the shared store — no internal network hop. It also exposes Send for the delivery engine.

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
}

func New

func New(token string, st *store.Store) (*Bot, error)

New builds the bot. The default handler processes /start and /bind.

func (*Bot) Send

func (t *Bot) Send(ctx context.Context, chatID int64, text string) error

Send delivers text to a chat id (used by the delivery engine's sender). Messages longer than Telegram's limit are split into multiple messages so long SMS are delivered in full instead of failing.

func (*Bot) Start

func (t *Bot) Start(ctx context.Context)

Start begins long polling; blocks until ctx is cancelled.

Jump to

Keyboard shortcuts

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