telegram

package
v0.0.0-...-9a938bf Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chat

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

type Client

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

func New

func New(cfg config.TelegramConfig, voicesFileDir string) (*Client, error)

func (*Client) DownloadFile

func (c *Client) DownloadFile(filePath string) error

func (*Client) FileInfo

func (c *Client) FileInfo(fileId string) (*File, error)

func (*Client) SendMessage

func (c *Client) SendMessage(chatId int, text string) error

func (*Client) Updates

func (c *Client) Updates(offset int, limit int) (updates []Update, err error)

type File

type File struct {
	FileId   string `json:"file_id"`
	FilePath string `json:"file_path,omitempty"`
}

type GetFileResponse

type GetFileResponse struct {
	Ok     bool   `json:"ok"`
	Error  string `json:"error"`
	Result File   `json:"result"`
}

type IncomingMessage

type IncomingMessage struct {
	Text  string `json:"text"`
	From  User   `json:"from"`
	Chat  Chat   `json:"chat"`
	Voice Voice  `json:"voice"`
}

type Update

type Update struct {
	Id      int              `json:"update_id"`
	Message *IncomingMessage `json:"message"`
}

type UpdatesResponse

type UpdatesResponse struct {
	Ok     bool     `json:"ok"`
	Result []Update `json:"result"`
}

type User

type User struct {
	Username string `json:"username"`
	Id       int    `json:"id"`
}

type Voice

type Voice struct {
	FileId string `json:"file_id"`
}

Jump to

Keyboard shortcuts

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