telegram

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2022 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeMarkdown

func EscapeMarkdown(msg string) string

Types

type Author

type Author struct {
	ID        int64  `json:"id"`
	IsBot     bool   `json:"is_bot"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Username  string `json:"username"`
}

type Chat

type Chat struct {
	ID    int64  `json:"id"`
	Title string `json:"title"`
	Type  string `json:"type"`
}

type Client

type Client struct {
	Token       string
	Offset      int64
	PollTimeout int64
}

func (*Client) EditMessageText

func (c *Client) EditMessageText(chatId, messageId, text string, options ...url.Values) (ret *SendMessageResponse, err error)

func (*Client) Get

func (c *Client) Get(url string) ([]byte, error)

func (*Client) GetUpdates

func (c *Client) GetUpdates() (Response, error)

func (*Client) Post

func (c *Client) Post(url string, data url.Values) ([]byte, error)

func (*Client) SendMarkdownMessage

func (c *Client) SendMarkdownMessage(chatId, body string) (*SendMessageResponse, error)

func (*Client) SendMessage

func (c *Client) SendMessage(chatId, text string, options ...url.Values) (ret *SendMessageResponse, err error)

type File

type File struct {
	FileID       string `json:"file_id"`
	FileUniqueId string `json:"file_unique_id"`
	FileSize     int64  `json:"file_size"`
	Width        int    `json:"width"`
	Height       int    `json:"height"`
}

type Message

type Message struct {
	MessageID           int64    `json:"message_id"`
	From                Author   `json:"from"`
	Text                string   `json:"text"`
	Caption             *string  `json:"caption"`
	Chat                *Chat    `json:"chat"`
	Sticker             *Sticker `json:"sticker"`
	Photo               []File   `json:"photo"`
	Document            *File    `json:"document"`
	NewChatTitle        *string  `json:"new_chat_title"`
	LeftChatParticipant *Author  `json:"left_chat_participant"`
	NewChatParticipant  *Author  `json:"new_chat_participant"`
	ReplyToMessage      *Message `json:"reply_to_message"`
}

type Poll

type Poll struct {
	ID       string       `json:"id"`
	Question string       `json:"question"`
	Options  []PollOption `json:"options"`
	IsClosed bool         `json:"is_closed"`
}

type PollOption

type PollOption struct {
	Text       string `json:"text"`
	VoterCount int    `json:"voter_count"`
}

type Response

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

type SendMessageResponse

type SendMessageResponse struct {
	Ok     bool    `json:"ok"`
	Result Message `json:"result"`
}

type Sticker

type Sticker struct {
	Width        int    `json:"width"`
	Height       int    `json:"height"`
	SetName      string `json:"set_name"`
	IsAnimated   bool   `json:"is_animated"`
	FileId       string `json:"file_id"`
	FileUniqueId string `json:"file_unique_id"`
	FileSize     int64  `json:"file_size"`
}

type Update

type Update struct {
	UpdateID      int64    `json:"update_id"`
	Message       *Message `json:"message"`
	EditedMessage *Message `json:"edited_message"`
}

Jump to

Keyboard shortcuts

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