telegram

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package telegram delivers the same alerts as Web Push to a Telegram chat — useful for a channel that outlives any one phone. The flow is deliberately tiny: the user makes a bot with BotFather, pastes the token, and sends the bot a message; cuxdeck catches the chat id from getUpdates and remembers it. From then on every event is a sendMessage. Token + chat id live under ~/.cuxdeck.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store holds the bot token and resolved chat id.

func Open

func Open(dir string) *Store

func (*Store) Connected

func (s *Store) Connected() bool

Connected reports whether both a token and a chat id are known.

func (*Store) Disconnect

func (s *Store) Disconnect()

Disconnect forgets the token and chat id.

func (*Store) Has

func (s *Store) Has() bool

Has satisfies notify.Notifier — true only when fully linked.

func (*Store) Notify

func (s *Store) Notify(ev notify.Event)

Notify sends an event as a Telegram message (best-effort).

func (*Store) Poll

func (s *Store) Poll(ctx context.Context) (bool, error)

Poll drains getUpdates once, capturing the chat id from the first message the user sends the bot. Returns true once linked. The panel calls this a few times after the user taps "/start".

func (*Store) SetToken

func (s *Store) SetToken(ctx context.Context, token string) error

SetToken saves a bot token (validated by a getMe call) and clears any stale chat id so the next /start re-links.

func (*Store) Status

func (s *Store) Status() map[string]any

Status is the panel-facing view of the connection.

Jump to

Keyboard shortcuts

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