Documentation ¶
Overview ¶
Package tgbotapi has functions and types used for interacting with the Telegram Bot API.
Index ¶
- Constants
- Variables
- func ReplyToResponse(chattable Chattable, w http.ResponseWriter) (string, error)
- type APIResponse
- func (r APIResponse) Error() string
- func (j *APIResponse) MarshalJSON() ([]byte, error)
- func (j *APIResponse) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *APIResponse) UnmarshalJSON(input []byte) error
- func (j *APIResponse) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type AnswerCallbackQueryConfig
- func (j *AnswerCallbackQueryConfig) MarshalJSON() ([]byte, error)
- func (j *AnswerCallbackQueryConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *AnswerCallbackQueryConfig) UnmarshalJSON(input []byte) error
- func (j *AnswerCallbackQueryConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (config AnswerCallbackQueryConfig) Values() (v url.Values, err error)
- type Audio
- type AudioConfig
- func (j *AudioConfig) MarshalJSON() ([]byte, error)
- func (j *AudioConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *AudioConfig) UnmarshalJSON(input []byte) error
- func (j *AudioConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (config AudioConfig) Values() (url.Values, error)
- type BaseChat
- func (j *BaseChat) MarshalJSON() ([]byte, error)
- func (j *BaseChat) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *BaseChat) UnmarshalJSON(input []byte) error
- func (j *BaseChat) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (chat *BaseChat) Values() (url.Values, error)
- type BaseEdit
- func (j *BaseEdit) MarshalJSON() ([]byte, error)
- func (j *BaseEdit) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *BaseEdit) UnmarshalJSON(input []byte) error
- func (j *BaseEdit) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (edit BaseEdit) Values() (url.Values, error)
- type BaseFile
- type BotAPI
- func (bot *BotAPI) AnswerInlineQuery(config InlineConfig) (APIResponse, error)
- func (bot *BotAPI) EnableDebug(c context.Context)
- func (bot *BotAPI) GetChat(chatID string) (Chat, error)
- func (bot *BotAPI) GetFile(config FileConfig) (File, error)
- func (bot *BotAPI) GetFileDirectURL(fileID string) (string, error)
- func (bot *BotAPI) GetMe() (User, error)
- func (bot *BotAPI) GetUpdates(config UpdateConfig) ([]Update, error)
- func (bot *BotAPI) GetUpdatesChan(config UpdateConfig) (<-chan Update, error)
- func (bot *BotAPI) GetUserProfilePhotos(config UserProfilePhotosConfig) (UserProfilePhotos, error)
- func (bot *BotAPI) IsMessageToMe(message Message) bool
- func (bot *BotAPI) KickChatMember(config ChatMemberConfig) (APIResponse, error)
- func (bot *BotAPI) ListenForWebhook(pattern string) <-chan Update
- func (bot *BotAPI) MakeRequest(endpoint string, params url.Values) (apiResp APIResponse, err error)
- func (bot *BotAPI) MakeRequestFromChattable(m Chattable) (resp APIResponse, err error)
- func (bot *BotAPI) RemoveWebhook() (APIResponse, error)
- func (bot *BotAPI) Send(c Chattable) (Message, error)
- func (bot *BotAPI) SetWebhook(config WebhookConfig) (APIResponse, error)
- func (bot *BotAPI) UnbanChatMember(config ChatMemberConfig) (APIResponse, error)
- func (bot *BotAPI) UploadFile(endpoint string, params map[string]string, fieldname string, file interface{}) (APIResponse, error)
- type CallbackQuery
- type Chat
- func (c *Chat) IsChannel() bool
- func (c *Chat) IsGroup() bool
- func (c *Chat) IsPrivate() bool
- func (c *Chat) IsSuperGroup() bool
- func (j *Chat) MarshalJSON() ([]byte, error)
- func (j *Chat) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *Chat) UnmarshalJSON(input []byte) error
- func (j *Chat) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type ChatActionConfig
- func (j *ChatActionConfig) MarshalJSON() ([]byte, error)
- func (j *ChatActionConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *ChatActionConfig) UnmarshalJSON(input []byte) error
- func (j *ChatActionConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (config ChatActionConfig) Values() (url.Values, error)
- type ChatMember
- func (chatMember ChatMember) IsBotUser() bool
- func (j *ChatMember) MarshalJSON() ([]byte, error)
- func (j *ChatMember) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *ChatMember) UnmarshalJSON(input []byte) error
- func (j *ChatMember) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type ChatMemberConfig
- type Chattable
- type ChosenInlineResult
- type Contact
- type ContactConfig
- func (j *ContactConfig) MarshalJSON() ([]byte, error)
- func (j *ContactConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *ContactConfig) UnmarshalJSON(input []byte) error
- func (j *ContactConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (config ContactConfig) Values() (url.Values, error)
- type DeleteMessage
- func (j *DeleteMessage) MarshalJSON() ([]byte, error)
- func (j *DeleteMessage) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *DeleteMessage) UnmarshalJSON(input []byte) error
- func (j *DeleteMessage) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (m DeleteMessage) Values() (url.Values, error)
- type Document
- type DocumentConfig
- func (j *DocumentConfig) MarshalJSON() ([]byte, error)
- func (j *DocumentConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *DocumentConfig) UnmarshalJSON(input []byte) error
- func (j *DocumentConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (config DocumentConfig) Values() (url.Values, error)
- type EditMessageCaptionConfig
- func (j *EditMessageCaptionConfig) MarshalJSON() ([]byte, error)
- func (j *EditMessageCaptionConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *EditMessageCaptionConfig) UnmarshalJSON(input []byte) error
- func (j *EditMessageCaptionConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (config EditMessageCaptionConfig) Values() (url.Values, error)
- type EditMessageReplyMarkupConfig
- func (j *EditMessageReplyMarkupConfig) MarshalJSON() ([]byte, error)
- func (j *EditMessageReplyMarkupConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *EditMessageReplyMarkupConfig) UnmarshalJSON(input []byte) error
- func (j *EditMessageReplyMarkupConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (config EditMessageReplyMarkupConfig) Values() (url.Values, error)
- type EditMessageTextConfig
- func (j *EditMessageTextConfig) MarshalJSON() ([]byte, error)
- func (j *EditMessageTextConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *EditMessageTextConfig) UnmarshalJSON(input []byte) error
- func (j *EditMessageTextConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (config EditMessageTextConfig) Values() (url.Values, error)
- type ErrAPIForbidden
- func (err ErrAPIForbidden) Error() string
- func (err ErrAPIForbidden) IsForbidden()
- func (j *ErrAPIForbidden) MarshalJSON() ([]byte, error)
- func (j *ErrAPIForbidden) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *ErrAPIForbidden) UnmarshalJSON(input []byte) error
- func (j *ErrAPIForbidden) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type ExportChatInviteLink
- func (j *ExportChatInviteLink) MarshalJSON() ([]byte, error)
- func (j *ExportChatInviteLink) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *ExportChatInviteLink) UnmarshalJSON(input []byte) error
- func (j *ExportChatInviteLink) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (config ExportChatInviteLink) Values() (url.Values, error)
- type File
- type FileBytes
- type FileConfig
- type FileReader
- type Fileable
- type ForceReply
- func (ForceReply) KeyboardType() botsfw.KeyboardType
- func (j *ForceReply) MarshalJSON() ([]byte, error)
- func (j *ForceReply) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *ForceReply) UnmarshalJSON(input []byte) error
- func (j *ForceReply) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type ForwardConfig
- func (j *ForwardConfig) MarshalJSON() ([]byte, error)
- func (j *ForwardConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *ForwardConfig) UnmarshalJSON(input []byte) error
- func (j *ForwardConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (config ForwardConfig) Values() (url.Values, error)
- type GroupChat
- type InlineConfig
- func (j *InlineConfig) MarshalJSON() ([]byte, error)
- func (j *InlineConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *InlineConfig) UnmarshalJSON(input []byte) error
- func (j *InlineConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (config InlineConfig) Values() (url.Values, error)
- type InlineKeyboardButton
- func NewInlineKeyboardButtonData(text, data string) InlineKeyboardButton
- func NewInlineKeyboardButtonSwitchInlineQuery(text, query string) InlineKeyboardButton
- func NewInlineKeyboardButtonSwitchInlineQueryCurrentChat(text, query string) InlineKeyboardButton
- func NewInlineKeyboardButtonURL(text, url string) InlineKeyboardButton
- func NewInlineKeyboardRow(buttons ...InlineKeyboardButton) []InlineKeyboardButton
- func (j *InlineKeyboardButton) MarshalJSON() ([]byte, error)
- func (j *InlineKeyboardButton) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *InlineKeyboardButton) UnmarshalJSON(input []byte) error
- func (j *InlineKeyboardButton) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type InlineKeyboardMarkup
- func (*InlineKeyboardMarkup) KeyboardType() botsfw.KeyboardType
- func (j *InlineKeyboardMarkup) MarshalJSON() ([]byte, error)
- func (j *InlineKeyboardMarkup) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *InlineKeyboardMarkup) UnmarshalJSON(input []byte) error
- func (j *InlineKeyboardMarkup) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type InlineQuery
- type InlineQueryResultArticle
- func (j *InlineQueryResultArticle) MarshalJSON() ([]byte, error)
- func (j *InlineQueryResultArticle) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *InlineQueryResultArticle) UnmarshalJSON(input []byte) error
- func (j *InlineQueryResultArticle) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type InlineQueryResultAudio
- func (j *InlineQueryResultAudio) MarshalJSON() ([]byte, error)
- func (j *InlineQueryResultAudio) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *InlineQueryResultAudio) UnmarshalJSON(input []byte) error
- func (j *InlineQueryResultAudio) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type InlineQueryResultDocument
- func (j *InlineQueryResultDocument) MarshalJSON() ([]byte, error)
- func (j *InlineQueryResultDocument) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *InlineQueryResultDocument) UnmarshalJSON(input []byte) error
- func (j *InlineQueryResultDocument) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type InlineQueryResultGIF
- func (j *InlineQueryResultGIF) MarshalJSON() ([]byte, error)
- func (j *InlineQueryResultGIF) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *InlineQueryResultGIF) UnmarshalJSON(input []byte) error
- func (j *InlineQueryResultGIF) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type InlineQueryResultLocation
- func (j *InlineQueryResultLocation) MarshalJSON() ([]byte, error)
- func (j *InlineQueryResultLocation) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *InlineQueryResultLocation) UnmarshalJSON(input []byte) error
- func (j *InlineQueryResultLocation) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type InlineQueryResultMPEG4GIF
- func (j *InlineQueryResultMPEG4GIF) MarshalJSON() ([]byte, error)
- func (j *InlineQueryResultMPEG4GIF) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *InlineQueryResultMPEG4GIF) UnmarshalJSON(input []byte) error
- func (j *InlineQueryResultMPEG4GIF) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type InlineQueryResultPhoto
- func (j *InlineQueryResultPhoto) MarshalJSON() ([]byte, error)
- func (j *InlineQueryResultPhoto) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *InlineQueryResultPhoto) UnmarshalJSON(input []byte) error
- func (j *InlineQueryResultPhoto) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type InlineQueryResultVideo
- func (j *InlineQueryResultVideo) MarshalJSON() ([]byte, error)
- func (j *InlineQueryResultVideo) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *InlineQueryResultVideo) UnmarshalJSON(input []byte) error
- func (j *InlineQueryResultVideo) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type InlineQueryResultVoice
- func (j *InlineQueryResultVoice) MarshalJSON() ([]byte, error)
- func (j *InlineQueryResultVoice) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *InlineQueryResultVoice) UnmarshalJSON(input []byte) error
- func (j *InlineQueryResultVoice) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type InputContactMessageContent
- func (j *InputContactMessageContent) MarshalJSON() ([]byte, error)
- func (j *InputContactMessageContent) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *InputContactMessageContent) UnmarshalJSON(input []byte) error
- func (j *InputContactMessageContent) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type InputLocationMessageContent
- func (j *InputLocationMessageContent) MarshalJSON() ([]byte, error)
- func (j *InputLocationMessageContent) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *InputLocationMessageContent) UnmarshalJSON(input []byte) error
- func (j *InputLocationMessageContent) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type InputTextMessageContent
- func (j *InputTextMessageContent) MarshalJSON() ([]byte, error)
- func (j *InputTextMessageContent) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *InputTextMessageContent) UnmarshalJSON(input []byte) error
- func (j *InputTextMessageContent) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type InputVenueMessageContent
- func (j *InputVenueMessageContent) MarshalJSON() ([]byte, error)
- func (j *InputVenueMessageContent) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *InputVenueMessageContent) UnmarshalJSON(input []byte) error
- func (j *InputVenueMessageContent) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type KeyboardButton
- type LeaveChatConfig
- func (j *LeaveChatConfig) MarshalJSON() ([]byte, error)
- func (j *LeaveChatConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *LeaveChatConfig) UnmarshalJSON(input []byte) error
- func (j *LeaveChatConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (config LeaveChatConfig) Values() (url.Values, error)
- type Location
- type LocationConfig
- func (j *LocationConfig) MarshalJSON() ([]byte, error)
- func (j *LocationConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *LocationConfig) UnmarshalJSON(input []byte) error
- func (j *LocationConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (config LocationConfig) Values() (url.Values, error)
- type Message
- func (m *Message) Command() string
- func (m *Message) CommandArguments() string
- func (m *Message) IsCommand() bool
- func (j *Message) MarshalJSON() ([]byte, error)
- func (j *Message) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (m *Message) Time() time.Time
- func (j *Message) UnmarshalJSON(input []byte) error
- func (j *Message) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type MessageConfig
- func (j *MessageConfig) MarshalJSON() ([]byte, error)
- func (j *MessageConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *MessageConfig) UnmarshalJSON(input []byte) error
- func (j *MessageConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (config MessageConfig) Values() (url.Values, error)
- type MessageEntity
- func (j *MessageEntity) MarshalJSON() ([]byte, error)
- func (j *MessageEntity) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (entity MessageEntity) ParseURL() (*url.URL, error)
- func (j *MessageEntity) UnmarshalJSON(input []byte) error
- func (j *MessageEntity) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type PhotoConfig
- func (j *PhotoConfig) MarshalJSON() ([]byte, error)
- func (j *PhotoConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *PhotoConfig) UnmarshalJSON(input []byte) error
- func (j *PhotoConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (config PhotoConfig) Values() (url.Values, error)
- type PhotoSize
- type ReplyKeyboardHide
- func (ReplyKeyboardHide) KeyboardType() botsfw.KeyboardType
- func (j *ReplyKeyboardHide) MarshalJSON() ([]byte, error)
- func (j *ReplyKeyboardHide) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *ReplyKeyboardHide) UnmarshalJSON(input []byte) error
- func (j *ReplyKeyboardHide) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type ReplyKeyboardMarkup
- func (*ReplyKeyboardMarkup) KeyboardType() botsfw.KeyboardType
- func (j *ReplyKeyboardMarkup) MarshalJSON() ([]byte, error)
- func (j *ReplyKeyboardMarkup) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *ReplyKeyboardMarkup) UnmarshalJSON(input []byte) error
- func (j *ReplyKeyboardMarkup) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type Sticker
- type StickerConfig
- func (j *StickerConfig) MarshalJSON() ([]byte, error)
- func (j *StickerConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *StickerConfig) UnmarshalJSON(input []byte) error
- func (j *StickerConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (config StickerConfig) Values() (url.Values, error)
- type Update
- type UpdateConfig
- type User
- func (u User) GetFirstName() string
- func (u User) GetFullName() string
- func (u User) GetID() interface{}
- func (u User) GetLanguage() string
- func (u User) GetLastName() string
- func (u User) GetUserName() string
- func (j *User) MarshalJSON() ([]byte, error)
- func (j *User) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (u User) Platform() string
- func (u *User) String() string
- func (j *User) UnmarshalJSON(input []byte) error
- func (j *User) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type UserProfilePhotos
- type UserProfilePhotosConfig
- func (j *UserProfilePhotosConfig) MarshalJSON() ([]byte, error)
- func (j *UserProfilePhotosConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *UserProfilePhotosConfig) UnmarshalJSON(input []byte) error
- func (j *UserProfilePhotosConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type Venue
- type VenueConfig
- func (j *VenueConfig) MarshalJSON() ([]byte, error)
- func (j *VenueConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *VenueConfig) UnmarshalJSON(input []byte) error
- func (j *VenueConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (config VenueConfig) Values() (url.Values, error)
- type Video
- type VideoConfig
- func (j *VideoConfig) MarshalJSON() ([]byte, error)
- func (j *VideoConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *VideoConfig) UnmarshalJSON(input []byte) error
- func (j *VideoConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (config VideoConfig) Values() (url.Values, error)
- type Voice
- type VoiceConfig
- func (j *VoiceConfig) MarshalJSON() ([]byte, error)
- func (j *VoiceConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *VoiceConfig) UnmarshalJSON(input []byte) error
- func (j *VoiceConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (config VoiceConfig) Values() (url.Values, error)
- type WebhookConfig
Examples ¶
Constants ¶
const ( // APIEndpoint is the endpoint for all API methods, // with formatting for Sprintf. APIEndpoint = "https://api.telegram.org/bot%s/%s" // FileEndpoint is the endpoint for downloading a file from Telegram. FileEndpoint = "https://api.telegram.org/file/bot%s/%s" )
Telegram constants
const ( // ChatTyping is chat action ChatTyping = "typing" // ChatUploadPhoto is chat action ChatUploadPhoto = "upload_photo" // ChatRecordVideo is chat action ChatRecordVideo = "record_video" // ChatUploadVideo is chat action ChatUploadVideo = "upload_video" // ChatRecordAudio is chat action ChatRecordAudio = "record_audio" // ChatUploadAudio is chat action ChatUploadAudio = "upload_audio" // ChatUploadDocument is chat action ChatUploadDocument = "upload_document" // ChatFindLocation is chat action ChatFindLocation = "find_location" )
Constant values for ChatActions
const ( // ModeMarkdown indicates markdown mode ModeMarkdown = "Markdown" // ModeMarkdown indicates HTML mode ModeHTML = "HTML" )
Constant values for ParseMode in MessageConfig
const ( // ErrBadFileType happens when you pass an unknown type ErrBadFileType = "bad file type" // ErrBadURL indicates bad or enpty URL ErrBadURL = "bad or empty URL" )
Library errors
Variables ¶
var ErrNoChatID = errors.New("missing chat_id")
ErrNoChatID is error when chat_id is missing
Functions ¶
func ReplyToResponse ¶
func ReplyToResponse(chattable Chattable, w http.ResponseWriter) (string, error)
ReplyToResponse replies to response
Types ¶
type APIResponse ¶
type APIResponse struct { Ok bool `json:"ok"` Result json.RawMessage `json:"result"` ErrorCode int `json:"error_code"` Description string `json:"description"` }
APIResponse is a response from the Telegram API with the result stored raw.
func (APIResponse) Error ¶
func (r APIResponse) Error() string
func (*APIResponse) MarshalJSON ¶
func (j *APIResponse) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*APIResponse) MarshalJSONBuf ¶
func (j *APIResponse) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*APIResponse) UnmarshalJSON ¶
func (j *APIResponse) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*APIResponse) UnmarshalJSONFFLexer ¶
func (j *APIResponse) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type AnswerCallbackQueryConfig ¶
type AnswerCallbackQueryConfig struct { CallbackQueryID string `json:"callback_query_id,"` Text string `json:"text,omitempty"` ShowAlert bool `json:"show_alert,omitempty"` URL string `json:"url,omitempty"` CacheTime int `json:"cache_time,omitempty"` }
AnswerCallbackQueryConfig contains information on making a CallbackQuery response.
func NewCallback ¶
func NewCallback(id, text string) AnswerCallbackQueryConfig
NewCallback creates a new callback message.
func NewCallbackWithAlert ¶
func NewCallbackWithAlert(id, text string) AnswerCallbackQueryConfig
NewCallbackWithAlert creates a new callback message that alerts the user.
func NewCallbackWithURL ¶
func NewCallbackWithURL(url string) AnswerCallbackQueryConfig
NewCallbackWithURL creates new callback command with URL
func (*AnswerCallbackQueryConfig) MarshalJSON ¶
func (j *AnswerCallbackQueryConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*AnswerCallbackQueryConfig) MarshalJSONBuf ¶
func (j *AnswerCallbackQueryConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*AnswerCallbackQueryConfig) UnmarshalJSON ¶
func (j *AnswerCallbackQueryConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*AnswerCallbackQueryConfig) UnmarshalJSONFFLexer ¶
func (j *AnswerCallbackQueryConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type Audio ¶
type Audio struct { FileID string `json:"file_id"` Duration int `json:"duration"` Performer string `json:"performer"` // optional Title string `json:"title"` // optional MimeType string `json:"mime_type"` // optional FileSize int `json:"file_size"` // optional }
Audio contains information about audio.
func (*Audio) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Audio) MarshalJSONBuf ¶
func (j *Audio) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*Audio) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*Audio) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type AudioConfig ¶
AudioConfig contains information about a SendAudio request.
func NewAudioShare ¶
func NewAudioShare(chatID int64, fileID string) AudioConfig
NewAudioShare shares an existing audio file. You may use this to reshare an existing audio file without reuploading it.
chatID is where to send it, fileID is the ID of the audio already uploaded.
func NewAudioUpload ¶
func NewAudioUpload(chatID int64, file interface{}) AudioConfig
NewAudioUpload creates a new audio uploader.
chatID is where to send it, file is a string path to the file, FileReader, or FileBytes.
func (*AudioConfig) MarshalJSON ¶
func (j *AudioConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*AudioConfig) MarshalJSONBuf ¶
func (j *AudioConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*AudioConfig) UnmarshalJSON ¶
func (j *AudioConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*AudioConfig) UnmarshalJSONFFLexer ¶
func (j *AudioConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type BaseChat ¶
type BaseChat struct { ChatID int64 `json:"chat_id,omitempty"` ChannelUsername string `json:"channel_username,omitempty"` ReplyToMessageID int `json:"reply_to_message_id,omitempty"` ReplyMarkup interface{} `json:"reply_markup,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` }
BaseChat is base type for all chat config types.
func (*BaseChat) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*BaseChat) MarshalJSONBuf ¶
func (j *BaseChat) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*BaseChat) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*BaseChat) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type BaseEdit ¶
type BaseEdit struct { ChannelUsername string `json:",omitempty"` InlineMessageID string `json:"inline_message_id,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:",omitempty"` // contains filtered or unexported fields }
BaseEdit is base type of all chat edits.
func NewChatMessageEdit ¶
NewChatMessageEdit returns BaseEdit
func (*BaseEdit) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*BaseEdit) MarshalJSONBuf ¶
func (j *BaseEdit) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*BaseEdit) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*BaseEdit) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type BaseFile ¶
type BaseFile struct { BaseChat File interface{} FileID string UseExisting bool MimeType string FileSize int }
BaseFile is a base type for all file config types.
func (*BaseFile) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*BaseFile) MarshalJSONBuf ¶
func (j *BaseFile) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*BaseFile) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*BaseFile) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type BotAPI ¶
type BotAPI struct { Token string `json:"token"` Self User `json:"-"` Client *http.Client `json:"-"` // contains filtered or unexported fields }
BotAPI allows you to interact with the Telegram Bot API.
func NewBotAPI ¶
NewBotAPI creates a new BotAPI instance.
It requires a token, provided by @BotFather on Telegram.
Example ¶
bot := NewBotAPI("MyAwesomeBotToken") log.Printf("Authorized on account %s", bot.Self.UserName) u := NewUpdate(0) u.Timeout = 60 updates, _ := bot.GetUpdatesChan(u) for update := range updates { log.Printf("[%s] %s", update.Message.From.UserName, update.Message.Text) msg := NewMessage(update.Message.Chat.ID, update.Message.Text) msg.ReplyToMessageID = update.Message.MessageID if _, err := bot.Send(msg); err != nil { log.Println(err) } }
Output:
func NewBotAPIWithClient ¶
NewBotAPIWithClient creates a new BotAPI instance and allows you to pass a http.Client.
It requires a token, provided by @BotFather on Telegram.
func (*BotAPI) AnswerInlineQuery ¶
func (bot *BotAPI) AnswerInlineQuery(config InlineConfig) (APIResponse, error)
AnswerInlineQuery sends a response to an inline query.
Note that you must respond to an inline query within 30 seconds.
func (*BotAPI) EnableDebug ¶
EnableDebug enables debugging
func (*BotAPI) GetFile ¶
func (bot *BotAPI) GetFile(config FileConfig) (File, error)
GetFile returns a File which can download a file from Telegram.
Requires FileID.
func (*BotAPI) GetFileDirectURL ¶
GetFileDirectURL returns direct URL to file
It requires the FileID.
func (*BotAPI) GetMe ¶
GetMe fetches the currently authenticated bot.
This method is called upon creation to validate the token, and so you may get this data from BotAPI.Self without the need for another request.
func (*BotAPI) GetUpdates ¶
func (bot *BotAPI) GetUpdates(config UpdateConfig) ([]Update, error)
GetUpdates fetches updates. If a WebHook is set, this will not return any data!
Offset, Limit, and Timeout are optional. To avoid stale items, set Offset to one higher than the previous item. Set Timeout to a large number to reduce requests so you can get updates instantly instead of having to wait between requests.
func (*BotAPI) GetUpdatesChan ¶
func (bot *BotAPI) GetUpdatesChan(config UpdateConfig) (<-chan Update, error)
GetUpdatesChan starts and returns a channel for getting updates.
func (*BotAPI) GetUserProfilePhotos ¶
func (bot *BotAPI) GetUserProfilePhotos(config UserProfilePhotosConfig) (UserProfilePhotos, error)
GetUserProfilePhotos gets a user's profile photos.
It requires UserID. Offset and Limit are optional.
func (*BotAPI) IsMessageToMe ¶
IsMessageToMe returns true if message directed to this bot.
It requires the Message.
func (*BotAPI) KickChatMember ¶
func (bot *BotAPI) KickChatMember(config ChatMemberConfig) (APIResponse, error)
KickChatMember kicks a user from a chat. Note that this only will work in supergroups, and requires the bot to be an admin. Also note they will be unable to rejoin until they are unbanned.
func (*BotAPI) ListenForWebhook ¶
ListenForWebhook registers a http handler for a webhook.
func (*BotAPI) MakeRequest ¶
MakeRequest makes a request to a specific endpoint with our token.
func (*BotAPI) MakeRequestFromChattable ¶
func (bot *BotAPI) MakeRequestFromChattable(m Chattable) (resp APIResponse, err error)
MakeRequestFromChattable makes request from chattable TODO: Is duplicate of Send()?
func (*BotAPI) RemoveWebhook ¶
func (bot *BotAPI) RemoveWebhook() (APIResponse, error)
RemoveWebhook unsets the webhook.
func (*BotAPI) Send ¶
Send will send a Chattable item to Telegram.
It requires the Chattable to send.
func (*BotAPI) SetWebhook ¶
func (bot *BotAPI) SetWebhook(config WebhookConfig) (APIResponse, error)
SetWebhook sets a webhook.
If this is set, GetUpdates will not get any data!
If you do not have a legitimate TLS certificate, you need to include your self signed certificate with the config.
func (*BotAPI) UnbanChatMember ¶
func (bot *BotAPI) UnbanChatMember(config ChatMemberConfig) (APIResponse, error)
UnbanChatMember unbans a user from a chat. Note that this only will work in supergroups, and requires the bot to be an admin.
func (*BotAPI) UploadFile ¶
func (bot *BotAPI) UploadFile(endpoint string, params map[string]string, fieldname string, file interface{}) (APIResponse, error)
UploadFile makes a request to the API with a file.
Requires the parameter to hold the file not be in the params. File should be a string to a file path, a FileBytes struct, or a FileReader struct.
Note that if your FileReader has a size set to -1, it will read the file into memory to calculate a size.
type CallbackQuery ¶
type CallbackQuery struct { ID string `json:"id"` From *User `json:"from"` Message *Message `json:"message,omitempty"` // optional ChatInstance string `json:"chat_instance,omitempty"` // optional InlineMessageID string `json:"inline_message_id,omitempty"` // optional Data string `json:"data,omitempty"` // optional }
CallbackQuery is data sent when a keyboard button with callback data is clicked.
func (*CallbackQuery) MarshalJSON ¶
func (j *CallbackQuery) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*CallbackQuery) MarshalJSONBuf ¶
func (j *CallbackQuery) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*CallbackQuery) UnmarshalJSON ¶
func (j *CallbackQuery) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*CallbackQuery) UnmarshalJSONFFLexer ¶
func (j *CallbackQuery) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type Chat ¶
type Chat struct { ID int64 `json:"id"` Type string `json:"type"` Title string `json:"title"` // optional UserName string `json:"username"` // optional FirstName string `json:"first_name"` // optional LastName string `json:"last_name"` // optional }
Chat contains information about the place a message was sent.
func (*Chat) IsSuperGroup ¶
IsSuperGroup returns if the Chat is a supergroup.
func (*Chat) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Chat) MarshalJSONBuf ¶
func (j *Chat) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*Chat) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*Chat) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type ChatActionConfig ¶
ChatActionConfig contains information about a SendChatAction request.
func NewChatAction ¶
func NewChatAction(chatID int64, action string) ChatActionConfig
NewChatAction sets a chat action. Actions last for 5 seconds, or until your next action.
chatID is where to send it, action should be set via Chat constants.
func (*ChatActionConfig) MarshalJSON ¶
func (j *ChatActionConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*ChatActionConfig) MarshalJSONBuf ¶
func (j *ChatActionConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*ChatActionConfig) UnmarshalJSON ¶
func (j *ChatActionConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*ChatActionConfig) UnmarshalJSONFFLexer ¶
func (j *ChatActionConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type ChatMember ¶
ChatMember holds information about chat member
func (ChatMember) IsBotUser ¶
func (chatMember ChatMember) IsBotUser() bool
IsBotUser indicates if chat member is a bot
func (*ChatMember) MarshalJSON ¶
func (j *ChatMember) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*ChatMember) MarshalJSONBuf ¶
func (j *ChatMember) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*ChatMember) UnmarshalJSON ¶
func (j *ChatMember) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*ChatMember) UnmarshalJSONFFLexer ¶
func (j *ChatMember) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type ChatMemberConfig ¶
ChatMemberConfig contains information about a user in a chat for use with administrative functions such as kicking or unbanning a user.
func (*ChatMemberConfig) MarshalJSON ¶
func (j *ChatMemberConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*ChatMemberConfig) MarshalJSONBuf ¶
func (j *ChatMemberConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*ChatMemberConfig) UnmarshalJSON ¶
func (j *ChatMemberConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*ChatMemberConfig) UnmarshalJSONFFLexer ¶
func (j *ChatMemberConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type Chattable ¶
type Chattable interface { Values() (url.Values, error) // contains filtered or unexported methods }
Chattable is any config type that can be sent.
type ChosenInlineResult ¶
type ChosenInlineResult struct { ResultID string `json:"result_id"` From *User `json:"from"` Location *Location `json:"location"` InlineMessageID string `json:"inline_message_id"` Query string `json:"query"` }
ChosenInlineResult is an inline query result chosen by a User
func (*ChosenInlineResult) MarshalJSON ¶
func (j *ChosenInlineResult) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*ChosenInlineResult) MarshalJSONBuf ¶
func (j *ChosenInlineResult) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*ChosenInlineResult) UnmarshalJSON ¶
func (j *ChosenInlineResult) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*ChosenInlineResult) UnmarshalJSONFFLexer ¶
func (j *ChosenInlineResult) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type Contact ¶
type Contact struct { PhoneNumber string `json:"phone_number"` FirstName string `json:"first_name"` LastName string `json:"last_name,omitempty"` // optional UserID int `json:"user_id,omitempty"` // optional }
Contact contains information about a contact.
Note that LastName and UserID may be empty.
func (*Contact) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Contact) MarshalJSONBuf ¶
func (j *Contact) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*Contact) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*Contact) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type ContactConfig ¶
ContactConfig allows you to send a contact.
func NewContact ¶
func NewContact(chatID int64, phoneNumber, firstName string) ContactConfig
NewContact allows you to send a shared contact.
func (*ContactConfig) MarshalJSON ¶
func (j *ContactConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*ContactConfig) MarshalJSONBuf ¶
func (j *ContactConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*ContactConfig) UnmarshalJSON ¶
func (j *ContactConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*ContactConfig) UnmarshalJSONFFLexer ¶
func (j *ContactConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type DeleteMessage ¶
type DeleteMessage chatEdit
DeleteMessage is a command to delete a message
func (*DeleteMessage) MarshalJSON ¶
func (j *DeleteMessage) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*DeleteMessage) MarshalJSONBuf ¶
func (j *DeleteMessage) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*DeleteMessage) UnmarshalJSON ¶
func (j *DeleteMessage) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*DeleteMessage) UnmarshalJSONFFLexer ¶
func (j *DeleteMessage) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type Document ¶
type Document struct { FileID string `json:"file_id"` Thumbnail *PhotoSize `json:"thumb,omitempty"` // optional FileName string `json:"file_name,omitempty"` // optional MimeType string `json:"mime_type,omitempty"` // optional FileSize int `json:"file_size,omitempty"` // optional }
Document contains information about a document.
func (*Document) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Document) MarshalJSONBuf ¶
func (j *Document) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*Document) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*Document) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type DocumentConfig ¶
type DocumentConfig struct {
BaseFile
}
DocumentConfig contains information about a SendDocument request.
func NewDocumentShare ¶
func NewDocumentShare(chatID int64, fileID string) DocumentConfig
NewDocumentShare shares an existing document. You may use this to reshare an existing document without reuploading it.
chatID is where to send it, fileID is the ID of the document already uploaded.
func NewDocumentUpload ¶
func NewDocumentUpload(chatID int64, file interface{}) DocumentConfig
NewDocumentUpload creates a new document uploader.
chatID is where to send it, file is a string path to the file, FileReader, or FileBytes.
func (*DocumentConfig) MarshalJSON ¶
func (j *DocumentConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*DocumentConfig) MarshalJSONBuf ¶
func (j *DocumentConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*DocumentConfig) UnmarshalJSON ¶
func (j *DocumentConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*DocumentConfig) UnmarshalJSONFFLexer ¶
func (j *DocumentConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type EditMessageCaptionConfig ¶
EditMessageCaptionConfig allows you to modify the caption of a message.
func NewEditMessageCaption ¶
func NewEditMessageCaption(chatID int64, messageID int, caption string) EditMessageCaptionConfig
NewEditMessageCaption allows you to edit the caption of a message.
func (*EditMessageCaptionConfig) MarshalJSON ¶
func (j *EditMessageCaptionConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*EditMessageCaptionConfig) MarshalJSONBuf ¶
func (j *EditMessageCaptionConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*EditMessageCaptionConfig) UnmarshalJSON ¶
func (j *EditMessageCaptionConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*EditMessageCaptionConfig) UnmarshalJSONFFLexer ¶
func (j *EditMessageCaptionConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type EditMessageReplyMarkupConfig ¶
type EditMessageReplyMarkupConfig struct {
BaseEdit
}
EditMessageReplyMarkupConfig allows you to modify the reply markup of a message.
func NewEditMessageReplyMarkup ¶
func NewEditMessageReplyMarkup(chatID int64, messageID int, inlineMessageID string, replyMarkup *InlineKeyboardMarkup) EditMessageReplyMarkupConfig
NewEditMessageReplyMarkup allows you to edit the inline keyboard markup.
func (*EditMessageReplyMarkupConfig) MarshalJSON ¶
func (j *EditMessageReplyMarkupConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*EditMessageReplyMarkupConfig) MarshalJSONBuf ¶
func (j *EditMessageReplyMarkupConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*EditMessageReplyMarkupConfig) UnmarshalJSON ¶
func (j *EditMessageReplyMarkupConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*EditMessageReplyMarkupConfig) UnmarshalJSONFFLexer ¶
func (j *EditMessageReplyMarkupConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type EditMessageTextConfig ¶
type EditMessageTextConfig struct { BaseEdit Text string ParseMode string DisableWebPagePreview bool }
EditMessageTextConfig allows you to modify the text in a message.
func NewEditMessageText ¶
func NewEditMessageText(chatID int64, messageID int, inlineMessageID, text string) *EditMessageTextConfig
NewEditMessageText allows you to edit the text of a message.
func (*EditMessageTextConfig) MarshalJSON ¶
func (j *EditMessageTextConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*EditMessageTextConfig) MarshalJSONBuf ¶
func (j *EditMessageTextConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*EditMessageTextConfig) UnmarshalJSON ¶
func (j *EditMessageTextConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*EditMessageTextConfig) UnmarshalJSONFFLexer ¶
func (j *EditMessageTextConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type ErrAPIForbidden ¶
type ErrAPIForbidden struct { }
ErrAPIForbidden is for 'forbidden' API response
func (ErrAPIForbidden) Error ¶
func (err ErrAPIForbidden) Error() string
Error implements error interface
func (ErrAPIForbidden) IsForbidden ¶
func (err ErrAPIForbidden) IsForbidden()
IsForbidden indicates is forbidden
func (*ErrAPIForbidden) MarshalJSON ¶
func (j *ErrAPIForbidden) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*ErrAPIForbidden) MarshalJSONBuf ¶
func (j *ErrAPIForbidden) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*ErrAPIForbidden) UnmarshalJSON ¶
func (j *ErrAPIForbidden) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*ErrAPIForbidden) UnmarshalJSONFFLexer ¶
func (j *ErrAPIForbidden) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type ExportChatInviteLink ¶
type ExportChatInviteLink struct {
// contains filtered or unexported fields
}
ExportChatInviteLink is message command for exporting chat link
func (*ExportChatInviteLink) MarshalJSON ¶
func (j *ExportChatInviteLink) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*ExportChatInviteLink) MarshalJSONBuf ¶
func (j *ExportChatInviteLink) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*ExportChatInviteLink) UnmarshalJSON ¶
func (j *ExportChatInviteLink) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*ExportChatInviteLink) UnmarshalJSONFFLexer ¶
func (j *ExportChatInviteLink) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type File ¶
type File struct { FileID string `json:"file_id"` FileSize int `json:"file_size,omitempty"` // optional FilePath string `json:"file_path,omitempty"` // optional }
File contains information about a file to download from Telegram.
func (*File) Link ¶
Link returns a full path to the download URL for a File.
It requires the Bot Token to create the link.
func (*File) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*File) MarshalJSONBuf ¶
func (j *File) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*File) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*File) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type FileBytes ¶
FileBytes contains information about a set of bytes to upload as a File.
func (*FileBytes) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*FileBytes) MarshalJSONBuf ¶
func (j *FileBytes) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*FileBytes) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*FileBytes) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type FileConfig ¶
type FileConfig struct {
FileID string
}
FileConfig has information about a file hosted on Telegram.
func (*FileConfig) MarshalJSON ¶
func (j *FileConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*FileConfig) MarshalJSONBuf ¶
func (j *FileConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*FileConfig) UnmarshalJSON ¶
func (j *FileConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*FileConfig) UnmarshalJSONFFLexer ¶
func (j *FileConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type FileReader ¶
FileReader contains information about a reader to upload as a File. If Size is -1, it will read the entire Reader into memory to calculate a Size.
func (*FileReader) MarshalJSON ¶
func (j *FileReader) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*FileReader) MarshalJSONBuf ¶
func (j *FileReader) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*FileReader) UnmarshalJSON ¶
func (j *FileReader) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*FileReader) UnmarshalJSONFFLexer ¶
func (j *FileReader) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type Fileable ¶
type Fileable interface { Chattable // contains filtered or unexported methods }
Fileable is any config type that can be sent that includes a file.
type ForceReply ¶
type ForceReply struct { ForceReply bool `json:"force_reply"` Selective bool `json:"selective,omitempty"` // optional }
ForceReply allows the Bot to have users directly reply to it without additional interaction.
func (ForceReply) KeyboardType ¶
func (ForceReply) KeyboardType() botsfw.KeyboardType
KeyboardType returns KeyboardTypeForceReply
func (*ForceReply) MarshalJSON ¶
func (j *ForceReply) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*ForceReply) MarshalJSONBuf ¶
func (j *ForceReply) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*ForceReply) UnmarshalJSON ¶
func (j *ForceReply) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*ForceReply) UnmarshalJSONFFLexer ¶
func (j *ForceReply) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type ForwardConfig ¶
type ForwardConfig struct { BaseChat FromChatID int64 // required FromChannelUsername string MessageID int // required }
ForwardConfig contains information about a ForwardMessage request.
func NewForward ¶
func NewForward(chatID int64, fromChatID int64, messageID int) ForwardConfig
NewForward creates a new forward.
chatID is where to send it, fromChatID is the source chat, and messageID is the ID of the original message.
func (*ForwardConfig) MarshalJSON ¶
func (j *ForwardConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*ForwardConfig) MarshalJSONBuf ¶
func (j *ForwardConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*ForwardConfig) UnmarshalJSON ¶
func (j *ForwardConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*ForwardConfig) UnmarshalJSONFFLexer ¶
func (j *ForwardConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type GroupChat ¶
GroupChat is a group chat.
func (*GroupChat) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*GroupChat) MarshalJSONBuf ¶
func (j *GroupChat) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*GroupChat) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*GroupChat) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type InlineConfig ¶
type InlineConfig struct { InlineQueryID string `json:"inline_query_id"` Results []interface{} `json:"results,omitempty"` CacheTime int `json:"cache_time"` 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"` }
InlineConfig contains information on making an InlineQuery response.
func (*InlineConfig) MarshalJSON ¶
func (j *InlineConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*InlineConfig) MarshalJSONBuf ¶
func (j *InlineConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*InlineConfig) UnmarshalJSON ¶
func (j *InlineConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*InlineConfig) UnmarshalJSONFFLexer ¶
func (j *InlineConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
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"` // we use pointer as empty string is non zero value in this case SwitchInlineQueryCurrentChat *string `json:"switch_inline_query_current_chat,omitempty"` // we use pointer as empty string is non zero value in this case Pay bool `json:"pay,omitempty"` }
InlineKeyboardButton is a button within a custom keyboard for inline query responses.
Note that some values are references as even an empty string will change behavior.
func NewInlineKeyboardButtonData ¶
func NewInlineKeyboardButtonData(text, data string) InlineKeyboardButton
NewInlineKeyboardButtonData creates an inline keyboard button with text and data for a callback.
func NewInlineKeyboardButtonSwitchInlineQuery ¶
func NewInlineKeyboardButtonSwitchInlineQuery(text, query string) InlineKeyboardButton
NewInlineKeyboardButtonSwitchInlineQuery creates an inline keyboard button with text which allows the user to switch to a chat or return to a chat.
func NewInlineKeyboardButtonSwitchInlineQueryCurrentChat ¶
func NewInlineKeyboardButtonSwitchInlineQueryCurrentChat(text, query string) InlineKeyboardButton
NewInlineKeyboardButtonSwitchInlineQueryCurrentChat create new command
func NewInlineKeyboardButtonURL ¶
func NewInlineKeyboardButtonURL(text, url string) InlineKeyboardButton
NewInlineKeyboardButtonURL creates an inline keyboard button with text which goes to a URL.
func NewInlineKeyboardRow ¶
func NewInlineKeyboardRow(buttons ...InlineKeyboardButton) []InlineKeyboardButton
NewInlineKeyboardRow creates an inline keyboard row with buttons.
func (*InlineKeyboardButton) MarshalJSON ¶
func (j *InlineKeyboardButton) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*InlineKeyboardButton) MarshalJSONBuf ¶
func (j *InlineKeyboardButton) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*InlineKeyboardButton) UnmarshalJSON ¶
func (j *InlineKeyboardButton) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*InlineKeyboardButton) UnmarshalJSONFFLexer ¶
func (j *InlineKeyboardButton) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type InlineKeyboardMarkup ¶
type InlineKeyboardMarkup struct {
InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
}
InlineKeyboardMarkup is a custom keyboard presented for an inline bot.
func NewInlineKeyboardMarkup ¶
func NewInlineKeyboardMarkup(rows ...[]InlineKeyboardButton) *InlineKeyboardMarkup
NewInlineKeyboardMarkup creates a new inline keyboard.
func (*InlineKeyboardMarkup) KeyboardType ¶
func (*InlineKeyboardMarkup) KeyboardType() botsfw.KeyboardType
KeyboardType returns KeyboardTypeInline
func (*InlineKeyboardMarkup) MarshalJSON ¶
func (j *InlineKeyboardMarkup) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*InlineKeyboardMarkup) MarshalJSONBuf ¶
func (j *InlineKeyboardMarkup) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*InlineKeyboardMarkup) UnmarshalJSON ¶
func (j *InlineKeyboardMarkup) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*InlineKeyboardMarkup) UnmarshalJSONFFLexer ¶
func (j *InlineKeyboardMarkup) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type InlineQuery ¶
type InlineQuery struct { ID string `json:"id"` From *User `json:"from"` Location *Location `json:"location,omitempty"` // optional Query string `json:"query"` Offset string `json:"offset"` }
InlineQuery is a Query from Telegram for an inline request.
func (*InlineQuery) MarshalJSON ¶
func (j *InlineQuery) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*InlineQuery) MarshalJSONBuf ¶
func (j *InlineQuery) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*InlineQuery) UnmarshalJSON ¶
func (j *InlineQuery) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*InlineQuery) UnmarshalJSONFFLexer ¶
func (j *InlineQuery) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type InlineQueryResultArticle ¶
type InlineQueryResultArticle struct { Type string `json:"type"` // required ID string `json:"id"` // required Title string `json:"title"` // required InputMessageContent interface{} `json:"input_message_content"` // required 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"` }
InlineQueryResultArticle is an inline query response article.
func NewInlineQueryResultArticle ¶
func NewInlineQueryResultArticle(id, title, messageText string) InlineQueryResultArticle
NewInlineQueryResultArticle creates a new inline query article.
func (*InlineQueryResultArticle) MarshalJSON ¶
func (j *InlineQueryResultArticle) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*InlineQueryResultArticle) MarshalJSONBuf ¶
func (j *InlineQueryResultArticle) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*InlineQueryResultArticle) UnmarshalJSON ¶
func (j *InlineQueryResultArticle) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*InlineQueryResultArticle) UnmarshalJSONFFLexer ¶
func (j *InlineQueryResultArticle) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type InlineQueryResultAudio ¶
type InlineQueryResultAudio struct { Type string `json:"type"` // required ID string `json:"id"` // required URL string `json:"audio_url"` // required Title string `json:"title"` // required Performer string `json:"performer"` Duration int `json:"audio_duration"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultAudio is an inline query response audio.
func NewInlineQueryResultAudio ¶
func NewInlineQueryResultAudio(id, url, title string) InlineQueryResultAudio
NewInlineQueryResultAudio creates a new inline query audio.
func (*InlineQueryResultAudio) MarshalJSON ¶
func (j *InlineQueryResultAudio) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*InlineQueryResultAudio) MarshalJSONBuf ¶
func (j *InlineQueryResultAudio) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*InlineQueryResultAudio) UnmarshalJSON ¶
func (j *InlineQueryResultAudio) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*InlineQueryResultAudio) UnmarshalJSONFFLexer ¶
func (j *InlineQueryResultAudio) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type InlineQueryResultDocument ¶
type InlineQueryResultDocument struct { Type string `json:"type"` // required ID string `json:"id"` // required Title string `json:"title"` // required Caption string `json:"caption"` URL string `json:"document_url"` // required MimeType string `json:"mime_type"` // required Description string `json:"description"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent interface{} `json:"input_message_content,omitempty"` ThumbURL string `json:"thumb_url"` ThumbWidth int `json:"thumb_width"` ThumbHeight int `json:"thumb_height"` }
InlineQueryResultDocument is an inline query response document.
func NewInlineQueryResultDocument ¶
func NewInlineQueryResultDocument(id, url, title, mimeType string) InlineQueryResultDocument
NewInlineQueryResultDocument creates a new inline query document.
func (*InlineQueryResultDocument) MarshalJSON ¶
func (j *InlineQueryResultDocument) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*InlineQueryResultDocument) MarshalJSONBuf ¶
func (j *InlineQueryResultDocument) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*InlineQueryResultDocument) UnmarshalJSON ¶
func (j *InlineQueryResultDocument) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*InlineQueryResultDocument) UnmarshalJSONFFLexer ¶
func (j *InlineQueryResultDocument) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type InlineQueryResultGIF ¶
type InlineQueryResultGIF struct { Type string `json:"type"` // required ID string `json:"id"` // required URL string `json:"gif_url"` // required Width int `json:"gif_width,omitempty"` Height int `json:"gif_height,omitempty"` ThumbURL string `json:"thumb_url,omitempty"` Title string `json:"title,omitempty"` Caption string `json:"caption,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultGIF is an inline query response GIF.
func NewInlineQueryResultGIF ¶
func NewInlineQueryResultGIF(id, url string) InlineQueryResultGIF
NewInlineQueryResultGIF creates a new inline query GIF.
func (*InlineQueryResultGIF) MarshalJSON ¶
func (j *InlineQueryResultGIF) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*InlineQueryResultGIF) MarshalJSONBuf ¶
func (j *InlineQueryResultGIF) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*InlineQueryResultGIF) UnmarshalJSON ¶
func (j *InlineQueryResultGIF) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*InlineQueryResultGIF) UnmarshalJSONFFLexer ¶
func (j *InlineQueryResultGIF) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type InlineQueryResultLocation ¶
type InlineQueryResultLocation struct { Type string `json:"type"` // required ID string `json:"id"` // required Latitude float64 `json:"latitude"` // required Longitude float64 `json:"longitude"` // required Title string `json:"title"` // required ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent interface{} `json:"input_message_content,omitempty"` ThumbURL string `json:"thumb_url"` ThumbWidth int `json:"thumb_width"` ThumbHeight int `json:"thumb_height"` }
InlineQueryResultLocation is an inline query response location.
func NewInlineQueryResultLocation ¶
func NewInlineQueryResultLocation(id, title string, latitude, longitude float64) InlineQueryResultLocation
NewInlineQueryResultLocation creates a new inline query location.
func (*InlineQueryResultLocation) MarshalJSON ¶
func (j *InlineQueryResultLocation) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*InlineQueryResultLocation) MarshalJSONBuf ¶
func (j *InlineQueryResultLocation) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*InlineQueryResultLocation) UnmarshalJSON ¶
func (j *InlineQueryResultLocation) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*InlineQueryResultLocation) UnmarshalJSONFFLexer ¶
func (j *InlineQueryResultLocation) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type InlineQueryResultMPEG4GIF ¶
type InlineQueryResultMPEG4GIF struct { Type string `json:"type"` // required ID string `json:"id"` // required URL string `json:"mpeg4_url"` // required Width int `json:"mpeg4_width"` Height int `json:"mpeg4_height"` ThumbURL string `json:"thumb_url"` Title string `json:"title"` Caption string `json:"caption"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultMPEG4GIF is an inline query response MPEG4 GIF.
func NewInlineQueryResultMPEG4GIF ¶
func NewInlineQueryResultMPEG4GIF(id, url string) InlineQueryResultMPEG4GIF
NewInlineQueryResultMPEG4GIF creates a new inline query MPEG4 GIF.
func (*InlineQueryResultMPEG4GIF) MarshalJSON ¶
func (j *InlineQueryResultMPEG4GIF) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*InlineQueryResultMPEG4GIF) MarshalJSONBuf ¶
func (j *InlineQueryResultMPEG4GIF) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*InlineQueryResultMPEG4GIF) UnmarshalJSON ¶
func (j *InlineQueryResultMPEG4GIF) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*InlineQueryResultMPEG4GIF) UnmarshalJSONFFLexer ¶
func (j *InlineQueryResultMPEG4GIF) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type InlineQueryResultPhoto ¶
type InlineQueryResultPhoto struct { Type string `json:"type"` // required ID string `json:"id"` // required URL string `json:"photo_url"` // required MimeType string `json:"mime_type,omitempty"` Width int `json:"photo_width,omitempty"` Height int `json:"photo_height,omitempty"` ThumbURL string `json:"thumb_url,omitempty"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` Caption string `json:"caption,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultPhoto is an inline query response photo.
func NewInlineQueryResultPhoto ¶
func NewInlineQueryResultPhoto(id, url string) InlineQueryResultPhoto
NewInlineQueryResultPhoto creates a new inline query photo.
func (*InlineQueryResultPhoto) MarshalJSON ¶
func (j *InlineQueryResultPhoto) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*InlineQueryResultPhoto) MarshalJSONBuf ¶
func (j *InlineQueryResultPhoto) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*InlineQueryResultPhoto) UnmarshalJSON ¶
func (j *InlineQueryResultPhoto) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*InlineQueryResultPhoto) UnmarshalJSONFFLexer ¶
func (j *InlineQueryResultPhoto) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type InlineQueryResultVideo ¶
type InlineQueryResultVideo struct { Type string `json:"type"` // required ID string `json:"id"` // required URL string `json:"video_url"` // required MimeType string `json:"mime_type"` // required ThumbURL string `json:"thumb_url"` Title string `json:"title"` Caption string `json:"caption"` Width int `json:"video_width"` Height int `json:"video_height"` Duration int `json:"video_duration"` Description string `json:"description"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultVideo is an inline query response video.
func NewInlineQueryResultVideo ¶
func NewInlineQueryResultVideo(id, url string) InlineQueryResultVideo
NewInlineQueryResultVideo creates a new inline query video.
func (*InlineQueryResultVideo) MarshalJSON ¶
func (j *InlineQueryResultVideo) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*InlineQueryResultVideo) MarshalJSONBuf ¶
func (j *InlineQueryResultVideo) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*InlineQueryResultVideo) UnmarshalJSON ¶
func (j *InlineQueryResultVideo) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*InlineQueryResultVideo) UnmarshalJSONFFLexer ¶
func (j *InlineQueryResultVideo) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type InlineQueryResultVoice ¶
type InlineQueryResultVoice struct { Type string `json:"type"` // required ID string `json:"id"` // required URL string `json:"voice_url"` // required Title string `json:"title"` // required Duration int `json:"voice_duration"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultVoice is an inline query response voice.
func NewInlineQueryResultVoice ¶
func NewInlineQueryResultVoice(id, url, title string) InlineQueryResultVoice
NewInlineQueryResultVoice creates a new inline query voice.
func (*InlineQueryResultVoice) MarshalJSON ¶
func (j *InlineQueryResultVoice) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*InlineQueryResultVoice) MarshalJSONBuf ¶
func (j *InlineQueryResultVoice) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*InlineQueryResultVoice) UnmarshalJSON ¶
func (j *InlineQueryResultVoice) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*InlineQueryResultVoice) UnmarshalJSONFFLexer ¶
func (j *InlineQueryResultVoice) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type InputContactMessageContent ¶
type InputContactMessageContent struct { PhoneNumber string `json:"phone_number"` FirstName string `json:"first_name"` LastName string `json:"last_name"` }
InputContactMessageContent contains a contact for displaying as an inline query result.
func (*InputContactMessageContent) MarshalJSON ¶
func (j *InputContactMessageContent) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*InputContactMessageContent) MarshalJSONBuf ¶
func (j *InputContactMessageContent) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*InputContactMessageContent) UnmarshalJSON ¶
func (j *InputContactMessageContent) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*InputContactMessageContent) UnmarshalJSONFFLexer ¶
func (j *InputContactMessageContent) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type InputLocationMessageContent ¶
type InputLocationMessageContent struct { Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` }
InputLocationMessageContent contains a location for displaying as an inline query result.
func (*InputLocationMessageContent) MarshalJSON ¶
func (j *InputLocationMessageContent) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*InputLocationMessageContent) MarshalJSONBuf ¶
func (j *InputLocationMessageContent) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*InputLocationMessageContent) UnmarshalJSON ¶
func (j *InputLocationMessageContent) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*InputLocationMessageContent) UnmarshalJSONFFLexer ¶
func (j *InputLocationMessageContent) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type InputTextMessageContent ¶
type InputTextMessageContent struct { Text string `json:"message_text"` ParseMode string `json:"parse_mode"` DisableWebPagePreview bool `json:"disable_web_page_preview"` }
InputTextMessageContent contains text for displaying as an inline query result.
func (*InputTextMessageContent) MarshalJSON ¶
func (j *InputTextMessageContent) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*InputTextMessageContent) MarshalJSONBuf ¶
func (j *InputTextMessageContent) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*InputTextMessageContent) UnmarshalJSON ¶
func (j *InputTextMessageContent) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*InputTextMessageContent) UnmarshalJSONFFLexer ¶
func (j *InputTextMessageContent) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type InputVenueMessageContent ¶
type InputVenueMessageContent struct { Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Title string `json:"title"` Address string `json:"address"` FoursquareID string `json:"foursquare_id"` }
InputVenueMessageContent contains a venue for displaying as an inline query result.
func (*InputVenueMessageContent) MarshalJSON ¶
func (j *InputVenueMessageContent) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*InputVenueMessageContent) MarshalJSONBuf ¶
func (j *InputVenueMessageContent) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*InputVenueMessageContent) UnmarshalJSON ¶
func (j *InputVenueMessageContent) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*InputVenueMessageContent) UnmarshalJSONFFLexer ¶
func (j *InputVenueMessageContent) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type KeyboardButton ¶
type KeyboardButton struct { Text string `json:"text"` RequestContact bool `json:"request_contact"` RequestLocation bool `json:"request_location"` }
KeyboardButton is a button within a custom keyboard.
func NewKeyboardButton ¶
func NewKeyboardButton(text string) KeyboardButton
NewKeyboardButton creates a regular keyboard button.
func NewKeyboardButtonContact ¶
func NewKeyboardButtonContact(text string) KeyboardButton
NewKeyboardButtonContact creates a keyboard button that requests user contact information upon click.
func NewKeyboardButtonLocation ¶
func NewKeyboardButtonLocation(text string) KeyboardButton
NewKeyboardButtonLocation creates a keyboard button that requests user location information upon click.
func NewKeyboardButtonRow ¶
func NewKeyboardButtonRow(buttons ...KeyboardButton) []KeyboardButton
NewKeyboardButtonRow creates a row of keyboard buttons.
func (*KeyboardButton) MarshalJSON ¶
func (j *KeyboardButton) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*KeyboardButton) MarshalJSONBuf ¶
func (j *KeyboardButton) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*KeyboardButton) UnmarshalJSON ¶
func (j *KeyboardButton) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*KeyboardButton) UnmarshalJSONFFLexer ¶
func (j *KeyboardButton) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type LeaveChatConfig ¶
type LeaveChatConfig struct {
// contains filtered or unexported fields
}
LeaveChatConfig is message command for leaving chat
func (*LeaveChatConfig) MarshalJSON ¶
func (j *LeaveChatConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*LeaveChatConfig) MarshalJSONBuf ¶
func (j *LeaveChatConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*LeaveChatConfig) UnmarshalJSON ¶
func (j *LeaveChatConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*LeaveChatConfig) UnmarshalJSONFFLexer ¶
func (j *LeaveChatConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type Location ¶
Location contains information about a place.
func (*Location) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Location) MarshalJSONBuf ¶
func (j *Location) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*Location) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*Location) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type LocationConfig ¶
LocationConfig contains information about a SendLocation request.
func NewLocation ¶
func NewLocation(chatID int64, latitude float64, longitude float64) LocationConfig
NewLocation shares your location.
chatID is where to send it, latitude and longitude are coordinates.
func (*LocationConfig) MarshalJSON ¶
func (j *LocationConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*LocationConfig) MarshalJSONBuf ¶
func (j *LocationConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*LocationConfig) UnmarshalJSON ¶
func (j *LocationConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*LocationConfig) UnmarshalJSONFFLexer ¶
func (j *LocationConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type Message ¶
type Message struct { MessageID int `json:"message_id"` From *User `json:"from,omitempty"` // optional Date int `json:"date"` Chat *Chat `json:"chat,omitempty"` ForwardFrom *User `json:"forward_from,omitempty"` // optional ForwardDate int `json:"forward_date,omitempty"` // optional ReplyToMessage *Message `json:"reply_to_message,omitempty"` // optional Text string `json:"text,omitempty"` // optional Entities *[]MessageEntity `json:"entities,omitempty"` // optional Audio *Audio `json:"audio,omitempty"` // optional Document *Document `json:"document,omitempty"` // optional Photo *[]PhotoSize `json:"photo,omitempty"` // optional Sticker *Sticker `json:"sticker,omitempty"` // optional Video *Video `json:"video,omitempty"` // optional Voice *Voice `json:"voice,omitempty"` // optional Caption string `json:"caption,omitempty"` // optional Contact *Contact `json:"contact,omitempty"` // optional Location *Location `json:"location,omitempty"` // optional Venue *Venue `json:"venue,omitempty"` // optional NewChatParticipant *ChatMember `json:"new_chat_participant,omitempty"` // Obsolete NewChatMember *ChatMember `json:"new_chat_member,omitempty"` // Obsolete NewChatMembers []ChatMember `json:"new_chat_members,omitempty"` // optional LeftChatMember *ChatMember `json:"left_chat_member,omitempty"` // optional NewChatTitle string `json:"new_chat_title,omitempty"` // optional NewChatPhoto *[]PhotoSize `json:"new_chat_photo,omitempty"` // optional DeleteChatPhoto bool `json:"delete_chat_photo,omitempty"` // optional GroupChatCreated bool `json:"group_chat_created,omitempty"` // optional SuperGroupChatCreated bool `json:"supergroup_chat_created,omitempty"` // optional ChannelChatCreated bool `json:"channel_chat_created,omitempty"` // optional MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"` // optional MigrateFromChatID int64 `json:"migrate_from_chat_id,omitempty"` // optional PinnedMessage *Message `json:"pinned_message,omitempty"` // optional }
Message is returned by almost every request, and contains data about almost anything.
func (*Message) Command ¶
Command checks if the message was a command and if it was, returns the command. If the Message was not a command, it returns an empty string.
If the command contains the at bot syntax, it removes the bot name.
func (*Message) CommandArguments ¶
CommandArguments checks if the message was a command and if it was, returns all text after the command name. If the Message was not a command, it returns an empty string.
func (*Message) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Message) MarshalJSONBuf ¶
func (j *Message) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*Message) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*Message) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type MessageConfig ¶
type MessageConfig struct { BaseChat Text string ParseMode string `json:"parse_mode,omitempty"` DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"` }
MessageConfig contains information about a SendMessage request.
func NewMessage ¶
func NewMessage(chatID int64, text string) MessageConfig
NewMessage creates a new Message.
chatID is where to send it, text is the message text.
func NewMessageToChannel ¶
func NewMessageToChannel(username string, text string) MessageConfig
NewMessageToChannel creates a new Message that is sent to a channel by username. username is the username of the channel, text is the message text.
func (*MessageConfig) MarshalJSON ¶
func (j *MessageConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*MessageConfig) MarshalJSONBuf ¶
func (j *MessageConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*MessageConfig) UnmarshalJSON ¶
func (j *MessageConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*MessageConfig) UnmarshalJSONFFLexer ¶
func (j *MessageConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type MessageEntity ¶
type MessageEntity struct { Type string `json:"type"` Offset int `json:"offset"` Length int `json:"length"` URL string `json:"url,omitempty"` // optional }
MessageEntity contains information about data in a Message.
func (*MessageEntity) MarshalJSON ¶
func (j *MessageEntity) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*MessageEntity) MarshalJSONBuf ¶
func (j *MessageEntity) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (MessageEntity) ParseURL ¶
func (entity MessageEntity) ParseURL() (*url.URL, error)
ParseURL attempts to parse a URL contained within a MessageEntity.
func (*MessageEntity) UnmarshalJSON ¶
func (j *MessageEntity) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*MessageEntity) UnmarshalJSONFFLexer ¶
func (j *MessageEntity) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type PhotoConfig ¶
PhotoConfig contains information about a SendPhoto request.
func NewPhotoShare ¶
func NewPhotoShare(chatID int64, fileID string) PhotoConfig
NewPhotoShare shares an existing photo. You may use this to reshare an existing photo without reuploading it.
chatID is where to send it, fileID is the ID of the file already uploaded.
func NewPhotoUpload ¶
func NewPhotoUpload(chatID int64, file interface{}) PhotoConfig
NewPhotoUpload creates a new photo uploader.
chatID is where to send it, file is a string path to the file, FileReader, or FileBytes.
Note that you must send animated GIFs as a document.
func (*PhotoConfig) MarshalJSON ¶
func (j *PhotoConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*PhotoConfig) MarshalJSONBuf ¶
func (j *PhotoConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*PhotoConfig) UnmarshalJSON ¶
func (j *PhotoConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*PhotoConfig) UnmarshalJSONFFLexer ¶
func (j *PhotoConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type PhotoSize ¶
type PhotoSize struct { FileID string `json:"file_id"` Width int `json:"width"` Height int `json:"height"` FileSize int `json:"file_size,omitempty"` // optional }
PhotoSize contains information about photos.
func (*PhotoSize) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*PhotoSize) MarshalJSONBuf ¶
func (j *PhotoSize) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*PhotoSize) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*PhotoSize) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type ReplyKeyboardHide ¶
type ReplyKeyboardHide struct { HideKeyboard bool `json:"hide_keyboard"` Selective bool `json:"selective,omitempty"` // optional }
ReplyKeyboardHide allows the Bot to hide a custom keyboard.
func NewHideKeyboard ¶
func NewHideKeyboard(selective bool) *ReplyKeyboardHide
NewHideKeyboard hides the keyboard, with the option for being selective or hiding for everyone.
func (ReplyKeyboardHide) KeyboardType ¶
func (ReplyKeyboardHide) KeyboardType() botsfw.KeyboardType
KeyboardType returns KeyboardTypeHide
func (*ReplyKeyboardHide) MarshalJSON ¶
func (j *ReplyKeyboardHide) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*ReplyKeyboardHide) MarshalJSONBuf ¶
func (j *ReplyKeyboardHide) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*ReplyKeyboardHide) UnmarshalJSON ¶
func (j *ReplyKeyboardHide) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*ReplyKeyboardHide) UnmarshalJSONFFLexer ¶
func (j *ReplyKeyboardHide) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type ReplyKeyboardMarkup ¶
type ReplyKeyboardMarkup struct { Keyboard [][]KeyboardButton `json:"keyboard"` ResizeKeyboard bool `json:"resize_keyboard,omitempty"` // optional OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"` // optional Selective bool `json:"selective,omitempty"` // optional }
ReplyKeyboardMarkup allows the Bot to set a custom keyboard.
func NewReplyKeyboard ¶
func NewReplyKeyboard(rows ...[]KeyboardButton) *ReplyKeyboardMarkup
NewReplyKeyboard creates a new regular keyboard with sane defaults.
func NewReplyKeyboardUsingStrings ¶
func NewReplyKeyboardUsingStrings(buttons [][]string) *ReplyKeyboardMarkup
NewReplyKeyboardUsingStrings creates reply keyboard from strings arrays
func (*ReplyKeyboardMarkup) KeyboardType ¶
func (*ReplyKeyboardMarkup) KeyboardType() botsfw.KeyboardType
KeyboardType returns KeyboardTypeBottom
func (*ReplyKeyboardMarkup) MarshalJSON ¶
func (j *ReplyKeyboardMarkup) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*ReplyKeyboardMarkup) MarshalJSONBuf ¶
func (j *ReplyKeyboardMarkup) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*ReplyKeyboardMarkup) UnmarshalJSON ¶
func (j *ReplyKeyboardMarkup) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*ReplyKeyboardMarkup) UnmarshalJSONFFLexer ¶
func (j *ReplyKeyboardMarkup) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type Sticker ¶
type Sticker struct { FileID string `json:"file_id"` Width int `json:"width"` Height int `json:"height"` Thumbnail *PhotoSize `json:"thumb,omitempty"` // optional FileSize int `json:"file_size,omitempty"` // optional }
Sticker contains information about a sticker.
func (*Sticker) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Sticker) MarshalJSONBuf ¶
func (j *Sticker) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*Sticker) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*Sticker) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type StickerConfig ¶
type StickerConfig struct {
BaseFile
}
StickerConfig contains information about a SendSticker request.
func NewStickerShare ¶
func NewStickerShare(chatID int64, fileID string) StickerConfig
NewStickerShare shares an existing sticker. You may use this to reshare an existing sticker without reuploading it.
chatID is where to send it, fileID is the ID of the sticker already uploaded.
func NewStickerUpload ¶
func NewStickerUpload(chatID int64, file interface{}) StickerConfig
NewStickerUpload creates a new sticker uploader.
chatID is where to send it, file is a string path to the file, FileReader, or FileBytes.
func (*StickerConfig) MarshalJSON ¶
func (j *StickerConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*StickerConfig) MarshalJSONBuf ¶
func (j *StickerConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*StickerConfig) UnmarshalJSON ¶
func (j *StickerConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*StickerConfig) UnmarshalJSONFFLexer ¶
func (j *StickerConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type Update ¶
type Update struct { UpdateID int `json:"update_id"` Message *Message `json:"message"` EditedMessage *Message `json:"edited_message"` ChannelPost *Message `json:"channel_post"` EditedChannelPost *Message `json:"edited_channel_post"` InlineQuery *InlineQuery `json:"inline_query"` ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result"` CallbackQuery *CallbackQuery `json:"callback_query"` }
Update is an update response, from GetUpdates.
func (*Update) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Update) MarshalJSONBuf ¶
func (j *Update) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*Update) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*Update) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type UpdateConfig ¶
UpdateConfig contains information about a GetUpdates request.
func NewUpdate ¶
func NewUpdate(offset int) UpdateConfig
NewUpdate gets updates since the last Offset.
offset is the last Update ID to include. You likely want to set this to the last Update ID plus 1.
func (*UpdateConfig) MarshalJSON ¶
func (j *UpdateConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*UpdateConfig) MarshalJSONBuf ¶
func (j *UpdateConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*UpdateConfig) UnmarshalJSON ¶
func (j *UpdateConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*UpdateConfig) UnmarshalJSONFFLexer ¶
func (j *UpdateConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type User ¶
type User struct { ID int `json:"id"` FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omitempty"` // optional UserName string `json:"username,omitempty"` // optional LanguageCode string `json:"language_code,omitempty"` // optional }
User is a user on Telegram.
func (User) GetFirstName ¶
GetFirstName returns first name of the user
func (User) GetFullName ¶
GetFullName returns full name of the user
func (User) GetLanguage ¶
GetLanguage returns preferred language of the user
func (User) GetLastName ¶
GetLastName returns last name of the user
func (User) GetUserName ¶
GetUserName returns user name of the user
func (*User) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*User) MarshalJSONBuf ¶
func (j *User) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*User) String ¶
String displays a simple text version of a user.
It is normally a user's username, but falls back to a first/last name as available.
func (*User) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*User) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type UserProfilePhotos ¶
type UserProfilePhotos struct { TotalCount int `json:"total_count"` Photos [][]PhotoSize `json:"photos"` }
UserProfilePhotos contains a set of user profile photos.
func (*UserProfilePhotos) MarshalJSON ¶
func (j *UserProfilePhotos) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*UserProfilePhotos) MarshalJSONBuf ¶
func (j *UserProfilePhotos) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*UserProfilePhotos) UnmarshalJSON ¶
func (j *UserProfilePhotos) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*UserProfilePhotos) UnmarshalJSONFFLexer ¶
func (j *UserProfilePhotos) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type UserProfilePhotosConfig ¶
UserProfilePhotosConfig contains information about a GetUserProfilePhotos request.
func NewUserProfilePhotos ¶
func NewUserProfilePhotos(userID int) UserProfilePhotosConfig
NewUserProfilePhotos gets user profile photos.
userID is the ID of the user you wish to get profile photos from.
func (*UserProfilePhotosConfig) MarshalJSON ¶
func (j *UserProfilePhotosConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*UserProfilePhotosConfig) MarshalJSONBuf ¶
func (j *UserProfilePhotosConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*UserProfilePhotosConfig) UnmarshalJSON ¶
func (j *UserProfilePhotosConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*UserProfilePhotosConfig) UnmarshalJSONFFLexer ¶
func (j *UserProfilePhotosConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type Venue ¶
type Venue struct { Location Location `json:"location"` Title string `json:"title"` Address string `json:"address"` FoursquareID string `json:"foursquare_id,omitempty"` // optional }
Venue contains information about a venue, including its Location.
func (*Venue) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Venue) MarshalJSONBuf ¶
func (j *Venue) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*Venue) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*Venue) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type VenueConfig ¶
type VenueConfig struct { BaseChat Latitude float64 // required Longitude float64 // required Title string // required Address string // required FoursquareID string }
VenueConfig contains information about a SendVenue request.
func NewVenue ¶
func NewVenue(chatID int64, title, address string, latitude, longitude float64) VenueConfig
NewVenue allows you to send a venue and its location.
func (*VenueConfig) MarshalJSON ¶
func (j *VenueConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*VenueConfig) MarshalJSONBuf ¶
func (j *VenueConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*VenueConfig) UnmarshalJSON ¶
func (j *VenueConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*VenueConfig) UnmarshalJSONFFLexer ¶
func (j *VenueConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type Video ¶
type Video struct { FileID string `json:"file_id"` Width int `json:"width"` Height int `json:"height"` Duration int `json:"duration"` Thumbnail *PhotoSize `json:"thumb,omitempty"` // optional MimeType string `json:"mime_type,omitempty"` // optional FileSize int `json:"file_size,omitempty"` // optional }
Video contains information about a video.
func (*Video) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Video) MarshalJSONBuf ¶
func (j *Video) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*Video) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*Video) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type VideoConfig ¶
VideoConfig contains information about a SendVideo request.
func NewVideoShare ¶
func NewVideoShare(chatID int64, fileID string) VideoConfig
NewVideoShare shares an existing video. You may use this to reshare an existing video without reuploading it.
chatID is where to send it, fileID is the ID of the video already uploaded.
func NewVideoUpload ¶
func NewVideoUpload(chatID int64, file interface{}) VideoConfig
NewVideoUpload creates a new video uploader.
chatID is where to send it, file is a string path to the file, FileReader, or FileBytes.
func (*VideoConfig) MarshalJSON ¶
func (j *VideoConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*VideoConfig) MarshalJSONBuf ¶
func (j *VideoConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*VideoConfig) UnmarshalJSON ¶
func (j *VideoConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*VideoConfig) UnmarshalJSONFFLexer ¶
func (j *VideoConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type Voice ¶
type Voice struct { FileID string `json:"file_id"` Duration int `json:"duration"` MimeType string `json:"mime_type,omitempty"` // optional FileSize int `json:"file_size,omitempty"` // optional }
Voice contains information about a voice.
func (*Voice) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Voice) MarshalJSONBuf ¶
func (j *Voice) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*Voice) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*Voice) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type VoiceConfig ¶
VoiceConfig contains information about a SendVoice request.
func NewVoiceShare ¶
func NewVoiceShare(chatID int64, fileID string) VoiceConfig
NewVoiceShare shares an existing voice. You may use this to reshare an existing voice without reuploading it.
chatID is where to send it, fileID is the ID of the video already uploaded.
func NewVoiceUpload ¶
func NewVoiceUpload(chatID int64, file interface{}) VoiceConfig
NewVoiceUpload creates a new voice uploader.
chatID is where to send it, file is a string path to the file, FileReader, or FileBytes.
func (*VoiceConfig) MarshalJSON ¶
func (j *VoiceConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*VoiceConfig) MarshalJSONBuf ¶
func (j *VoiceConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*VoiceConfig) UnmarshalJSON ¶
func (j *VoiceConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*VoiceConfig) UnmarshalJSONFFLexer ¶
func (j *VoiceConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type WebhookConfig ¶
type WebhookConfig struct { URL *url.URL Certificate interface{} MaxConnections int AllowedUpdates []string }
WebhookConfig contains information about a SetWebhook request.
func NewWebhook ¶
func NewWebhook(link string) WebhookConfig
NewWebhook creates a new webhook.
link is the url parsable link you wish to get the updates.
Example ¶
bot := NewBotAPI("MyAwesomeBotToken") log.Printf("Authorized on account %s", bot.Self.UserName) _, err := bot.SetWebhook(NewWebhookWithCert("https://www.google.com:8443/"+bot.Token, "cert.pem")) if err != nil { log.Fatal(err) } updates := bot.ListenForWebhook("/" + bot.Token) go func() { err := http.ListenAndServeTLS("0.0.0.0:8443", "cert.pem", "key.pem", nil) if err != nil { log.Fatal(err) } }() for update := range updates { log.Printf("%+v\n", update) }
Output:
func NewWebhookWithCert ¶
func NewWebhookWithCert(link string, file interface{}) WebhookConfig
NewWebhookWithCert creates a new webhook with a certificate.
link is the url you wish to get webhooks, file contains a string to a file, FileReader, or FileBytes.
func (*WebhookConfig) MarshalJSON ¶
func (j *WebhookConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*WebhookConfig) MarshalJSONBuf ¶
func (j *WebhookConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*WebhookConfig) UnmarshalJSON ¶
func (j *WebhookConfig) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*WebhookConfig) UnmarshalJSONFFLexer ¶
func (j *WebhookConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson