tg

package
v0.0.0-...-ee03bf6 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2015 License: BSD-3-Clause Imports: 8 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
}

type Client

type Client struct {
	Name  string
	Token string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(name, token string) *Client

func (*Client) GetUpdates

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

func (*Client) SendDocument

func (c *Client) SendDocument(chatID int, doc File) (Response, error)

func (*Client) SendKbd

func (c *Client) SendKbd(chatID, replyID int, text string, kbd ReplyKeyboardMarkup) (Response, error)

func (*Client) SendMessage

func (c *Client) SendMessage(params SendMessageParams) (Response, error)

func (*Client) SendPhoto

func (c *Client) SendPhoto(chatID int, photo File) (Response, error)

func (*Client) SendText

func (c *Client) SendText(chatID int, text string) (Response, error)

func (*Client) SendTextReply

func (c *Client) SendTextReply(chatID, replyID int, text string) (Response, error)

type Document

type Document struct {
	FileID   string    `json:"file_id"`
	Thumb    PhotoSize `json:"thumb"`
	FileName string    `json:"file_name"`
	MimeType string    `json:"mime_type"`
	FileSize int       `json:"file_size"`
}

type File

type File struct {
	Name string
	Data []byte
}

type ForceReply

type ForceReply struct {
	ForceReply bool `json:"force_reply"` // Always true
	Selective  bool `json:"selective"`
}

type Message

type Message struct {
	ID       int         `json:"message_id"`
	From     User        `json:"from"`
	Date     int         `json:"date"`
	Chat     Chat        `json:"chat"`
	Text     string      `json:"text"`
	Photo    []PhotoSize `json:"photo"`
	Document Document    `json:"document"`
}

type PhotoSize

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

type ReplyKeyboardHide

type ReplyKeyboardHide struct {
	HideKeyboard bool `json:"hide_keyboard"` // Always true
	Selective    bool `json:"selective"`
}

type ReplyKeyboardMarkup

type ReplyKeyboardMarkup struct {
	Keyboard  [][]string `json:"keyboard"`
	Resize    bool       `json:"resize_keyboard"`
	OneTime   bool       `json:"one_time_keyboard"`
	Selective bool       `json:"selective"`
}

type Response

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

type SendMessageParams

type SendMessageParams struct {
	ChatID      int         `json:"chat_id"`
	Text        string      `json:"text"`
	Preview     bool        `json:"disable_web_page_preview"`
	ReplyID     int         `json:"reply_to_message_id"`
	ReplyMarkup interface{} `json:"reply_markup"`
}

type Update

type Update struct {
	UpdateID int     `json:"update_id"`
	Message  Message `json:"message"`
}

type UpdateResponse

type UpdateResponse struct {
	Ok      bool     `json:"ok"`
	Updates []Update `json:"result"`
}

type User

type User struct {
	ID        int    `json:"id"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Username  string `json:"username"`
}

Jump to

Keyboard shortcuts

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