Documentation ¶
Overview ¶
Package tg implements some of the Telegram API methods
Index ¶
- type APIResponse
- type Bot
- func (b *Bot) AnswerCallbackQuery(callbackID, text string) error
- func (b *Bot) DeleteMessage(chatID, messageID int64) error
- func (b *Bot) DownloadFile(fileID string) ([]byte, error)
- func (b *Bot) EditMessageText(chatID, messageID int64, text string, keyboard ...InlineKeyboardMarkup) error
- func (b *Bot) GetFile(fileID string) (File, error)
- func (b *Bot) GetUpdates(offset int64, limit, timeout int, allowedUpdates []string) ([]Update, error)
- func (b *Bot) SendDocument(chatID int64, documentPath string) error
- func (b *Bot) SendMessage(chatID int64, message string, keyboard ...InlineKeyboardMarkup) (Message, error)
- type CallbackQuery
- type Chat
- type Document
- type File
- type InlineKeyboardButton
- type InlineKeyboardMarkup
- type Message
- type PhotoSize
- type Update
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
type APIResponse struct { Ok bool `json:"ok"` ErrorCode int `json:"error_code"` Description string `json:"description"` Result interface{} `json:"result"` }
APIResponse is a response to a request to the Telegram API.
type Bot ¶
type Bot struct {
Token string
}
Bot is an instance of a Telegram bot.
func (*Bot) AnswerCallbackQuery ¶
AnswerCallbackQuery implements Telegram's answerCallbackQuery method.
func (*Bot) DeleteMessage ¶
DeleteMessage implements Telegram's deleteMessage method.
func (*Bot) DownloadFile ¶
DownloadFile downloads file from the Telegram server.
func (*Bot) EditMessageText ¶
func (b *Bot) EditMessageText(chatID, messageID int64, text string, keyboard ...InlineKeyboardMarkup) error
EditMessageText implements Telegram's editMessageText method.
func (*Bot) GetUpdates ¶
func (b *Bot) GetUpdates(offset int64, limit, timeout int, allowedUpdates []string) ([]Update, error)
GetUpdates implements Telegram's getUpdates method.
func (*Bot) SendDocument ¶
SendDocument implements Telegram's sendDocument method.
func (*Bot) SendMessage ¶
func (b *Bot) SendMessage(chatID int64, message string, keyboard ...InlineKeyboardMarkup) (Message, error)
SendMessage implements Telegram's sendMessage method.
type CallbackQuery ¶
type CallbackQuery struct { ID string `json:"id"` From User `json:"from"` Message Message `json:"message"` Data string `json:"data"` }
CallbackQuery object represents an incoming callback query from a callback button in an inline keyboard.
type Document ¶
type Document struct { FileID string `json:"file_id"` UniqueID string `json:"file_unique_id"` FileName string `json:"file_name"` MimeType string `json:"mime_type"` FileSize int `json:"file_size"` }
Document object represents a general file (as opposed to photos, voice messages and audio files).
type File ¶
type File struct { FileID string `json:"file_id"` FileUniqueID string `json:"file_unique_id"` FileSize int `json:"file_size"` FilePath string `json:"file_path"` }
File object represents a file ready to be downloaded.
type InlineKeyboardButton ¶
type InlineKeyboardButton struct { Text string `json:"text"` CallbackData string `json:"callback_data"` }
InlineKeyboardButton object represents one button of an inline keyboard.
type InlineKeyboardMarkup ¶
type InlineKeyboardMarkup struct {
InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
}
InlineKeyboardMarkup object represents an inline keyboard that appears right next to the message it belongs to.
type Message ¶
type Message struct { MessageID int64 `json:"message_id"` From User `json:"from"` Chat Chat `json:"chat"` Date int64 `json:"date"` Text string `json:"text"` Photo []PhotoSize `json:"photo"` Document Document `json:"document"` }
Message object represents a message.
type PhotoSize ¶
type PhotoSize struct { FileID string `json:"file_id"` FileUniqueID string `json:"file_unique_id"` Width int `json:"width"` Height int `json:"height"` FileSize int `json:"file_size"` }
PhotoSize object represents one size of a photo or a file / sticker thumbnail.
type Update ¶
type Update struct { UpdateID int64 `json:"update_id"` Message Message `json:"message"` CallbackQuery CallbackQuery `json:"callback_query"` }
Update object represents an incoming update.