tgbotapi

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: Apache-2.0, MIT Imports: 19 Imported by: 1

Documentation

Overview

Package tgbotapi has functions and types used for interacting with the Telegram Bot API.

Index

Examples

Constants

View Source
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

View Source
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

View Source
const (
	// ModeMarkdown indicates markdown mode
	ModeMarkdown = "Markdown"

	// ModeHTML indicates HTML mode
	ModeHTML = "HTML"
)

Constant values for ParseMode in MessageConfig

Variables

View Source
var (
	// ErrBadFileType happens when you pass an unknown type
	ErrBadFileType = errors.New("bad file type")

	// ErrBadURL indicates bad or empty URL
	ErrBadURL = errors.New("bad or empty URL")
)

Library errors

View Source
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

func (AnswerCallbackQueryConfig) Values

func (j AnswerCallbackQueryConfig) Values() (url.Values, error)

Values returns URL values representation of AnswerCallbackQueryConfig

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

func (j *Audio) MarshalJSON() ([]byte, error)

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

func (j *Audio) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Audio) UnmarshalJSONFFLexer

func (j *Audio) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type AudioConfig

type AudioConfig struct {
	BaseFile
	Duration  int
	Performer string
	Title     string
}

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

func (AudioConfig) Values

func (j AudioConfig) Values() (url.Values, error)

Values returns url.Values representation of AudioConfig.

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

func (j *BaseChat) MarshalJSON() ([]byte, error)

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

func (j *BaseChat) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*BaseChat) UnmarshalJSONFFLexer

func (j *BaseChat) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

func (BaseChat) Values

func (j BaseChat) Values() (url.Values, error)

Values returns url.Values representation of BaseChat

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

func NewChatMessageEdit(chatID int64, messageID int) BaseEdit

NewChatMessageEdit returns BaseEdit

func (*BaseEdit) MarshalJSON

func (j *BaseEdit) MarshalJSON() ([]byte, error)

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

func (j *BaseEdit) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*BaseEdit) UnmarshalJSONFFLexer

func (j *BaseEdit) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

func (BaseEdit) Values

func (v BaseEdit) Values() (url.Values, error)

Values returns URL values

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

func (j *BaseFile) MarshalJSON() ([]byte, error)

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

func (j *BaseFile) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*BaseFile) UnmarshalJSONFFLexer

func (j *BaseFile) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

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

func NewBotAPI(token string) *BotAPI

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)
	}
}

func NewBotAPIWithClient

func NewBotAPIWithClient(token string, client *http.Client) *BotAPI

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) DeleteMessage added in v0.9.0

func (bot *BotAPI) DeleteMessage(chatID string, messageID int) (apiResp APIResponse, err error)

func (*BotAPI) EnableDebug

func (bot *BotAPI) EnableDebug(c context.Context)

EnableDebug enables debugging

func (*BotAPI) GetChat

func (bot *BotAPI) GetChat(chatID string) (Chat, error)

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

func (bot *BotAPI) GetFileDirectURL(fileID string) (string, error)

GetFileDirectURL returns direct URL to file

It requires the FileID.

func (*BotAPI) GetMe

func (bot *BotAPI) GetMe() (User, error)

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

func (bot *BotAPI) IsMessageToMe(message Message) bool

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

func (bot *BotAPI) ListenForWebhook(pattern string) <-chan Update

ListenForWebhook registers a http handler for a webhook.

func (*BotAPI) MakeRequest

func (bot *BotAPI) MakeRequest(endpoint string, params url.Values) (apiResp APIResponse, err error)

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

func (bot *BotAPI) Send(c Chattable) (Message, error)

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{}) (apiResp APIResponse, err 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 CallbackGame added in v0.6.0

type CallbackGame struct {
}

CallbackGame is a placeholder, currently holds no information. Use BotFather to set up your game.

func (*CallbackGame) MarshalJSON added in v0.6.1

func (j *CallbackGame) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*CallbackGame) MarshalJSONBuf added in v0.6.1

func (j *CallbackGame) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*CallbackGame) UnmarshalJSON added in v0.6.1

func (j *CallbackGame) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*CallbackGame) UnmarshalJSONFFLexer added in v0.6.1

func (j *CallbackGame) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

func (CallbackGame) Validate added in v0.10.0

func (v CallbackGame) Validate() error

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) IsChannel

func (c *Chat) IsChannel() bool

IsChannel returns if the Chat is a channel.

func (*Chat) IsGroup

func (c *Chat) IsGroup() bool

IsGroup returns if the Chat is a group.

func (*Chat) IsPrivate

func (c *Chat) IsPrivate() bool

IsPrivate returns if the Chat is a private conversation.

func (*Chat) IsSuperGroup

func (c *Chat) IsSuperGroup() bool

IsSuperGroup returns if the Chat is a supergroup.

func (*Chat) MarshalJSON

func (j *Chat) MarshalJSON() ([]byte, error)

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

func (j *Chat) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Chat) UnmarshalJSONFFLexer

func (j *Chat) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type ChatActionConfig

type ChatActionConfig struct {
	BaseChat
	Action string // required
}

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

func (ChatActionConfig) Values

func (config ChatActionConfig) Values() (url.Values, error)

Values returns url.Values representation of ChatActionConfig.

type ChatAdministratorRights added in v0.5.0

type ChatAdministratorRights struct {
	// True, if the user's presence in the chat is hidden
	IsAnonymous bool `json:"is_anonymous,omitempty"`
}

func (*ChatAdministratorRights) MarshalJSON added in v0.6.1

func (j *ChatAdministratorRights) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*ChatAdministratorRights) MarshalJSONBuf added in v0.6.1

func (j *ChatAdministratorRights) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*ChatAdministratorRights) UnmarshalJSON added in v0.6.1

func (j *ChatAdministratorRights) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*ChatAdministratorRights) UnmarshalJSONFFLexer added in v0.6.1

func (j *ChatAdministratorRights) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type ChatMember

type ChatMember struct {
	User
	IsBot bool `json:"is_bot,omitempty"`
}

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

type ChatMemberConfig struct {
	ChatID             int64
	SuperGroupUsername string
	UserID             int
}

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 must always be presented
	PhoneNumber string `json:"phone_number"`

	// FirstName must always be presented
	FirstName string `json:"first_name"`

	// Optional
	LastName string `json:"last_name,omitempty"` // optional

	// UserID (optional) is a Contact's user identifier in Telegram.
	// It has at most 52 significant bits,
	// so a 64-bit integer or double-precision float type are safe for storing this identifier.
	UserID int64 `json:"user_id,omitempty"` // optional

	// VCard (optional) additional data about the contact in the form of https://en.wikipedia.org/wiki/VCard
	VCard string `json:"vcard,omitempty"`
}

Contact contains information about a contact. Note that LastName, UserID, VCard may be empty.

func (*Contact) MarshalJSON

func (j *Contact) MarshalJSON() ([]byte, error)

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

func (j *Contact) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Contact) UnmarshalJSONFFLexer

func (j *Contact) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type ContactConfig

type ContactConfig struct {
	BaseChat
	PhoneNumber string
	FirstName   string
	LastName    string
}

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

func (ContactConfig) Values

func (j ContactConfig) Values() (url.Values, error)

Values returns URL values representation of ContactConfig

type CopyTextButton added in v0.11.0

type CopyTextButton struct {
	Text string `json:"text"`
}

CopyTextButton represents an inline keyboard button that copies specified text to the clipboard.

func (*CopyTextButton) MarshalJSON added in v0.11.0

func (j *CopyTextButton) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*CopyTextButton) MarshalJSONBuf added in v0.11.0

func (j *CopyTextButton) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*CopyTextButton) UnmarshalJSON added in v0.11.0

func (j *CopyTextButton) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*CopyTextButton) UnmarshalJSONFFLexer added in v0.11.0

func (j *CopyTextButton) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

func (CopyTextButton) Validate added in v0.11.0

func (v CopyTextButton) Validate() error

type DeleteMessage

type DeleteMessage chatEdit

DeleteMessage is a command to delete a message. It should not be used with SendMessage() Instead use BotAPI.DeleteMessage(chatID string, messageID int)

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

func (DeleteMessage) Values

func (m DeleteMessage) Values() (url.Values, error)

Values returns URL values representation of DeleteMessage

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

func (j *Document) MarshalJSON() ([]byte, error)

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

func (j *Document) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Document) UnmarshalJSONFFLexer

func (j *Document) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

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

func (DocumentConfig) Values

func (v DocumentConfig) Values() (url.Values, error)

Values returns url.Values representation of DocumentConfig.

type EditMessageCaptionConfig

type EditMessageCaptionConfig struct {
	BaseEdit
	Caption string
}

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

func (EditMessageCaptionConfig) Values

func (j EditMessageCaptionConfig) Values() (url.Values, error)

Values returns URL values representation of EditMessageCaptionConfig

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

func (EditMessageReplyMarkupConfig) Values

func (config EditMessageReplyMarkupConfig) Values() (url.Values, error)

Values returns URL values representation of EditMessageReplyMarkupConfig

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

func (EditMessageTextConfig) Values

func (j EditMessageTextConfig) Values() (url.Values, error)

Values returns URL values representation of EditMessageTextConfig

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() bool

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 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

func (ExportChatInviteLink) Values

func (v ExportChatInviteLink) Values() (url.Values, error)

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 (f *File) Link(token string) string

Link returns a full path to the download URL for a File.

It requires the Bot Token to create the link.

func (*File) MarshalJSON

func (j *File) MarshalJSON() ([]byte, error)

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

func (j *File) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*File) UnmarshalJSONFFLexer

func (j *File) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type FileBytes

type FileBytes struct {
	Name  string
	Bytes []byte
}

FileBytes contains information about a set of bytes to upload as a File.

func (*FileBytes) MarshalJSON

func (j *FileBytes) MarshalJSON() ([]byte, error)

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

func (j *FileBytes) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*FileBytes) UnmarshalJSONFFLexer

func (j *FileBytes) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

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

type FileReader struct {
	Name   string
	Reader io.Reader
	Size   int64
}

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() botsgocore.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

func (ForwardConfig) Values

func (v ForwardConfig) Values() (url.Values, error)

Values returns url.Values representation of ForwardConfig.

type FoursquareFields added in v0.10.0

type FoursquareFields struct {

	// Optional. Foursquare identifier of the venue if known
	FoursquareID string `json:"foursquare_id,omitempty"`

	// Optional. Foursquare type of the venue, if known.
	// (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
	FoursquareType string `json:"foursquare_type,omitempty"`
}

func (*FoursquareFields) MarshalJSON added in v0.10.0

func (j *FoursquareFields) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*FoursquareFields) MarshalJSONBuf added in v0.10.0

func (j *FoursquareFields) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*FoursquareFields) UnmarshalJSON added in v0.10.0

func (j *FoursquareFields) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*FoursquareFields) UnmarshalJSONFFLexer added in v0.10.0

func (j *FoursquareFields) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type GooglePlaceFields added in v0.10.0

type GooglePlaceFields struct {
	// Optional. Google Places identifier of the venue
	GooglePlaceID string `json:"google_place_id,omitempty"`
	// Optional. Google Places type of the venue.
	// https://developers.google.com/maps/documentation/places/web-service/supported_types
	GooglePlaceType string `json:"google_place_type,omitempty"`
}

func (*GooglePlaceFields) MarshalJSON added in v0.10.0

func (j *GooglePlaceFields) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*GooglePlaceFields) MarshalJSONBuf added in v0.10.0

func (j *GooglePlaceFields) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*GooglePlaceFields) UnmarshalJSON added in v0.10.0

func (j *GooglePlaceFields) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*GooglePlaceFields) UnmarshalJSONFFLexer added in v0.10.0

func (j *GooglePlaceFields) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type GroupChat

type GroupChat struct {
	ID    int    `json:"id"`
	Title string `json:"title"`
}

GroupChat is a group chat.

func (*GroupChat) MarshalJSON

func (j *GroupChat) MarshalJSON() ([]byte, error)

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

func (j *GroupChat) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*GroupChat) UnmarshalJSONFFLexer

func (j *GroupChat) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type InlineConfig

type InlineConfig struct {
	InlineQueryID string `json:"inline_query_id"`

	Results []InlineQueryResult `json:"results,omitempty"`

	// Optional.
	// The maximum amount of time in seconds that the result of the inline query may be cached on the server.
	// Defaults to 300.
	CacheTime int `json:"cache_time"`

	// Optional	Pass True if results may be cached on the server side only for the user that sent the query.
	// By default, results may be returned to any user who sends the same query.
	IsPersonal bool `json:"is_personal,omitempty"`

	// Optional.
	// Pass the offset that a client should send in the next query with the same text to receive more results.
	// Pass an empty string if there are no more results or if you don't support pagination.
	// Offset length can't exceed 64 bytes.
	NextOffset string `json:"next_offset,omitempty"`

	Button *InlineQueryResultsButton `json:"button,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

func (InlineConfig) Values

func (config InlineConfig) Values() (url.Values, error)

Values returns URL values representation of InlineConfig

type InlineKeyboardButton

type InlineKeyboardButton struct {

	// Label text on the button
	Text string `json:"text"`

	// Optional.
	// HTTP or tg:// URL to be opened when the button is pressed.
	// Links tg://user?id=<user_id> can be used to mention a user by their identifier without using a username,
	// if this is allowed by their privacy settings.
	URL string `json:"url,omitempty"`

	// Optional. Data to be sent in a callback query to the bot when the button is pressed, 1-64 bytes
	CallbackData string `json:"callback_data,omitempty"`

	// Optional. Description of the Web App that will be launched when the user presses the button.
	// The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery.
	// Available only in private chats between a user and the bot. Not supported for messages sent on behalf of a Telegram Business account.
	WebApp *WebAppInfo `json:"web_app,omitempty"`

	// Optional. An HTTPS URL used to automatically authorize the user.
	// Can be used as a replacement for the Telegram Login Widget.
	LoginUrl *LoginUrl `json:"login_url,omitempty"`

	// Optional. If set, pressing the button will prompt the user to select one of their chats,
	// open that chat and insert the bot's username and the specified inline query in the input field.
	// May be empty, in which case just the bot's username will be inserted.
	// Not supported for messages sent on behalf of a Telegram Business account.
	SwitchInlineQuery *string `json:"switch_inline_query,omitempty"` // we use pointer as empty string is non zero value in this case

	// Optional. If set, pressing the button will insert the bot's username
	// and the specified inline query in the current chat's input field.
	// May be empty, in which case only the bot's username will be inserted.
	//
	// This offers a quick way for the user to open your bot
	// in inline mode in the same chat - good for selecting something from multiple options.
	// Not supported in channels and for messages sent on behalf of a Telegram Business account.
	SwitchInlineQueryCurrentChat *string `json:"switch_inline_query_current_chat,omitempty"` // we use pointer as empty string is non zero value in this case

	// Optional. If set, pressing the button will prompt the user to select one of their chats of the specified type,
	// open that chat and insert the bot's username and the specified inline query in the input field.
	// Not supported for messages sent on behalf of a Telegram Business account.
	SwitchInlineQueryChosenChat *SwitchInlineQueryChosenChat `json:"switch_inline_query_chosen_chat,omitempty"`

	CopyText *CopyTextButton `json:"copy_text,omitempty"`

	// Optional. Description of the game that will be launched when the user presses the button.
	//
	//NOTE: This type of button must always be the first button in the first row.
	CallbackGame *CallbackGame `json:"callback_game,omitempty"`

	// Optional. Specify True, to send a Pay button.
	//  Substrings “⭐” and “XTR” in the buttons's text will be replaced with a Telegram Star icon.
	//
	// NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages.
	Pay bool `json:"pay,omitempty"`
}

InlineKeyboardButton represents one button of an inline keyboard. !!Exactly one of the optional fields must be used to specify type of the button. Note that some values are references as even an empty string will change behavior. Documentation: https://core.telegram.org/bots/api#inlinekeyboardbutton

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

func (InlineKeyboardButton) Validate added in v0.10.0

func (v InlineKeyboardButton) Validate() error

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

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

func (*InlineKeyboardMarkup) Validate added in v0.10.0

func (v *InlineKeyboardMarkup) Validate() error

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 InlineQueryResult added in v0.10.0

type InlineQueryResult interface {
	GetType() InlineQueryResultType
	GetID() string
	Validate() error
}

type InlineQueryResultArticle

type InlineQueryResultArticle struct {
	InlineQueryResultBase
	InputMessageContent interface{} `json:"input_message_content"` // required
	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

func (InlineQueryResultArticle) Validate added in v0.10.0

func (r InlineQueryResultArticle) Validate() error

type InlineQueryResultAudio

type InlineQueryResultAudio struct {
	InlineQueryResultBase
	URL                 string      `json:"audio_url"` // required
	Performer           string      `json:"performer"`
	Duration            int         `json:"audio_duration"`
	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

func (InlineQueryResultAudio) Validate added in v0.10.0

func (r InlineQueryResultAudio) Validate() error

type InlineQueryResultBase added in v0.10.0

type InlineQueryResultBase struct {
	Type InlineQueryResultType `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// Title for the result. Few results do not support title.
	Title string `json:"title,omitempty"`

	// Optional. Inline keyboard attached to the message.
	// https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

func (InlineQueryResultBase) GetID added in v0.10.0

func (r InlineQueryResultBase) GetID() string

func (InlineQueryResultBase) GetTitle added in v0.10.0

func (r InlineQueryResultBase) GetTitle() string

func (InlineQueryResultBase) GetType added in v0.10.0

func (*InlineQueryResultBase) MarshalJSON added in v0.10.0

func (j *InlineQueryResultBase) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*InlineQueryResultBase) MarshalJSONBuf added in v0.10.0

func (j *InlineQueryResultBase) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*InlineQueryResultBase) UnmarshalJSON added in v0.10.0

func (j *InlineQueryResultBase) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*InlineQueryResultBase) UnmarshalJSONFFLexer added in v0.10.0

func (j *InlineQueryResultBase) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

func (InlineQueryResultBase) Validate added in v0.10.0

func (r InlineQueryResultBase) Validate() error

type InlineQueryResultCachedSticker added in v0.10.0

type InlineQueryResultCachedSticker struct {
	InlineQueryResultBase

	// A valid file identifier of the sticker
	StickerFileID       string              `json:"sticker_file_id"` // required
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

func (*InlineQueryResultCachedSticker) MarshalJSON added in v0.10.0

func (j *InlineQueryResultCachedSticker) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*InlineQueryResultCachedSticker) MarshalJSONBuf added in v0.10.0

MarshalJSONBuf marshal buff to json - template

func (*InlineQueryResultCachedSticker) UnmarshalJSON added in v0.10.0

func (j *InlineQueryResultCachedSticker) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*InlineQueryResultCachedSticker) UnmarshalJSONFFLexer added in v0.10.0

func (j *InlineQueryResultCachedSticker) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

func (InlineQueryResultCachedSticker) Validate added in v0.10.0

type InlineQueryResultContact added in v0.10.0

type InlineQueryResultContact struct {
	InlineQueryResultBase
	PhoneNumber         string              `json:"phone_number"`
	FirstName           string              `json:"first_name"`
	LastName            string              `json:"last_name,omitempty"`
	Vcard               string              `json:"vcard,omitempty"`
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

func (*InlineQueryResultContact) MarshalJSON added in v0.10.0

func (j *InlineQueryResultContact) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*InlineQueryResultContact) MarshalJSONBuf added in v0.10.0

func (j *InlineQueryResultContact) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*InlineQueryResultContact) UnmarshalJSON added in v0.10.0

func (j *InlineQueryResultContact) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*InlineQueryResultContact) UnmarshalJSONFFLexer added in v0.10.0

func (j *InlineQueryResultContact) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

func (InlineQueryResultContact) Validate added in v0.10.0

func (r InlineQueryResultContact) Validate() error

type InlineQueryResultDocument

type InlineQueryResultDocument struct {
	InlineQueryResultBase
	Caption             string      `json:"caption"`
	URL                 string      `json:"document_url"` // required
	MimeType            string      `json:"mime_type"`    // required
	Description         string      `json:"description"`
	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

func (InlineQueryResultDocument) Validate added in v0.10.0

func (r InlineQueryResultDocument) Validate() error

type InlineQueryResultGIF

type InlineQueryResultGIF struct {
	InlineQueryResultBase
	URL                 string      `json:"gif_url"` // required
	Width               int         `json:"gif_width,omitempty"`
	Height              int         `json:"gif_height,omitempty"`
	ThumbURL            string      `json:"thumb_url,omitempty"`
	Caption             string      `json:"caption,omitempty"`
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
}

InlineQueryResultGIF is an inline query response GIF.

func NewInlineQueryResultGIF

func NewInlineQueryResultGIF(id, url, title 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

func (InlineQueryResultGIF) Validate added in v0.10.0

func (r InlineQueryResultGIF) Validate() error

type InlineQueryResultGame added in v0.10.0

type InlineQueryResultGame struct {
	InlineQueryResultBase
	// Short name of the game
	GameShortName string `json:"game_short_name"`
}

func (*InlineQueryResultGame) MarshalJSON added in v0.10.0

func (j *InlineQueryResultGame) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*InlineQueryResultGame) MarshalJSONBuf added in v0.10.0

func (j *InlineQueryResultGame) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*InlineQueryResultGame) UnmarshalJSON added in v0.10.0

func (j *InlineQueryResultGame) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*InlineQueryResultGame) UnmarshalJSONFFLexer added in v0.10.0

func (j *InlineQueryResultGame) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

func (InlineQueryResultGame) Validate added in v0.10.0

func (v InlineQueryResultGame) Validate() error

type InlineQueryResultLocation

type InlineQueryResultLocation struct {
	InlineQueryResultBase
	Latitude            float64     `json:"latitude"`  // required
	Longitude           float64     `json:"longitude"` // required
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
	ThumbURL            string      `json:"thumb_url,omitempty"`
	ThumbWidth          int         `json:"thumb_width,omitempty"`
	ThumbHeight         int         `json:"thumb_height,omitempty"`
}

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

func (InlineQueryResultLocation) Validate added in v0.10.0

func (r InlineQueryResultLocation) Validate() error

type InlineQueryResultMPEG4GIF

type InlineQueryResultMPEG4GIF struct {
	InlineQueryResultBase
	URL                 string      `json:"mpeg4_url"` // required
	Width               int         `json:"mpeg4_width"`
	Height              int         `json:"mpeg4_height"`
	ThumbURL            string      `json:"thumb_url"`
	Caption             string      `json:"caption"`
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
}

InlineQueryResultMPEG4GIF is an inline query response MPEG4 GIF.

func NewInlineQueryResultMPEG4GIF

func NewInlineQueryResultMPEG4GIF(id, url, title 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

func (InlineQueryResultMPEG4GIF) Validate added in v0.10.0

func (r InlineQueryResultMPEG4GIF) Validate() error

type InlineQueryResultPhoto

type InlineQueryResultPhoto struct {
	InlineQueryResultBase
	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"`
	Description         string      `json:"description,omitempty"`
	Caption             string      `json:"caption,omitempty"`
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
}

InlineQueryResultPhoto is an inline query response photo.

func NewInlineQueryResultPhoto

func NewInlineQueryResultPhoto(id, url, title 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

func (InlineQueryResultPhoto) Validate added in v0.10.0

func (r InlineQueryResultPhoto) Validate() error

type InlineQueryResultType added in v0.10.0

type InlineQueryResultType string
const (
	InlineQueryResultTypeArticle  InlineQueryResultType = "article"
	InlineQueryResultTypeAudio    InlineQueryResultType = "audio"
	InlineQueryResultTypeContact  InlineQueryResultType = "contact"
	InlineQueryResultTypeGame     InlineQueryResultType = "game"
	InlineQueryResultTypeDocument InlineQueryResultType = "document"
	InlineQueryResultTypeGIF      InlineQueryResultType = "gif"
	InlineQueryResultTypeLocation InlineQueryResultType = "location"
	InlineQueryResultTypeMpeg4Gif InlineQueryResultType = "mpeg4_gif"
	InlineQueryResultTypePhoto    InlineQueryResultType = "photo"
	InlineQueryResultTypeVenue    InlineQueryResultType = "venue"
	InlineQueryResultTypeSticker  InlineQueryResultType = "sticker"
	InlineQueryResultTypeVideo    InlineQueryResultType = "video"
	InlineQueryResultTypeVoice    InlineQueryResultType = "voice"
)

type InlineQueryResultVenue added in v0.10.0

type InlineQueryResultVenue struct {
	InlineQueryResultBase
	Latitude  float64 `json:"latitude"`  // required
	Longitude float64 `json:"longitude"` // required
	Address   string  `json:"address"`   // required
	FoursquareFields
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
	ThumbURL            string      `json:"thumb_url,omitempty"`
	ThumbWidth          int         `json:"thumb_width,omitempty"`
	ThumbHeight         int         `json:"thumb_height,omitempty"`
}

func (*InlineQueryResultVenue) MarshalJSON added in v0.10.0

func (j *InlineQueryResultVenue) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*InlineQueryResultVenue) MarshalJSONBuf added in v0.10.0

func (j *InlineQueryResultVenue) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*InlineQueryResultVenue) UnmarshalJSON added in v0.10.0

func (j *InlineQueryResultVenue) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*InlineQueryResultVenue) UnmarshalJSONFFLexer added in v0.10.0

func (j *InlineQueryResultVenue) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

func (InlineQueryResultVenue) Validate added in v0.10.0

func (r InlineQueryResultVenue) Validate() error

type InlineQueryResultVideo

type InlineQueryResultVideo struct {
	InlineQueryResultBase
	URL                 string      `json:"video_url"` // required
	MimeType            string      `json:"mime_type"` // required
	ThumbURL            string      `json:"thumb_url"`
	Caption             string      `json:"caption"`
	Width               int         `json:"video_width"`
	Height              int         `json:"video_height"`
	Duration            int         `json:"video_duration"`
	Description         string      `json:"description"`
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
}

InlineQueryResultVideo is an inline query response video.

func NewInlineQueryResultVideo

func NewInlineQueryResultVideo(id, url, title 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

func (InlineQueryResultVideo) Validate added in v0.10.0

func (r InlineQueryResultVideo) Validate() error

type InlineQueryResultVoice

type InlineQueryResultVoice struct {
	InlineQueryResultBase
	URL                 string      `json:"voice_url"` // required
	Duration            int         `json:"voice_duration"`
	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

func (InlineQueryResultVoice) Validate added in v0.10.0

func (r InlineQueryResultVoice) Validate() error

type InlineQueryResultsButton added in v0.10.0

type InlineQueryResultsButton struct {

	// Label text on the button
	Text string `json:"text,omitempty"`

	// Optional. Description of the Web App that will be launched when the user presses the button.
	// The Web App will be able to switch back to the inline mode using the method switchInlineQuery inside the Web App.
	WebApp *WebAppInfo `json:"url,omitempty"`

	// Optional. Deep-linking parameter for the /start message sent to the bot when a user presses the button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.
	//
	// Example: An inline bot that sends YouTube videos can ask the user to connect the bot
	// to their YouTube account to adapt search results accordingly.
	// To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any.
	// The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link.
	// Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.
	StartParameter string `json:"start_parameter,omitempty"`
}

InlineQueryResultsButton represents a button to be shown above inline query results. You must use exactly one of the optional fields.

func (*InlineQueryResultsButton) MarshalJSON added in v0.10.0

func (j *InlineQueryResultsButton) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*InlineQueryResultsButton) MarshalJSONBuf added in v0.10.0

func (j *InlineQueryResultsButton) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*InlineQueryResultsButton) UnmarshalJSON added in v0.10.0

func (j *InlineQueryResultsButton) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*InlineQueryResultsButton) UnmarshalJSONFFLexer added in v0.10.0

func (j *InlineQueryResultsButton) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

func (InlineQueryResultsButton) Validate added in v0.10.0

func (b InlineQueryResultsButton) Validate() error

type InputContactMessageContent

type InputContactMessageContent struct {

	// Contact's phone number
	PhoneNumber string `json:"phone_number"`

	// Contact's first name
	FirstName string `json:"first_name"`

	// Optional. Contact's last name
	LastName string `json:"last_name"`

	// Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes
	VCard string `json:"vcard"`
	// contains filtered or unexported fields
}

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

func (InputContactMessageContent) Validate added in v0.10.0

func (v InputContactMessageContent) Validate() error

type InputLocationMessageContent

type InputLocationMessageContent struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
	// contains filtered or unexported fields
}

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

func (InputLocationMessageContent) Validate added in v0.10.0

func (v InputLocationMessageContent) Validate() error

type InputMessageContent added in v0.10.0

type InputMessageContent interface {
	Validate() error
	// contains filtered or unexported methods
}

type InputTextMessageContent

type InputTextMessageContent struct {
	MessageText           string          `json:"message_text"`
	ParseMode             string          `json:"parse_mode"`
	Entities              []MessageEntity `json:"entities"`
	DisableWebPagePreview bool            `json:"disable_web_page_preview"`
	// contains filtered or unexported fields
}

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

func (InputTextMessageContent) Validate added in v0.10.0

func (v InputTextMessageContent) Validate() error

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"`
	// contains filtered or unexported fields
}

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

func (InputVenueMessageContent) Validate added in v0.10.0

func (v InputVenueMessageContent) Validate() error

type KeyboardButton

type KeyboardButton struct {
	Text            string                      `json:"text"`
	RequestUsers    *KeyboardButtonRequestUsers `json:"request_users,omitempty"`
	RequestChat     *KeyboardButtonRequestChat  `json:"request_chat,omitempty"`
	RequestContact  bool                        `json:"request_contact"`
	RequestLocation bool                        `json:"request_location"`
	RequestPoll     *KeyboardButtonPollType     `json:"request_poll,omitempty"`
	Webapp          *WebAppInfo                 `json:"web_app,omitempty"`
}

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

func (*KeyboardButton) Validate added in v0.5.0

func (j *KeyboardButton) Validate() error

Validate checks if the keyboard button is valid

type KeyboardButtonPollType added in v0.5.0

type KeyboardButtonPollType struct {
	// Optional.
	// If quiz is passed, the user will be allowed to create only polls in the quiz mode.
	// If regular is passed, only regular polls will be allowed.
	// Otherwise, the user will be allowed to create a poll of any type.
	Type string `json:"type,omitempty"`
}

KeyboardButtonPollType represents the type of poll to be created https://core.telegram.org/bots/api#keyboardbuttonpolltype

func (*KeyboardButtonPollType) MarshalJSON added in v0.6.1

func (j *KeyboardButtonPollType) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*KeyboardButtonPollType) MarshalJSONBuf added in v0.6.1

func (j *KeyboardButtonPollType) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*KeyboardButtonPollType) UnmarshalJSON added in v0.6.1

func (j *KeyboardButtonPollType) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*KeyboardButtonPollType) UnmarshalJSONFFLexer added in v0.6.1

func (j *KeyboardButtonPollType) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type KeyboardButtonRequestChat added in v0.5.0

type KeyboardButtonRequestChat struct {
	// Signed 32-bit identifier of the request, which will be received back in the ChatShared object.
	// Must be unique within the message
	RequestID int `json:"request_id"`

	// Pass True to request a channel chat, pass False to request a group or a supergroup chat.
	ChatIsChannel bool `json:"chat_is_channel"`

	// Pass True to request a forum supergroup, pass False to request a non-forum chat.
	// If not specified, no additional restrictions are applied.
	ChatIsForum bool `json:"chat_is_forum,omitempty"`

	// Pass True to request a supergroup or a channel with a username,
	// pass False to request a chat without a username.
	// If not specified, no additional restrictions are applied.
	ChatHasUsername bool `json:"chat_has_username,omitempty"`

	// Pass True to request a chat owned by the user. Otherwise, no additional restrictions are applied.
	ChatIsCreated bool `json:"chat_is_created,omitempty"`

	// A JSON-serialized object listing the required administrator rights of the user in the chat.
	// The rights must be a superset of bot_administrator_rights.
	// If not specified, no additional restrictions are applied.
	UserAdministratorRights *ChatAdministratorRights `json:"user_administrator_rights,omitempty"`

	// A JSON-serialized object listing the required administrator rights of the bot in the chat.
	// The rights must be a subset of user_administrator_rights.
	// If not specified, no additional restrictions are applied.
	BotAdministratorRights *ChatAdministratorRights `json:"bot_administrator_rights,omitempty"`

	// Pass True to request a chat with the bot as a member. Otherwise, no additional restrictions are applied.
	BotIsMember bool `json:"bot_is_member,omitempty"`

	// Pass True to request the chat's title
	RequestTitle bool `json:"request_title,omitempty"`

	// Pass True to request the chat's username
	RequestUsername bool `json:"request_username,omitempty"`

	// Pass True to request the chat's photo
	RequestPhoto bool `json:"request_photo,omitempty"`
}

KeyboardButtonRequestChat represents a request from the bot to send a chat https://core.telegram.org/bots/api#keyboardbuttonrequestchat

func (*KeyboardButtonRequestChat) MarshalJSON added in v0.6.1

func (j *KeyboardButtonRequestChat) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*KeyboardButtonRequestChat) MarshalJSONBuf added in v0.6.1

func (j *KeyboardButtonRequestChat) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*KeyboardButtonRequestChat) UnmarshalJSON added in v0.6.1

func (j *KeyboardButtonRequestChat) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*KeyboardButtonRequestChat) UnmarshalJSONFFLexer added in v0.6.1

func (j *KeyboardButtonRequestChat) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type KeyboardButtonRequestUsers added in v0.5.0

type KeyboardButtonRequestUsers struct {
	// Signed 32-bit identifier of the request, which will be received back in the ChatShared object.
	// Must be unique within the message
	RequestID int `json:"request_id"`

	// Optional.
	// Pass True to request bots, pass False to request regular users.
	// If not specified, no additional restrictions are applied.
	UserIsBot bool `json:"user_is_bot,omitempty"`

	// Optional.
	// Pass True to request premium users, pass False to request non-premium users.
	// If not specified, no additional restrictions are applied.
	UserIsPremium bool `json:"user_is_premium,omitempty"`

	// Optional. The maximum number of users to be selected; 1-10. Defaults to 1.
	MaxQuantity int `json:"max_quantity,omitempty"`

	// Optional. Pass True to request the users' first and last names
	RequestName bool `json:"request_name,omitempty"`

	// Optional. Pass True to request the users' usernames
	RequestUsername bool `json:"request_username,omitempty"`

	// Optional. Pass True to request the users' photos
	RequestPhoto bool `json:"request_photo,omitempty"`
}

KeyboardButtonRequestUsers represents a request from the bot to send users https://core.telegram.org/bots/api#keyboardbuttonrequestusers

func (*KeyboardButtonRequestUsers) MarshalJSON added in v0.6.1

func (j *KeyboardButtonRequestUsers) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*KeyboardButtonRequestUsers) MarshalJSONBuf added in v0.6.1

func (j *KeyboardButtonRequestUsers) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*KeyboardButtonRequestUsers) UnmarshalJSON added in v0.6.1

func (j *KeyboardButtonRequestUsers) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*KeyboardButtonRequestUsers) UnmarshalJSONFFLexer added in v0.6.1

func (j *KeyboardButtonRequestUsers) 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

func (LeaveChatConfig) Values

func (v LeaveChatConfig) Values() (url.Values, error)

type LinkPreviewOptions added in v0.10.0

type LinkPreviewOptions struct {

	// Optional. True, if the link preview is disabled.
	IsDisabled bool `json:"is_disabled,omitempty"`

	// Optional. URL to use for the link preview.
	// If empty, then the first URL found in the message text will be used.
	Url string `json:"url,omitempty"`

	// Optional. True, if the media in the link preview is supposed to be shrunk;
	// ignored if the URL isn't explicitly specified or media size change isn't supported for the preview.
	PreferSmallMedia bool `json:"prefer_small_media,omitempty"`

	// Optional. True, if the media in the link preview is supposed to be enlarged;
	// ignored if the URL isn't explicitly specified or media size change isn't supported for the preview.
	PreferLargeMedia bool `json:"prefer_large_media,omitempty"`

	// Optional. True, if the link preview must be shown above the message text;
	// otherwise, the link preview will be shown below the message text
	ShowAboveText bool `json:"show_above_text,omitempty"`
}

LinkPreviewOptions Describes the options used for link preview generation.

func (*LinkPreviewOptions) MarshalJSON added in v0.10.0

func (j *LinkPreviewOptions) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*LinkPreviewOptions) MarshalJSONBuf added in v0.10.0

func (j *LinkPreviewOptions) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*LinkPreviewOptions) UnmarshalJSON added in v0.10.0

func (j *LinkPreviewOptions) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*LinkPreviewOptions) UnmarshalJSONFFLexer added in v0.10.0

func (j *LinkPreviewOptions) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type Location

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

Location contains information about a place.

func (*Location) MarshalJSON

func (j *Location) MarshalJSON() ([]byte, error)

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

func (j *Location) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Location) UnmarshalJSONFFLexer

func (j *Location) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type LocationConfig

type LocationConfig struct {
	BaseChat
	Latitude  float64 // required
	Longitude float64 // required
}

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

func (LocationConfig) Values

func (j LocationConfig) Values() (url.Values, error)

Values returns url.Values representation of LocationConfig.

type LoginUrl added in v0.6.0

type LoginUrl struct {
	// An HTTPS URL to be opened with user authorization data added to the query string when the button is pressed.
	// If the user refuses to provide authorization data,
	// the original URL without information about the user will be opened.
	// The data added is the same as described in Receiving authorization data.
	Url string `json:"url"`

	// Optional. New text of the button in forwarded messages.
	ForwardText string `json:"forward_text,omitempty"`

	// Optional.
	// Username of a bot, which will be used for user authorization.
	// See Setting up a bot for more details.
	// If not specified, the current bot's username will be assumed.
	// The url's domain must be the same as the domain linked with the bot.
	// See Linking your domain to the bot for more details.
	BotUsername string `json:"bot_username,omitempty"`

	// Optional. Pass True to request the permission for your bot to send messages to the user.
	RequestWriteAccess bool `json:"request_write_access,omitempty"`
}

LoginUrl represents a parameter of the inline keyboard button used to automatically authorize a user. https://core.telegram.org/bots/api#loginurl

func (*LoginUrl) MarshalJSON added in v0.6.1

func (j *LoginUrl) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*LoginUrl) MarshalJSONBuf added in v0.6.1

func (j *LoginUrl) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*LoginUrl) UnmarshalJSON added in v0.6.1

func (j *LoginUrl) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*LoginUrl) UnmarshalJSONFFLexer added in v0.6.1

func (j *LoginUrl) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

func (LoginUrl) Validate added in v0.10.0

func (v LoginUrl) Validate() error

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"`
	UserShared            *UserShared      `json:"user_shared,omitempty"`             // optional NON-DOCUMENTED FIELD
	UsersShared           *UsersShared     `json:"users_shared,omitempty"`            // optional
	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

func (m *Message) Command() string

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

func (m *Message) CommandArguments() string

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) IsCommand

func (m *Message) IsCommand() bool

IsCommand returns true if message starts with '/'.

func (*Message) MarshalJSON

func (j *Message) MarshalJSON() ([]byte, error)

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) Time

func (m *Message) Time() time.Time

Time converts the message timestamp into a Time.

func (*Message) UnmarshalJSON

func (j *Message) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Message) UnmarshalJSONFFLexer

func (j *Message) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

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

func (MessageConfig) Values

func (v MessageConfig) Values() (url.Values, error)

Values returns url.Values representation of MessageConfig.

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

func (*MessageEntity) Validate added in v0.10.0

func (entity *MessageEntity) Validate() error

type PhotoConfig

type PhotoConfig struct {
	BaseFile
	Caption string
}

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

func (PhotoConfig) Values

func (v PhotoConfig) Values() (url.Values, error)

Values returns url.Values representation of PhotoConfig.

type PhotoSize

type PhotoSize struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID string `json:"file_id"`

	// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	FileUniqueID string `json:"file_unique_id,omitempty"` // optional

	Width    int `json:"width,omitempty"`     // Photo width
	Height   int `json:"height,omitempty"`    // Photo height
	FileSize int `json:"file_size,omitempty"` // Optional. File size in bytes
}

PhotoSize contains information about photos.

func (*PhotoSize) MarshalJSON

func (j *PhotoSize) MarshalJSON() ([]byte, error)

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) String added in v0.8.1

func (v *PhotoSize) String() string

func (*PhotoSize) UnmarshalJSON

func (j *PhotoSize) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*PhotoSize) UnmarshalJSONFFLexer

func (j *PhotoSize) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

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() botsgocore.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

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 SharedUser added in v0.8.0

type SharedUser struct {
	UserID int `json:"user_id"`

	// Optional. First name of the user, if the name was requested by the bot
	FirstName string `json:"first_name,omitempty"`

	// Optional. Last name of the user, if the name was requested by the bot
	LastName string `json:"last_name,omitempty"`

	// Optional. Username of the user, if the name was requested by the bot
	Username string `json:"username,omitempty"`

	Photo []PhotoSize `json:"photo,omitempty"`
}

SharedUser contains information about a user that was shared with the bot using a KeyboardButtonRequestUsers button. https://core.telegram.org/bots/api#shareduser

func (*SharedUser) MarshalJSON added in v0.8.2

func (j *SharedUser) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*SharedUser) MarshalJSONBuf added in v0.8.2

func (j *SharedUser) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*SharedUser) UnmarshalJSON added in v0.8.2

func (j *SharedUser) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*SharedUser) UnmarshalJSONFFLexer added in v0.8.2

func (j *SharedUser) 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

func (j *Sticker) MarshalJSON() ([]byte, error)

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

func (j *Sticker) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Sticker) UnmarshalJSONFFLexer

func (j *Sticker) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

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

func (StickerConfig) Values

func (v StickerConfig) Values() (url.Values, error)

Values returns url.Values representation of StickerConfig.

type SwitchInlineQueryChosenChat added in v0.6.0

type SwitchInlineQueryChosenChat struct {
	// Optional.
	//The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted
	Query string `json:"query,omitempty"`

	// Optional. True, if private chats with users can be chosen
	AllowUserChats bool `json:"allow_user_chats,omitempty"`

	// Optional. True, if private chats with bots can be chosen
	AllowBotChats bool `json:"allow_bot_chats,omitempty"`

	// Optional. True, if group and supergroup chats can be chosen
	AllowGroupChats bool `json:"allow_group_chats,omitempty"`

	// Optional. True, if channel chats can be chosen
	AllowChannelChats bool `json:"allow_channel_chats,omitempty"`
}

SwitchInlineQueryChosenChat represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query. Documentation: https://core.telegram.org/bots/api#switchinlinequerychosenchat

func (*SwitchInlineQueryChosenChat) MarshalJSON added in v0.6.1

func (j *SwitchInlineQueryChosenChat) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*SwitchInlineQueryChosenChat) MarshalJSONBuf added in v0.6.1

func (j *SwitchInlineQueryChosenChat) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*SwitchInlineQueryChosenChat) UnmarshalJSON added in v0.6.1

func (j *SwitchInlineQueryChosenChat) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*SwitchInlineQueryChosenChat) UnmarshalJSONFFLexer added in v0.6.1

func (j *SwitchInlineQueryChosenChat) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

func (SwitchInlineQueryChosenChat) Validate added in v0.10.0

func (v SwitchInlineQueryChosenChat) Validate() error

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) Chat

func (update Update) Chat() *Chat

Chat provides chat struct for the update

func (*Update) MarshalJSON

func (j *Update) MarshalJSON() ([]byte, error)

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

func (j *Update) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Update) UnmarshalJSONFFLexer

func (j *Update) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type UpdateConfig

type UpdateConfig struct {
	Offset  int
	Limit   int
	Timeout int
}

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

func (u User) GetFirstName() string

GetFirstName returns first name of the user

func (User) GetFullName

func (u User) GetFullName() string

GetFullName returns full name of the user

func (User) GetID

func (u User) GetID() interface{}

GetID returns Telegram user ID

func (User) GetLanguage

func (u User) GetLanguage() string

GetLanguage returns preferred language of the user

func (User) GetLastName

func (u User) GetLastName() string

GetLastName returns last name of the user

func (User) GetUserName

func (u User) GetUserName() string

GetUserName returns user name of the user

func (*User) MarshalJSON

func (j *User) MarshalJSON() ([]byte, error)

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) Platform

func (u User) Platform() string

Platform returns 'Telegram'

func (*User) String

func (u *User) String() 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

func (j *User) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*User) UnmarshalJSONFFLexer

func (j *User) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

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

type UserProfilePhotosConfig struct {
	UserID int
	Offset int
	Limit  int
}

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 UserShared added in v0.8.2

type UserShared struct {
	UserID    int `json:"userID"`
	RequestID int `json:"request_id"`
}

UserShared is a NON-DOCUMENTED TELEGRAM MESSAGE FIELD

func (*UserShared) MarshalJSON added in v0.8.2

func (j *UserShared) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*UserShared) MarshalJSONBuf added in v0.8.2

func (j *UserShared) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*UserShared) UnmarshalJSON added in v0.8.2

func (j *UserShared) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*UserShared) UnmarshalJSONFFLexer added in v0.8.2

func (j *UserShared) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type UsersShared added in v0.8.0

type UsersShared struct {
	RequestID int          `json:"request_id"`
	UserIDs   []int        `json:"user_ids"`
	Users     []SharedUser `json:"users"`
}

UsersShared contains information about the users whose identifiers were shared with the bot using a KeyboardButtonRequestUsers button. https://core.telegram.org/bots/api#usersshared

func (*UsersShared) MarshalJSON added in v0.8.2

func (j *UsersShared) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*UsersShared) MarshalJSONBuf added in v0.8.2

func (j *UsersShared) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*UsersShared) UnmarshalJSON added in v0.8.2

func (j *UsersShared) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*UsersShared) UnmarshalJSONFFLexer added in v0.8.2

func (j *UsersShared) 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

func (j *Venue) MarshalJSON() ([]byte, error)

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

func (j *Venue) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Venue) UnmarshalJSONFFLexer

func (j *Venue) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

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

func (VenueConfig) Values

func (v VenueConfig) Values() (url.Values, error)

Values returns URL values representation of VenueConfig

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

func (j *Video) MarshalJSON() ([]byte, error)

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

func (j *Video) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Video) UnmarshalJSONFFLexer

func (j *Video) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type VideoConfig

type VideoConfig struct {
	BaseFile
	Duration int
	Caption  string
}

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

func (VideoConfig) Values

func (v VideoConfig) Values() (url.Values, error)

Values returns a url.Values representation of VideoConfig.

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

func (j *Voice) MarshalJSON() ([]byte, error)

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

func (j *Voice) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Voice) UnmarshalJSONFFLexer

func (j *Voice) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type VoiceConfig

type VoiceConfig struct {
	BaseFile
	Duration int
}

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

func (VoiceConfig) Values

func (v VoiceConfig) Values() (url.Values, error)

Values returns a url.Values representation of VoiceConfig.

type WebAppInfo added in v0.10.0

type WebAppInfo struct {

	// An HTTPS URL of a Web App to be opened with additional data
	// as specified in https://core.telegram.org/bots/webapps#initializing-mini-apps
	Url string `json:"url"`
}

WebAppInfo represents a web app to be opened with the button https://core.telegram.org/bots/api#webappinfo

func (*WebAppInfo) MarshalJSON added in v0.10.0

func (j *WebAppInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*WebAppInfo) MarshalJSONBuf added in v0.10.0

func (j *WebAppInfo) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*WebAppInfo) UnmarshalJSON added in v0.10.0

func (j *WebAppInfo) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*WebAppInfo) UnmarshalJSONFFLexer added in v0.10.0

func (j *WebAppInfo) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

func (WebAppInfo) Validate added in v0.10.0

func (v WebAppInfo) Validate() error

type WebhookConfig

type WebhookConfig struct {

	// URL - HTTPS url to send updates to. Use an empty string to remove webhook integration
	URL *url.URL `json:"url"` // REQUIRED!

	// Certificate - 	Upload your public key certificate so that the root certificate in use can be checked.
	// See https://core.telegram.org/bots/self-signed guide for details.
	Certificate interface{} `json:"certificate,omitempty"`

	// IPAddress - The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS
	IPAddress string `json:"ip_address,omitempty"`

	// MaxConnections - 	The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100.
	// Defaults to 40. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput.
	MaxConnections int `json:"max_connections,omitempty"`

	// AllowedUpdates - A JSON-serialized list of the update types you want your bot to receive.
	// For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types.
	// See Update for a complete list of available update types.
	// Specify an empty list to receive all update types except chat_member (default).
	// If not specified, the previous setting will be used.
	// Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received for a short period of time.
	AllowedUpdates []string `json:"allowed_updates,omitempty"`

	// DropPendingUpdates - Pass True to drop all pending updates
	DropPendingUpdates bool `json:"drop_pending_updates,omitempty"`

	// SecretToken - A secret token to be sent in a header “X-Telegram-Bot-Api-Secret-Token” in every webhook request, 1-256 characters.
	// Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you.
	SecretToken string `json:"secret_token,omitempty"`
}

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)
}

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

func (WebhookConfig) Validate added in v0.2.0

func (j WebhookConfig) Validate() error

Validate returns an error if the WebhookConfig struct is invalid.

func (WebhookConfig) Values added in v0.2.0

func (j WebhookConfig) Values() (url.Values, error)

Values returns url.Values representation of WebhookConfig.

Jump to

Keyboard shortcuts

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