tgo

package module
v0.0.0-...-7b8c3c4 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2017 License: MIT Imports: 13 Imported by: 0

README

Telegram bot API Client written in Golang

Travis GoDoc

GetUpdatesChan example

package main

import "gopkg.in/devalecs/tgo.v1"

func main() {
	c := tgo.NewClient("yourTelegramBotAPIToken")

	updatesChan := c.GetUpdatesChan(tgo.GetUpdatesParams{
		Timeout: 60,
	})

	for update := range updatesChan {
		if update.Message == nil {
			continue
		}

		c.SendMessage(tgo.SendMessageParams{
			ChatID: update.Message.Chat.ID,
			Text:   "Pong",
		})
	}
}

Documentation

Index

Constants

View Source
const (
	TelegramAPIEndpoint = "https://api.telegram.org"

	// https://core.telegram.org/bots/api#chatmember
	ChatMemberStatusCreator       = "creator"
	ChatMemberStatusAdministrator = "administrator"
	ChatMemberStatusMember        = "member"
	ChatMemberStatusLeft          = "left"
	ChatMemberStatusKicked        = "kicked"

	// https://core.telegram.org/bots/api#markdown-style
	ParseModeMarkdown = "Markdown"
	// https://core.telegram.org/bots/api#html-style
	ParseModeHTML = "HTML"

	// https://core.telegram.org/bots/api#inlinequeryresult
	InlineQueryResultTypeArticle  = "article"
	InlineQueryResultTypePhoto    = "photo"
	InlineQueryResultTypeGif      = "gif"
	InlineQueryResultTypeMpeg4Gif = "mpeg4_gif"
	InlineQueryResultTypeVideo    = "video"
	InlineQueryResultTypeAudio    = "audio"
	InlineQueryResultTypeVoice    = "voice"
	InlineQueryResultTypeDocument = "document"
	InlineQueryResultTypeLocation = "location"
	InlineQueryResultTypeVenue    = "venue"
	InlineQueryResultTypeContact  = "contact"
	InlineQueryResultTypeGame     = "game"
	InlineQueryResultTypeSticker  = "sticker"

	MimeTypeTextHTML       = "text/html"
	MimeTypeVideoMP4       = "video/mp4"
	MimeTypeApplicationPDF = "application/pdf"
	MimeTypeApplicationZIP = "application/zip"
	MimeTypeAudioMPEG      = "audio/mpeg"
	MimeTypeAudioOgg       = "audio/ogg"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Animation

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

https://core.telegram.org/bots/api#animation

type AnswerCallbackQueryParams

type AnswerCallbackQueryParams struct {
	ID        string `json:"callback_query_id"`
	Text      string `json:"text,omitempty"`
	ShowAlert bool   `json:"show_alert,omitempty"`
	URL       string `json:"url,omitempty"`
	CacheTime uint   `json:"cache_time,omitempty"`
}

https://core.telegram.org/bots/api#answercallbackquery

type AnswerInlineQueryParams

type AnswerInlineQueryParams struct {
	InlineQueryID     string              `json:"inline_query_id"`
	Results           []InlineQueryResult `json:"results"`
	CacheTime         uint                `json:"cache_time,omitempty"`
	IsPersonal        bool                `json:"is_personal,omitempty"`
	NextOffset        string              `json:"next_offset,omitempty"`
	SwitchPmText      string              `json:"switch_pm_text,omitempty"`
	SwitchPmParameter string              `json:"switch_pm_parameter,omitempty"`
}

https://core.telegram.org/bots/api#inlinequery

type Audio

type Audio struct {
	FileID    string `json:"file_id"`
	Duration  int    `json:"duration"`
	Performer string `json:"performer,omitempty"`
	Title     string `json:"title,omitempty"`
	MimeType  string `json:"mime_type,omitempty"`
	FileSize  int    `json:"file_size,omitempty"`
}

https://core.telegram.org/bots/api#audio

type CallbackQuery

type CallbackQuery struct {
	ID              string   `json:"id"`
	From            *User    `json:"from"`
	Message         *Message `json:"message,omitempty"`
	InlineMessageID string   `json:"inline_message_id,omitempty"`
	ChatInstance    string   `json:"chat_instance,omitempty"`
	Data            string   `json:"data,omitempty"`
	GameShortName   string   `json:"game_short_name,omitempty"`
}

https://core.telegram.org/bots/api#callbackquery

type Chat

type Chat struct {
	ID                          int    `json:"id"`
	Type                        string `json:"type"`
	Title                       string `json:"title,omitempty"`
	Username                    string `json:"username,omitempty"`
	FirstName                   string `json:"first_name,omitempty"`
	LastName                    string `json:"last_name,omitempty"`
	AllMembersAreAdministrators bool   `json:"all_members_are_administrators,omitempty"`
}

https://core.telegram.org/bots/api#chat

type ChatMember

type ChatMember struct {
	User   *User  `json:"user"`
	Status string `json:"status"`
}

https://core.telegram.org/bots/api#chatmember

type ChosenInlineResult

type ChosenInlineResult struct {
	ResultID        string    `json:"result_id"`
	From            *User     `json:"from"`
	Location        *Location `json:"location,omitempty"`
	InlineMessageID string    `json:"inline_message_id,omitempty"`
	Query           string    `json:"query"`
}

https://core.telegram.org/bots/api#choseninlineresult

type Client

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

func NewClient

func NewClient(token string) *Client

func (*Client) AnswerCallbackQuery

func (c *Client) AnswerCallbackQuery(params AnswerCallbackQueryParams) (*bool, error)

func (*Client) AnswerInlineQuery

func (c *Client) AnswerInlineQuery(params AnswerInlineQueryParams) (*bool, error)

func (*Client) ForwardMessage

func (c *Client) ForwardMessage(params ForwardMessageParams) (*Message, error)

func (*Client) GetChat

func (c *Client) GetChat(params GetChatParams) (*Chat, error)

func (*Client) GetChatAdministrators

func (c *Client) GetChatAdministrators(params GetChatParams) (*[]ChatMember, error)

func (*Client) GetChatMember

func (c *Client) GetChatMember(params GetChatMemberParams) (*ChatMember, error)

func (*Client) GetChatMembersCount

func (c *Client) GetChatMembersCount(params GetChatMembersCountParams) (*uint, error)

func (*Client) GetMe

func (c *Client) GetMe() (*User, error)

func (*Client) GetUpdates

func (c *Client) GetUpdates(params GetUpdatesParams) (*[]Update, error)

func (*Client) GetUpdatesChan

func (c *Client) GetUpdatesChan(params GetUpdatesParams) chan *Update

func (*Client) GetUserProfilePhotos

func (c *Client) GetUserProfilePhotos(params GetUserProfilePhotosParams) (*UserProfilePhotos, error)

func (*Client) KickChatMember

func (c *Client) KickChatMember(params KickChatMemberParams) (*bool, error)

func (*Client) LeaveChat

func (c *Client) LeaveChat(params LeaveChatParams) (*bool, error)

func (*Client) SendAudio

func (c *Client) SendAudio(params SendAudioParams) (*Message, error)

func (*Client) SendChatAction

func (c *Client) SendChatAction(params SendChatActionParams) (*bool, error)

func (*Client) SendContact

func (c *Client) SendContact(params SendContactParams) (*Message, error)

func (*Client) SendDocument

func (c *Client) SendDocument(params SendDocumentParams) (*Message, error)

func (*Client) SendLocation

func (c *Client) SendLocation(params SendLocationParams) (*Message, error)

func (*Client) SendMessage

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

func (*Client) SendPhoto

func (c *Client) SendPhoto(params SendPhotoParams) (*Message, error)

func (*Client) SendSticker

func (c *Client) SendSticker(params SendStickerParams) (*Message, error)

func (*Client) SendVenue

func (c *Client) SendVenue(params SendVenueParams) (*Message, error)

func (*Client) SendVideo

func (c *Client) SendVideo(params SendVideoParams) (*Message, error)

func (*Client) SendVoice

func (c *Client) SendVoice(params SendVoiceParams) (*Message, error)

func (*Client) UnbanChatMember

func (c *Client) UnbanChatMember(params UnbanChatMemberParams) (*bool, error)

type Contact

type Contact struct {
	PhoneNumber string `json:"phone_number"`
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name,omitempty"`
	UserID      int    `json:"user_id,omitempty"`
}

https://core.telegram.org/bots/api#contact

type Document

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

https://core.telegram.org/bots/api#document

type File

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

https://core.telegram.org/bots/api#file

type ForceReply

type ForceReply struct {
	ForceReply bool `json:"force_reply"`
	Selective  bool `json:"selective,omitempty"`
}

https://core.telegram.org/bots/api#forcereply

type ForwardMessageParams

type ForwardMessageParams struct {
	ChatID              interface{} `json:"chat_id"`
	FromChatID          interface{} `json:"from_chat_id"`
	DisableNotification bool        `json:"disable_notification,omitempty"`
	MessageID           int         `json:"message_id"`
}

https://core.telegram.org/bots/api#forwardmessage

type Game

type Game struct {
	Title        string           `json:"title"`
	Description  string           `json:"description"`
	Photo        *[]PhotoSize     `json:"photo"`
	Text         string           `json:"text,omitempty"`
	TextEntities *[]MessageEntity `json:"text_entities,omitempty"`
	Animation    *Animation       `json:"migrate_to_chat_id,omitempty"`
}

https://core.telegram.org/bots/api#game

type GameHighScore

type GameHighScore struct {
	Position int   `json:"position"`
	User     *User `json:"user"`
	Score    int   `json:"score"`
}

https://core.telegram.org/bots/api#gamehighscore

type GetChatAdministratorsParams

type GetChatAdministratorsParams struct {
	ChatID interface{} `json:"chat_id"`
}

https://core.telegram.org/bots/api#getchatadministrators

type GetChatMemberParams

type GetChatMemberParams struct {
	ChatID interface{} `json:"chat_id"`
	UserID int         `json:"user_id"`
}

https://core.telegram.org/bots/api#getchatmember

type GetChatMembersCountParams

type GetChatMembersCountParams struct {
	ChatID interface{} `json:"chat_id"`
}

https://core.telegram.org/bots/api#getchatmemberscount

type GetChatParams

type GetChatParams struct {
	ChatID interface{} `json:"chat_id"`
}

https://core.telegram.org/bots/api#getchat

type GetUpdatesParams

type GetUpdatesParams struct {
	Offset         int      `json:"offset,omitempty"`
	Limit          uint     `json:"limit,omitempty"`
	Timeout        int      `json:"timeout,omitempty"`
	AllowedUpdates []string `json:"allowed_updates,omitempty"`
}

GetUpdatesParams https://core.telegram.org/bots/api#getupdates

type GetUserProfilePhotosParams

type GetUserProfilePhotosParams struct {
	UserID int  `json:"user_id"`
	Offset int  `json:"offset,omitempty"`
	Limit  uint `json:"limit,omitempty"`
}

https://core.telegram.org/bots/api#getuserprofilephotos

type InlineKeyboardButton

type InlineKeyboardButton struct {
	Text                         string        `json:"text"`
	URL                          string        `json:"url,omitempty"`
	Callbackdata                 string        `json:"callback_data,omitempty"`
	SwitchInlinequery            string        `json:"switch_inline_query,omitempty"`
	SwitchInlineQueryCurrentChat string        `json:"switch_inline_query_current_chat,omitempty"`
	CallbackGame                 *CallbackGame `json:"callback_game,omitempty"`
}

https://core.telegram.org/bots/api#inlinekeyboardbutton

type InlineKeyboardMarkup

type InlineKeyboardMarkup struct {
	InlineKeyboard *[][]InlineKeyboardButton `json:"inline_keyboardt"`
}

https://core.telegram.org/bots/api#inlinekeyboardmarkup

type InlineQuery

type InlineQuery struct {
	ID       string    `json:"id"`
	From     *User     `json:"from"`
	Location *Location `json:"location,omitempty"`
	Query    string    `json:"query"`
	Offset   string    `json:"offset"`
}

https://core.telegram.org/bots/api#inlinequery

type InlineQueryResultArticle

type InlineQueryResultArticle struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	Title               string                `json:"title"`
	InputMessageContent InputMessageContent   `json:"input_message_content"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	URL                 string                `json:"url,omitempty"`
	HideURL             bool                  `json:"hide_url,omitempty"`
	Description         string                `json:"description,omitempty"`
	ThumbURL            string                `json:"thumb_url,omitempty"`
	ThumbWidth          int                   `json:"thumb_width,omitempty"`
	ThumbHeight         int                   `json:"thumb_height,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultarticle

type InlineQueryResultAudio

type InlineQueryResultAudio struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	AudioURL            string                `json:"audio_url"`
	Title               string                `json:"title"`
	Caption             string                `json:"caption,omitempty"`
	Performer           string                `json:"performer,omitempty"`
	AudioDuration       int                   `json:"audio_duration,omitempty"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	InputMessageContent *InputMessageContent  `json:"input_message_content,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultaudio

type InlineQueryResultCachedAudio

type InlineQueryResultCachedAudio struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	AudioFileID         string                `json:"audio_file_id"`
	Caption             string                `json:"caption,omitempty"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	InputMessageContent *InputMessageContent  `json:"input_message_content,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultcachedaudio

type InlineQueryResultCachedDocument

type InlineQueryResultCachedDocument struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	Title               string                `json:"title"`
	DocumentFileID      string                `json:"document_file_id"`
	Description         string                `json:"description,omitempty"`
	Caption             string                `json:"caption,omitempty"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	InputMessageContent *InputMessageContent  `json:"input_message_content,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultcacheddocument

type InlineQueryResultCachedGif

type InlineQueryResultCachedGif struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	GifFileID           string                `json:"gif_file_id"`
	Title               string                `json:"title,omitempty"`
	Caption             string                `json:"caption,omitempty"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	InputMessageContent *InputMessageContent  `json:"input_message_content,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultcachedgif

type InlineQueryResultCachedMpeg4Gif

type InlineQueryResultCachedMpeg4Gif struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	Mpeg4FileID         string                `json:"mpeg4_file_id"`
	Title               string                `json:"title,omitempty"`
	Caption             string                `json:"caption,omitempty"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	InputMessageContent *InputMessageContent  `json:"input_message_content,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultcachedmpeg4gif

type InlineQueryResultCachedPhoto

type InlineQueryResultCachedPhoto struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	PhotoFileID         string                `json:"photo_file_id"`
	Title               string                `json:"title,omitempty"`
	Description         string                `json:"description,omitempty"`
	Caption             string                `json:"caption,omitempty"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	InputMessageContent *InputMessageContent  `json:"input_message_content,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultcachedphoto

type InlineQueryResultCachedSticker

type InlineQueryResultCachedSticker struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	StickerFileID       string                `json:"sticker_file_id"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	InputMessageContent *InputMessageContent  `json:"input_message_content,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultcachedsticker

type InlineQueryResultCachedVideo

type InlineQueryResultCachedVideo struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	VideoFileID         string                `json:"video_file_id"`
	Title               string                `json:"title"`
	Description         string                `json:"description,omitempty"`
	Caption             string                `json:"caption,omitempty"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	InputMessageContent *InputMessageContent  `json:"input_message_content,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultcachedvideo

type InlineQueryResultCachedVoice

type InlineQueryResultCachedVoice struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	VoiceFileID         string                `json:"voice_file_id"`
	Title               string                `json:"title"`
	Caption             string                `json:"caption,omitempty"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	InputMessageContent *InputMessageContent  `json:"input_message_content,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultcachedvoice

type InlineQueryResultContact

type InlineQueryResultContact struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	PhoneNumber         string                `json:"phone_number"`
	FirstName           string                `json:"first_name"`
	LastName            string                `json:"last_name,omitempty"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	InputMessageContent *InputMessageContent  `json:"input_message_content,omitempty"`
	ThumbURL            string                `json:"thumb_url,omitempty"`
	ThumbWidth          int                   `json:"thumb_width,omitempty"`
	ThumbHeight         int                   `json:"thumb_height,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultcontact

type InlineQueryResultDocument

type InlineQueryResultDocument struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	Title               string                `json:"title"`
	Caption             string                `json:"caption,omitempty"`
	DocumentURL         string                `json:"document_url"`
	MimeType            string                `json:"mime_type"`
	Description         string                `json:"description,omitempty"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	InputMessageContent *InputMessageContent  `json:"input_message_content,omitempty"`
	ThumbURL            string                `json:"thumb_url,omitempty"`
	ThumbWidth          int                   `json:"thumb_width,omitempty"`
	ThumbHeight         int                   `json:"thumb_height,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultdocument

type InlineQueryResultGame

type InlineQueryResultGame struct {
	Type          string               `json:"type"`
	ID            string               `json:"id"`
	GameShortName string               `json:"game_short_name"`
	ReplyMarkup   InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultgame

type InlineQueryResultGif

type InlineQueryResultGif struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	GifURL              string                `json:"gif_url"`
	GifWidth            int                   `json:"gif_width,omitempty"`
	GifHeight           int                   `json:"gif_height,omitempty"`
	ThumbURL            string                `json:"thumb_url"`
	Title               string                `json:"title,omitempty"`
	Caption             string                `json:"caption,omitempty"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	InputMessageContent *InputMessageContent  `json:"input_message_content,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultgif

type InlineQueryResultLocation

type InlineQueryResultLocation struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	Latitude            float32               `json:"latitude"`
	Longitude           float32               `json:"longitude"`
	Title               string                `json:"title"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	InputMessageContent *InputMessageContent  `json:"input_message_content,omitempty"`
	ThumbURL            string                `json:"thumb_url,omitempty"`
	ThumbWidth          int                   `json:"thumb_width,omitempty"`
	ThumbHeight         int                   `json:"thumb_height,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultlocation

type InlineQueryResultMpeg4Gif

type InlineQueryResultMpeg4Gif struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	Mpeg4URL            string                `json:"mpeg4_url"`
	Mpeg4Width          int                   `json:"mpeg4_width,omitempty"`
	Mpeg4Height         int                   `json:"mpeg4_height,omitempty"`
	ThumbURL            string                `json:"thumb_url"`
	Title               string                `json:"title,omitempty"`
	Caption             string                `json:"caption,omitempty"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	InputMessageContent *InputMessageContent  `json:"input_message_content,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif

type InlineQueryResultPhoto

type InlineQueryResultPhoto struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	PhotoURL            string                `json:"photo_url"`
	ThumbURL            string                `json:"thumb_url"`
	PhotoWidth          int                   `json:"photo_width,omitempty"`
	PhotoHeight         int                   `json:"photo_height,omitempty"`
	Title               string                `json:"title,omitempty"`
	Description         string                `json:"description,omitempty"`
	Caption             string                `json:"caption,omitempty"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	InputMessageContent *InputMessageContent  `json:"input_message_content,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultphoto

type InlineQueryResultVenue

type InlineQueryResultVenue struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	Latitude            string                `json:"latitude"`
	Longitude           string                `json:"longitude"`
	Title               string                `json:"title"`
	Address             string                `json:"address"`
	FoursquareID        string                `json:"foursquare_id,omitempty"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	InputMessageContent *InputMessageContent  `json:"input_message_content,omitempty"`
	ThumbURL            string                `json:"thumb_url,omitempty"`
	ThumbWidth          string                `json:"thumb_width,omitempty"`
	ThumbHeight         string                `json:"thumb_height,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultvenue

type InlineQueryResultVideo

type InlineQueryResultVideo struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	VideoURL            string                `json:"video_url"`
	MimeType            string                `json:"mime_type"`
	ThumbURL            string                `json:"thumb_url"`
	Title               string                `json:"title"`
	Caption             string                `json:"caption,omitempty"`
	VideoWidth          int                   `json:"video_width,omitempty"`
	VideoHeight         int                   `json:"video_height,omitempty"`
	VideoDuration       int                   `json:"video_duration,omitempty"`
	Description         string                `json:"description,omitempty"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	InputMessageContent *InputMessageContent  `json:"input_message_content,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultvideo

type InlineQueryResultVoice

type InlineQueryResultVoice struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	VoiceURL            string                `json:"voice_url"`
	Title               string                `json:"title"`
	Caption             string                `json:"caption,omitempty"`
	VoiceDuration       string                `json:"voice_duration,omitempty"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	InputMessageContent *InputMessageContent  `json:"input_message_content,omitempty"`
}

https://core.telegram.org/bots/api#inlinequeryresultvoice

type InputContactMessageContent

type InputContactMessageContent struct {
	PhoneNumber string `json:"phone_number"`
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name,omitempty"`
}

https://core.telegram.org/bots/api#inputcontactmessagecontent

type InputLocationMessageContent

type InputLocationMessageContent struct {
	Latitude  float32 `json:"latitude"`
	Longitude float32 `json:"longitude"`
}

https://core.telegram.org/bots/api#inputlocationmessagecontent

type InputTextMessageContent

type InputTextMessageContent struct {
	MessageText           string `json:"message_text"`
	ParseMode             string `json:"parse_mode,omitempty"`
	DisableWebPagePreview bool   `json:"disable_web_page_preview,omitempty"`
}

https://core.telegram.org/bots/api#inputtextmessagecontent

type InputVenueMessageContent

type InputVenueMessageContent struct {
	Latitude     float32 `json:"latitude"`
	Longitude    float32 `json:"longitude"`
	Title        string  `json:"title"`
	Address      string  `json:"address"`
	FoursquareID string  `json:"foursquare_id,omitempty"`
}

https://core.telegram.org/bots/api#inputvenuemessagecontent

type KeyboardButton

type KeyboardButton struct {
	Text            string `json:"text"`
	RequestContact  bool   `json:"request_contact,omitempty"`
	RequestLocation bool   `json:"request_location,omitempty"`
}

https://core.telegram.org/bots/api#keyboardbutton

type KickChatMemberParams

type KickChatMemberParams struct {
	ChatID interface{} `json:"chat_id"`
	UserID int         `json:"user_id"`
}

https://core.telegram.org/bots/api#kickchatmember

type LeaveChatParams

type LeaveChatParams struct {
	ChatID interface{} `json:"chat_id"`
}

https://core.telegram.org/bots/api#leavechat

type Location

type Location struct {
	Longitude float32 `json:"longitude"`
	Latitude  float32 `json:"latitude"`
}

https://core.telegram.org/bots/api#location

type Message

type Message struct {
	ID                    int              `json:"message_id"`
	From                  User             `json:"from,omitempty"`
	Date                  int              `json:"date"`
	Chat                  *Chat            `json:"chat"`
	ForwardFrom           *User            `json:"forward_from,omitempty"`
	ForwardFromChat       *Chat            `json:"forward_from_chat,omitempty"`
	ForwardFromMessageID  int              `json:"forward_from_message_id,omitempty"`
	ForwardDate           int              `json:"forward_date,omitempty"`
	ReplyToMessage        *Message         `json:"reply_to_message,omitempty"`
	EditDate              int              `json:"edit_date,omitempty"`
	Text                  string           `json:"text,omitempty"`
	Entities              *[]MessageEntity `json:"entities,omitempty"`
	Audio                 *Audio           `json:"audio,omitempty"`
	Document              *Document        `json:"document,omitempty"`
	Game                  *Game            `json:"game,omitempty"`
	Photo                 *[]PhotoSize     `json:"photo,omitempty"`
	Sticker               *Sticker         `json:"sticker,omitempty"`
	Video                 *Video           `json:"video,omitempty"`
	Voice                 *Voice           `json:"voice,omitempty"`
	Caption               string           `json:"caption,omitempty"`
	Contact               *Contact         `json:"contact,omitempty"`
	Location              *Location        `json:"location,omitempty"`
	Venue                 *Venue           `json:"venue,omitempty"`
	NewChatMember         *User            `json:"new_chat_member,omitempty"`
	LeftChatMember        *User            `json:"left_chat_member,omitempty"`
	NewChatTitle          string           `json:"new_chat_title,omitempty"`
	NewChatPhoto          *[]PhotoSize     `json:"new_chat_photo,omitempty"`
	DeleteChatPhoto       bool             `json:"delete_chat_photo,omitempty"`
	GroupChatCreated      bool             `json:"group_chat_created,omitempty"`
	SupergroupChatCreated bool             `json:"supergroup_chat_created,omitempty"`
	ChannelChatCreated    bool             `json:"channel_chat_created,omitempty"`
	MigrateToChatID       int              `json:"migrate_to_chat_id,omitempty"`
	MigrateFromChatID     int              `json:"migrate_from_chat_id,omitempty"`
	PinnedMessage         *Message         `json:"pinned_message,omitempty"`
}

https://core.telegram.org/bots/api#message

type MessageEntity

type MessageEntity struct {
	Type   string `json:"type"`
	Offset int    `json:"offset"`
	Length int    `json:"length"`
	URL    string `json:"url,omitempty"`
	User   *User  `json:"user,omitempty"`
}

https://core.telegram.org/bots/api#messageentity

type PhotoSize

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

https://core.telegram.org/bots/api#photosize

type ReplyKeyboardMarkup

type ReplyKeyboardMarkup struct {
	Keyboard        *[][]KeyboardButton `json:"keyboard"`
	ResizeKeyboard  bool                `json:"resize_keyboard"`
	OneTimeKeyboard bool                `json:"one_time_keyboard"`
	Selective       bool                `json:"selective"`
}

https://core.telegram.org/bots/api#replykeyboardmarkup

type ReplyKeyboardRemove

type ReplyKeyboardRemove struct {
	RemoveKeyboard bool `json:"remove_keyboard"`
	Selective      bool `json:"selective,omitempty"`
}

https://core.telegram.org/bots/api#replykeyboardremove

type Response

type Response struct {
	Ok          bool            `json:"ok"`
	Description string          `json:"description,omitempty"`
	Result      json.RawMessage `json:"result,omitempty"`
	ErrorCode   int             `json:"error_code,omitempty"`
}

https://core.telegram.org/bots/api#making-requests

type ResponseParameters

type ResponseParameters struct {
	MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"`
	RetryAfter      int   `json:"retry_after,omitempty"`
}

https://core.telegram.org/bots/api#responseparameters

type SendAudioParams

type SendAudioParams struct {
	ChatID              interface{} `json:"chat_id"                        form:"chat_id"`
	Audio               interface{} `json:"audio"                          form:"audio,inputFile"`
	Caption             string      `json:"caption,omitempty"              form:"caption,omitempty"`
	Duration            uint        `json:"duration,omitempty"             form:"duration,omitempty"`
	Performer           string      `json:"performer,omitempty"            form:"performer,omitempty"`
	Title               string      `json:"title,omitempty"                form:"title,omitempty"`
	DisableNotification bool        `json:"disable_notification,omitempty" form:"disable_notification,omitempty"`
	ReplyToMessageID    int         `json:"reply_to_message_id,omitempty"  form:"reply_to_message_id,omitempty"`
	ReplyMarkup         interface{} `json:"reply_markup,omitempty"         form:"reply_markup,omitempty"`
}

https://core.telegram.org/bots/api#sendaudio

type SendChatActionParams

type SendChatActionParams struct {
	ChatID interface{} `json:"chat_id"`
	Action string      `json:"action"`
}

https://core.telegram.org/bots/api#sendchataction

type SendContactParams

type SendContactParams struct {
	ChatID              interface{} `json:"chat_id"`
	PhoneNumber         string      `json:"phone_number"`
	FirstName           string      `json:"first_name"`
	LastName            string      `json:"last_name,omitempty"`
	DisableNotification bool        `json:"disable_notification,omitempty"`
	ReplyToMessageID    int         `json:"reply_to_message_id,omitempty"`
	ReplyMarkup         interface{} `json:"reply_markup,omitempty"`
}

https://core.telegram.org/bots/api#sendcontact

type SendDocumentParams

type SendDocumentParams struct {
	ChatID              interface{} `json:"chat_id"                        form:"chat_id"`
	Document            interface{} `json:"document"                       form:"document,inputFile"`
	Caption             string      `json:"caption,omitempty"              form:"caption,omitempty"`
	DisableNotification bool        `json:"disable_notification,omitempty" form:"disable_notification,omitempty"`
	ReplyToMessageID    int         `json:"reply_to_message_id,omitempty"  form:"reply_to_message_id,omitempty"`
	ReplyMarkup         interface{} `json:"reply_markup,omitempty"         form:"reply_markup,omitempty"`
}

https://core.telegram.org/bots/api#senddocument

type SendLocationParams

type SendLocationParams struct {
	ChatID              interface{} `json:"chat_id"`
	Latitude            float32     `json:"latitude"`
	Longitude           float32     `json:"longitude"`
	DisableNotification bool        `json:"disable_notification,omitempty"`
	ReplyToMessageID    int         `json:"reply_to_message_id,omitempty"`
	ReplyMarkup         interface{} `json:"reply_markup,omitempty"`
}

https://core.telegram.org/bots/api#sendlocation

type SendMessageParams

type SendMessageParams struct {
	ChatID                interface{} `json:"chat_id"`
	Text                  string      `json:"text"`
	ParseMode             string      `json:"parse_mode,omitempty"`
	DisableWebPagePreview bool        `json:"disable_web_page_preview,omitempty"`
	DisableNotification   bool        `json:"disable_notification,omitempty"`
	ReplyToMessageID      int         `json:"reply_to_message_id,omitempty"`
	ReplyMarkup           interface{} `json:"reply_markup,omitempty"`
}

https://core.telegram.org/bots/api#sendmessage

type SendPhotoParams

type SendPhotoParams struct {
	ChatID              interface{} `json:"chat_id"                        form:"chat_id"`
	Photo               interface{} `json:"photo"                          form:"photo,inputFile"`
	Caption             string      `json:"caption,omitempty"              form:"caption,omitempty"`
	DisableNotification bool        `json:"disable_notification,omitempty" form:"disable_notification,omitempty"`
	ReplyToMessageID    int         `json:"reply_to_message_id,omitempty"  form:"reply_to_message_id,omitempty"`
	ReplyMarkup         interface{} `json:"reply_markup,omitempty"         form:"reply_markup,omitempty"`
}

https://core.telegram.org/bots/api#sendphoto

type SendStickerParams

type SendStickerParams struct {
	ChatID              interface{} `json:"chat_id"                        form:"chat_id"`
	Sticker             interface{} `json:"sticker"                        form:"sticker,inputFile"`
	Caption             string      `json:"caption,omitempty"              form:"caption,omitempty"`
	DisableNotification bool        `json:"disable_notification,omitempty" form:"disable_notification,omitempty"`
	ReplyToMessageID    int         `json:"reply_to_message_id,omitempty"  form:"reply_to_message_id,omitempty"`
	ReplyMarkup         interface{} `json:"reply_markup,omitempty"         form:"reply_markup,omitempty"`
}

https://core.telegram.org/bots/api#sendsticker

type SendVenueParams

type SendVenueParams struct {
	ChatID              interface{} `json:"chat_id"`
	Latitude            float32     `json:"latitude"`
	Longitude           float32     `json:"longitude"`
	Title               string      `json:"title"`
	Address             string      `json:"address"`
	FoursquareID        string      `json:"foursquare_id,omitempty"`
	DisableNotification bool        `json:"disable_notification,omitempty"`
	ReplyToMessageID    int         `json:"reply_to_message_id,omitempty"`
	ReplyMarkup         interface{} `json:"reply_markup,omitempty"`
}

https://core.telegram.org/bots/api#sendvenue

type SendVideoParams

type SendVideoParams struct {
	ChatID              interface{} `json:"chat_id"                        form:"chat_id"`
	Video               interface{} `json:"video"                          form:"video,inputFile"`
	Duration            uint        `json:"duration,omitempty"             form:"duration,omitempty"`
	Width               uint        `json:"width,omitempty"                form:"width,omitempty"`
	Height              uint        `json:"height,omitempty"               form:"height,omitempty"`
	Caption             string      `json:"caption,omitempty"              form:"caption,omitempty"`
	DisableNotification bool        `json:"disable_notification,omitempty" form:"disable_notification,omitempty"`
	ReplyToMessageID    int         `json:"reply_to_message_id,omitempty"  form:"reply_to_message_id,omitempty"`
	ReplyMarkup         interface{} `json:"reply_markup,omitempty"         form:"reply_markup,omitempty"`
}

https://core.telegram.org/bots/api#sendvideo

type SendVoiceParams

type SendVoiceParams struct {
	ChatID              interface{} `json:"chat_id"                        form:"chat_id"`
	Voice               interface{} `json:"voice"                          form:"voice,inputFile"`
	Caption             string      `json:"caption,omitempty"              form:"caption,omitempty"`
	Duration            uint        `json:"duration,omitempty"             form:"duration,omitempty"`
	DisableNotification bool        `json:"disable_notification,omitempty" form:"disable_notification,omitempty"`
	ReplyToMessageID    int         `json:"reply_to_message_id,omitempty"  form:"reply_to_message_id,omitempty"`
	ReplyMarkup         interface{} `json:"reply_markup,omitempty"         form:"reply_markup,omitempty"`
}

https://core.telegram.org/bots/api#sendvoice

type Sticker

type Sticker struct {
	FileID   string     `json:"file_id"`
	Width    int        `json:"width"`
	Height   int        `json:"height"`
	Thumb    *PhotoSize `json:"thumb,omitempty"`
	Emoji    string     `json:"emoji,omitempty"`
	FileSize int        `json:"file_size,omitempty"`
}

https://core.telegram.org/bots/api#sticker

type UnbanChatMemberParams

type UnbanChatMemberParams struct {
	ChatID interface{} `json:"chat_id"`
	UserID int         `json:"user_id"`
}

https://core.telegram.org/bots/api#unbanchatmember

type Update

type Update struct {
	ID                 int                 `json:"update_id"`
	Message            *Message            `json:"message,omitempty"`
	EditedMessage      *Message            `json:"edited_message,omitempty"`
	ChannelPost        *Message            `json:"channel_post,omitempty"`
	EditedChannelPost  *Message            `json:"edited_channel_post,omitempty"`
	InlineQuery        *InlineQuery        `json:"inline_query,omitempty"`
	ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"`
	CallbackQuery      *CallbackQuery      `json:"callback_query,omitempty"`
}

https://core.telegram.org/bots/api#update

type User

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

https://core.telegram.org/bots/api#user

type UserProfilePhotos

type UserProfilePhotos struct {
	TotalCount int          `json:"total_count"`
	Photos     *[]PhotoSize `json:"photos"`
}

https://core.telegram.org/bots/api#userprofilephotos

type Venue

type Venue struct {
	Location     *Location `json:"location"`
	Title        string    `json:"title"`
	Address      string    `json:"address"`
	FoursquareID string    `json:"foursquare_id"`
}

https://core.telegram.org/bots/api#venue

type Video

type Video struct {
	FileID   string     `json:"file_id"`
	Width    int        `json:"width"`
	Height   int        `json:"height"`
	Duration int        `json:"duration"`
	Thumb    *PhotoSize `json:"thumb,omitempty"`
	MimeType string     `json:"mime_type,omitempty"`
	FileSize int        `json:"file_size,omitempty"`
}

https://core.telegram.org/bots/api#video

type Voice

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

https://core.telegram.org/bots/api#voice

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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