telegram

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackQuery

type CallbackQuery struct {
	ID      string          `json:"id"`
	Message TelegramMessage `json:"message"`
	Data    string          `json:"data"`
}

type Chat

type Chat struct {
	ID int64 `json:"id"`
}

type Config

type Config struct {
	Endpoint string `yaml:"endpoint" description:"Telegram callback endpoint"`
	Port     int    `yaml:"port" description:"Telegram callback port"`
	BotToken string `yaml:"bot_token" description:"Telegram bot token"`
	ChatID   int64  `yaml:"chat_id" description:"Default target chat ID"`
}

type InlineKeyboardButton

type InlineKeyboardButton struct {
	Text         string `json:"text"`
	CallbackData string `json:"callback_data,omitempty"`
}

type InlineKeyboardMarkup

type InlineKeyboardMarkup struct {
	InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
}

type Message

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

func (*Message) Send

func (m *Message) Send() error

func (*Message) ToChat

func (m *Message) ToChat(chatID int64) *Message

func (*Message) Type

func (m *Message) Type(typ ParseMode) *Message

func (*Message) WithButton

func (m *Message) WithButton(text string, fn UserCallback) *Message

type MessageEntity

type MessageEntity struct {
	Type          string `json:"type"`
	Offset        int    `json:"offset"`
	Length        int    `json:"length"`
	URL           string `json:"url,omitempty"`
	Language      string `json:"language,omitempty"`
	CustomEmojiID string `json:"custom_emoji_id,omitempty"`
}

type ParseMode

type ParseMode string
const (
	Plaintext ParseMode = ""
	HTML      ParseMode = "HTML"
	Markdown  ParseMode = "MarkdownV2"
)

type Telegram

type Telegram interface {
	Message(message string) *Message
	Run(ctx context.Context) error
}

func New

func New(cfg Config, logger log.MetaLogger) Telegram

type TelegramMessage

type TelegramMessage struct {
	MessageID int              `json:"message_id"`
	Text      string           `json:"text"`
	Chat      Chat             `json:"chat"`
	Entities  *[]MessageEntity `json:"entities"`
}

type Update

type Update struct {
	Message       *TelegramMessage `json:"message,omitempty"`
	CallbackQuery *CallbackQuery   `json:"callback_query,omitempty"`
}

type UserCallback

type UserCallback func() (string, bool)

Jump to

Keyboard shortcuts

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