telegram

package
v0.54.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 15 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chat

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

type Client

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

Client talks only to Telegram's fixed Bot API host. Endpoints and credentials never appear in returned errors.

func New

func New(token string) (*Client, error)

func (*Client) Download

func (c *Client) Download(
	ctx context.Context, fileID string, maxBytes int64,
) ([]byte, error)

func (*Client) GetFile

func (c *Client) GetFile(ctx context.Context, fileID string) (File, error)

func (*Client) GetUpdates

func (c *Client) GetUpdates(
	ctx context.Context, offset int64, timeoutSeconds int,
) ([]Update, error)

func (*Client) SendDocument

func (c *Client) SendDocument(
	ctx context.Context, chatID int64, name string, data []byte,
) (Message, error)

func (*Client) SendMessage

func (c *Client) SendMessage(
	ctx context.Context, chatID int64, text string,
) (Message, error)

func (*Client) SendPhoto

func (c *Client) SendPhoto(
	ctx context.Context, chatID int64, name string, data []byte,
) (Message, error)

type Document

type Document struct {
	FileID   string `json:"file_id"`
	FileName string `json:"file_name,omitempty"`
	MimeType string `json:"mime_type,omitempty"`
	FileSize int64  `json:"file_size,omitempty"`
}

type File

type File struct {
	FileID   string `json:"file_id"`
	FileSize int64  `json:"file_size,omitempty"`
	FilePath string `json:"file_path"`
}

type Message

type Message struct {
	ID             int64       `json:"message_id"`
	Chat           Chat        `json:"chat"`
	From           *User       `json:"from,omitempty"`
	Text           string      `json:"text,omitempty"`
	Caption        string      `json:"caption,omitempty"`
	ReplyToMessage *Message    `json:"reply_to_message,omitempty"`
	Document       *Document   `json:"document,omitempty"`
	Photo          []PhotoSize `json:"photo,omitempty"`
	Voice          *Voice      `json:"voice,omitempty"`
}

type PhotoSize

type PhotoSize struct {
	FileID   string `json:"file_id"`
	Width    int    `json:"width"`
	Height   int    `json:"height"`
	FileSize int64  `json:"file_size,omitempty"`
}

type Update

type Update struct {
	ID      int64    `json:"update_id"`
	Message *Message `json:"message,omitempty"`
}

type User

type User struct {
	ID    int64 `json:"id"`
	IsBot bool  `json:"is_bot,omitempty"`
}

type Voice

type Voice struct {
	FileID   string `json:"file_id"`
	MimeType string `json:"mime_type,omitempty"`
	FileSize int64  `json:"file_size,omitempty"`
	Duration int    `json:"duration"`
}

Jump to

Keyboard shortcuts

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