dandelion

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: MIT, MIT Imports: 18 Imported by: 0

README

Telegram Bot API

Original project telegram-bot-api

The scope of that project is just to provide a wrapper around the API. This fork will bring many disruptive changes. It not pulls request to the original project. Maybe, someday in the future, it will become a separate project, but now I'm lack a good idea.

Documentation

Index

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      = "typing"
	ChatUploadPhoto = "upload_photo"
	ChatRecordVideo = "record_video"
	ChatUploadVideo = "upload_video"
	ChatRecordVoice = "record_voice"
	ChatUploadVoice = "upload_voice"
	// Deprecated: use ChatRecordVoice instead.
	ChatRecordAudio = "record_audio"
	// Deprecated: use ChatUploadVoice instead.
	ChatUploadAudio     = "upload_audio"
	ChatUploadDocument  = "upload_document"
	ChatFindLocation    = "find_location"
	ChatRecordVideoNote = "record_video_note"
	ChatUploadVideoNote = "upload_video_note"
)

Constant values for ChatActions

View Source
const (
	ModeMarkdown   = "Markdown"
	ModeMarkdownV2 = "MarkdownV2"
	ModeHTML       = "HTML"
)

Constant values for ParseMode in MessageConfig

View Source
const (
	UpdateTypeMessage            = "message"
	UpdateTypeEditedMessage      = "edited_message"
	UpdateTypeChannelPost        = "channel_post"
	UpdateTypeEditedChannelPost  = "edited_channel_post"
	UpdateTypeInlineQuery        = "inline_query"
	UpdateTypeChosenInlineResult = "chosen_inline_result"
	UpdateTypeCallbackQuery      = "callback_query"
	UpdateTypeShippingQuery      = "shipping_query"
	UpdateTypePreCheckoutQuery   = "pre_checkout_query"
	UpdateTypePoll               = "poll"
	UpdateTypePollAnswer         = "poll_answer"
	UpdateTypeMyChatMember       = "my_chat_member"
	UpdateTypeChatMember         = "chat_member"
)

Constant values for update types

View Source
const (
	// ErrBadFileType happens when you pass an unknown type
	ErrBadFileType = "bad file type"
	ErrBadURL      = "bad or empty url"
)

Library errors

View Source
const (
	// ErrAPIForbidden happens when a token is bad
	ErrAPIForbidden = "forbidden"
)

API errors

Variables

This section is empty.

Functions

func WriteToHTTPResponse

func WriteToHTTPResponse(w http.ResponseWriter, c Chattable) error

WriteToHTTPResponse writes the request to the HTTP ResponseWriter.

It doesn't support uploading files.

See https://core.telegram.org/bots/api#making-requests-when-getting-updates for details.

Types

type APIResponse

type APIResponse struct {
	Ok          bool                `json:"ok"`
	Result      json.RawMessage     `json:"result,omitempty"`
	ErrorCode   int                 `json:"error_code,omitempty"`
	Description string              `json:"description,omitempty"`
	Parameters  *ResponseParameters `json:"parameters,omitempty"`
}

APIResponse is a response from the Telegram API with the result stored raw.

func (*APIResponse) DebugString

func (a *APIResponse) DebugString() string

func (*APIResponse) Decode

func (a *APIResponse) Decode(responseBody io.Reader) error

type Adapter

type Adapter interface {
	Adapter() Adapters     // 子适配器,先运行子适配器
	IsMatch(*Context) bool // 是否匹配
	Handle(*Context) bool  // 是否结束
}

Adapter 消息适配器,实现这个接口的适配器才行

type Adapters

type Adapters []Adapter

func (Adapters) Match

func (a Adapters) Match(c *Context) bool

type AddStickerConfig

type AddStickerConfig struct {
	UserID       int64
	Name         string
	PNGSticker   interface{}
	TGSSticker   interface{}
	Emojis       string
	MaskPosition *MaskPosition
}

AddStickerConfig allows you to add a sticker to a set.

func (AddStickerConfig) Files

func (config AddStickerConfig) Files() []RequestFile

func (AddStickerConfig) Method

func (config AddStickerConfig) Method() string

func (AddStickerConfig) Params

func (config AddStickerConfig) Params() (Params, error)

type Animation

type Animation struct {
	// FileID odentifier for this file, which can be used to download or reuse
	// the file
	FileID string `json:"file_id"`
	// FileUniqueID is the 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"`
	// Width video width as defined by sender
	Width int `json:"width"`
	// Height video height as defined by sender
	Height int `json:"height"`
	// Duration of the video in seconds as defined by sender
	Duration int `json:"duration"`
	// Thumbnail animation thumbnail as defined by sender
	//
	// optional
	Thumbnail *PhotoSize `json:"thumb,omitempty"`
	// FileName original animation filename as defined by sender
	//
	// optional
	FileName string `json:"file_name,omitempty"`
	// MimeType of the file as defined by sender
	//
	// optional
	MimeType string `json:"mime_type,omitempty"`
	// FileSize file size
	//
	// optional
	FileSize int `json:"file_size,omitempty"`
}

Animation represents an animation file.

type AnimationConfig

type AnimationConfig struct {
	BaseFile
	Duration        int
	Thumb           interface{}
	Caption         string
	ParseMode       string
	CaptionEntities []MessageEntity
}

AnimationConfig contains information about a SendAnimation request.

func NewAnimation

func NewAnimation(chatID int64, file interface{}) AnimationConfig

NewAnimation creates a new sendAnimation request.

func (AnimationConfig) Files

func (config AnimationConfig) Files() []RequestFile

func (AnimationConfig) Method

func (config AnimationConfig) Method() string

func (AnimationConfig) Params

func (config AnimationConfig) Params() (Params, error)

type Audio

type Audio struct {
	// FileID is an identifier for this file, which can be used to download or
	// reuse the file
	FileID string `json:"file_id"`
	// FileUniqueID is the 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"`
	// Duration of the audio in seconds as defined by sender
	Duration int `json:"duration"`
	// Performer of the audio as defined by sender or by audio tags
	//
	// optional
	Performer string `json:"performer,omitempty"`
	// Title of the audio as defined by sender or by audio tags
	//
	// optional
	Title string `json:"title,omitempty"`
	// FileName is the original filename as defined by sender
	//
	// optional
	FileName string `json:"file_name,omitempty"`
	// MimeType of the file as defined by sender
	//
	// optional
	MimeType string `json:"mime_type,omitempty"`
	// FileSize file size
	//
	// optional
	FileSize int `json:"file_size,omitempty"`
	// Thumbnail is the album cover to which the music file belongs
	//
	// optional
	Thumbnail *PhotoSize `json:"thumb,omitempty"`
}

Audio represents an audio file to be treated as music by the Telegram clients.

type AudioConfig

type AudioConfig struct {
	BaseFile
	Thumb           interface{}
	Caption         string
	ParseMode       string
	CaptionEntities []MessageEntity
	Duration        int
	Performer       string
	Title           string
}

AudioConfig contains information about a SendAudio request.

func NewAudio

func NewAudio(chatID int64, file interface{}) AudioConfig

NewAudio creates a new sendAudio request.

func (AudioConfig) Files

func (config AudioConfig) Files() []RequestFile

func (AudioConfig) Method

func (config AudioConfig) Method() string

func (AudioConfig) Params

func (config AudioConfig) Params() (Params, error)

type BaseChat

type BaseChat struct {
	ChatID                   int64 // required
	ChannelUsername          string
	ReplyToMessageID         int
	ReplyMarkup              interface{}
	DisableNotification      bool
	AllowSendingWithoutReply bool
}

BaseChat is base type for all chat config types.

type BaseEdit

type BaseEdit struct {
	ChatID          int64
	ChannelUsername string
	MessageID       int
	InlineMessageID string
	ReplyMarkup     *InlineKeyboardMarkup
}

BaseEdit is base type of all chat edits.

type BaseFile

type BaseFile struct {
	BaseChat
	File interface{}
}

BaseFile is a base type for all file config types.

func (BaseFile) Params

func (file BaseFile) Params() (Params, error)

type BaseInputMedia

type BaseInputMedia struct {
	// Type of the result.
	Type string `json:"type"`
	// Media file to send. Pass a file_id to send a file
	// that exists on the Telegram servers (recommended),
	// pass an HTTP URL for Telegram to get a file from the Internet,
	// or pass “attach://<file_attach_name>” to upload a new one
	// using multipart/form-data under <file_attach_name> name.
	Media interface{} `json:"media"`

	// Caption of the video to be sent, 0-1024 characters after entities parsing.
	//
	// optional
	Caption string `json:"caption,omitempty"`
	// ParseMode mode for parsing entities in the video caption.
	// See formatting options for more details
	// (https://core.telegram.org/bots/api#formatting-options).
	//
	// optional
	ParseMode string `json:"parse_mode,omitempty"`
	// CaptionEntities is a list of special entities that appear in the caption,
	// which can be specified instead of parse_mode
	//
	// optional
	CaptionEntities []MessageEntity `json:"caption_entities"`
}

BaseInputMedia is a base type for the InputMedia types.

type BotCommand

type BotCommand struct {
	// Command text of the command, 1-32 characters.
	// Can contain only lowercase English letters, digits and underscores.
	Command string `json:"command"`
	// Description of the command, 3-256 characters.
	Description string `json:"description"`
}

BotCommand represents a bot command.

type CallbackConfig

type CallbackConfig struct {
	CallbackQueryID string `json:"callback_query_id"`
	Text            string `json:"text"`
	ShowAlert       bool   `json:"show_alert"`
	URL             string `json:"url"`
	CacheTime       int    `json:"cache_time"`
}

CallbackConfig contains information on making a CallbackQuery response.

func NewCallback

func NewCallback(id, text string) CallbackConfig

NewCallback creates a new callback message.

func NewCallbackWithAlert

func NewCallbackWithAlert(id, text string) CallbackConfig

NewCallbackWithAlert creates a new callback message that alerts the user.

func (CallbackConfig) Method

func (config CallbackConfig) Method() string

func (CallbackConfig) Params

func (config CallbackConfig) Params() (Params, error)

type CallbackGame

type CallbackGame struct{}

CallbackGame is for starting a game in an inline keyboard button.

type CallbackQuery

type CallbackQuery struct {
	// ID unique identifier for this query
	ID string `json:"id"`
	// From sender
	From *User `json:"from"`
	// Message with the callback button that originated the query.
	// Note that message content and message date will not be available if the
	// message is too old.
	//
	// optional
	Message *Message `json:"message,omitempty"`
	// InlineMessageID identifier of the message sent via the bot in inline
	// mode, that originated the query.
	//
	// optional
	InlineMessageID string `json:"inline_message_id,omitempty"`
	// ChatInstance global identifier, uniquely corresponding to the chat to
	// which the message with the callback button was sent. Useful for high
	// scores in games.
	ChatInstance string `json:"chat_instance"`
	// Data associated with the callback button. Be aware that
	// a bad client can send arbitrary data in this field.
	//
	// optional
	Data string `json:"data,omitempty"`
	// GameShortName short name of a Game to be returned, serves as the unique identifier for the game.
	//
	// optional
	GameShortName string `json:"game_short_name,omitempty"`
}

CallbackQuery represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.

type Chat

type Chat struct {
	// ID is a unique identifier for this chat
	ID int64 `json:"id"`
	// Type of chat, can be either “private”, “group”, “supergroup” or “channel”
	Type string `json:"type"`
	// Title for supergroups, channels and group chats
	//
	// optional
	Title string `json:"title,omitempty"`
	// UserName for private chats, supergroups and channels if available
	//
	// optional
	UserName string `json:"username,omitempty"`
	// FirstName of the other party in a private chat
	//
	// optional
	FirstName string `json:"first_name,omitempty"`
	// LastName of the other party in a private chat
	//
	// optional
	LastName string `json:"last_name,omitempty"`
	// Photo is a chat photo
	Photo *ChatPhoto `json:"photo"`
	// Bio is the bio of the other party in a private chat. Returned only in
	// getChat
	//
	// optional
	Bio string `json:"bio,omitempty"`
	// Description for groups, supergroups and channel chats
	//
	// optional
	Description string `json:"description,omitempty"`
	// InviteLink is a chat invite link, for groups, supergroups and channel chats.
	// Each administrator in a chat generates their own invite links,
	// so the bot must first generate the link using exportChatInviteLink
	//
	// optional
	InviteLink string `json:"invite_link,omitempty"`
	// PinnedMessage is the pinned message, for groups, supergroups and channels
	//
	// optional
	PinnedMessage *Message `json:"pinned_message,omitempty"`
	// Permissions is default chat member permissions, for groups and
	// supergroups. Returned only in getChat.
	//
	// optional
	Permissions *ChatPermissions `json:"permissions,omitempty"`
	// SlowModeDelay is for supergroups, the minimum allowed delay between
	// consecutive messages sent by each unpriviledged user. Returned only in
	// getChat.
	//
	// optional
	SlowModeDelay int `json:"slow_mode_delay,omitempty"`
	// StickerSetName is for supergroups, name of group sticker set.Returned
	// only in getChat.
	//
	// optional
	StickerSetName string `json:"sticker_set_name,omitempty"`
	// CanSetStickerSet is true, if the bot can change the group sticker set.
	// Returned only in getChat.
	//
	// optional
	CanSetStickerSet bool `json:"can_set_sticker_set,omitempty"`
	// LinkedChatID is a unique identifier for the linked chat, i.e. the
	// discussion group identifier for a channel and vice versa; for supergroups
	// and channel chats.
	//
	// optional
	LinkedChatID int64 `json:"linked_chat_id,omitempty"`
	// Location is for supergroups, the location to which the supergroup is
	// connected. Returned only in getChat.
	//
	// optional
	Location *ChatLocation `json:"location"`
}

Chat represents a chat.

func (Chat) ChatConfig

func (c Chat) ChatConfig() ChatConfig

ChatConfig returns a ChatConfig struct for chat related methods.

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.

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

func (config ChatActionConfig) Method() string

func (ChatActionConfig) Params

func (config ChatActionConfig) Params() (Params, error)

type ChatAdministratorsConfig

type ChatAdministratorsConfig struct {
	ChatConfig
}

ChatAdministratorsConfig contains information about getting chat administrators.

func (ChatAdministratorsConfig) Method

type ChatConfig

type ChatConfig struct {
	ChatID             int64
	SuperGroupUsername string
}

ChatConfig contains information about getting information on a chat.

func (ChatConfig) Params

func (config ChatConfig) Params() (Params, error)

type ChatConfigWithUser

type ChatConfigWithUser struct {
	ChatID             int64
	SuperGroupUsername string
	UserID             int64
}

ChatConfigWithUser contains information about a chat and a user.

func (ChatConfigWithUser) Params

func (config ChatConfigWithUser) Params() (Params, error)

type ChatInfoConfig

type ChatInfoConfig struct {
	ChatConfig
}

ChatInfoConfig contains information about getting chat information.

func (ChatInfoConfig) Method

func (ChatInfoConfig) Method() string
type ChatInviteLink struct {
	// InviteLink is the invite link. If the link was created by another chat
	// administrator, then the second part of the link will be replaced with “…”.
	InviteLink string `json:"invite_link"`
	// Creator of the link.
	Creator User `json:"creator"`
	// IsPrimary is true, if the link is primary.
	IsPrimary bool `json:"is_primary"`
	// IsRevoked is true, if the link is revoked.
	IsRevoked bool `json:"is_revoked"`
	// ExpireDate is the point in time (Unix timestamp) when the link will
	// expire or has been expired.
	//
	// optional
	ExpireDate int `json:"expire_date"`
	// MemberLimit is the maximum number of users that can be members of the
	// chat simultaneously after joining the chat via this invite link; 1-99999.
	//
	// optional
	MemberLimit int `json:"member_limit"`
}

ChatInviteLink represents an invite link for a chat.

type ChatInviteLinkConfig

type ChatInviteLinkConfig struct {
	ChatConfig
}

ChatInviteLinkConfig contains information about getting a chat link.

Note that generating a new link will revoke any previous links.

func (ChatInviteLinkConfig) Method

func (ChatInviteLinkConfig) Method() string

func (ChatInviteLinkConfig) Params

func (config ChatInviteLinkConfig) Params() (Params, error)

type ChatLocation

type ChatLocation struct {
	// Location is the location to which the supergroup is connected. Can't be a
	// live location.
	Location Location `json:"location"`
	// Address is the location address; 1-64 characters, as defined by the chat
	// owner
	Address string `json:"address"`
}

ChatLocation represents a location to which a chat is connected.

type ChatMember

type ChatMember struct {
	// User information about the user
	User *User `json:"user"`
	// Status the member's status in the chat.
	// Can be
	//  “creator”,
	//  “administrator”,
	//  “member”,
	//  “restricted”,
	//  “left” or
	//  “kicked”
	Status string `json:"status"`
	// CustomTitle owner and administrators only. Custom title for this user
	//
	// optional
	CustomTitle string `json:"custom_title,omitempty"`
	// IsAnonymous owner and administrators only. True, if the user's presence
	// in the chat is hidden
	//
	// optional
	IsAnonymous bool `json:"is_anonymous"`
	// UntilDate restricted and kicked only.
	// Date when restrictions will be lifted for this user;
	// unix time.
	//
	// optional
	UntilDate int64 `json:"until_date,omitempty"`
	// CanBeEdited administrators only.
	// True, if the bot is allowed to edit administrator privileges of that user.
	//
	// optional
	CanBeEdited bool `json:"can_be_edited,omitempty"`
	// CanManageChat administrators only.
	// True, if the administrator can access the chat event log, chat
	// statistics, message statistics in channels, see channel members, see
	// anonymous administrators in supergoups and ignore slow mode. Implied by
	// any other administrator privilege.
	//
	// optional
	CanManageChat bool `json:"can_manage_chat"`
	// CanPostMessages administrators only.
	// True, if the administrator can post in the channel;
	// channels only.
	//
	// optional
	CanPostMessages bool `json:"can_post_messages,omitempty"`
	// CanEditMessages administrators only.
	// True, if the administrator can edit messages of other users and can pin messages;
	// channels only.
	//
	// optional
	CanEditMessages bool `json:"can_edit_messages,omitempty"`
	// CanDeleteMessages administrators only.
	// True, if the administrator can delete messages of other users.
	//
	// optional
	CanDeleteMessages bool `json:"can_delete_messages,omitempty"`
	// CanManageVoiceChats administrators only.
	// True, if the administrator can manage voice chats.
	//
	// optional
	CanManageVoiceChats bool `json:"can_manage_voice_chats"`
	// CanRestrictMembers administrators only.
	// True, if the administrator can restrict, ban or unban chat members.
	//
	// optional
	CanRestrictMembers bool `json:"can_restrict_members,omitempty"`
	// CanPromoteMembers administrators only.
	// True, if the administrator can add new administrators
	// with a subset of their own privileges or demote administrators that he has promoted,
	// directly or indirectly (promoted by administrators that were appointed by the user).
	//
	// optional
	CanPromoteMembers bool `json:"can_promote_members,omitempty"`
	// CanChangeInfo administrators and restricted only.
	// True, if the user is allowed to change the chat title, photo and other settings.
	//
	// optional
	CanChangeInfo bool `json:"can_change_info,omitempty"`
	// CanInviteUsers administrators and restricted only.
	// True, if the user is allowed to invite new users to the chat.
	//
	// optional
	CanInviteUsers bool `json:"can_invite_users,omitempty"`
	// CanPinMessages administrators and restricted only.
	// True, if the user is allowed to pin messages; groups and supergroups only
	//
	// optional
	CanPinMessages bool `json:"can_pin_messages,omitempty"`
	// IsMember is true, if the user is a member of the chat at the moment of
	// the request
	IsMember bool `json:"is_member"`
	// CanSendMessages
	//
	// optional
	CanSendMessages bool `json:"can_send_messages,omitempty"`
	// CanSendMediaMessages restricted only.
	// True, if the user is allowed to send text messages, contacts, locations and venues
	//
	// optional
	CanSendMediaMessages bool `json:"can_send_media_messages,omitempty"`
	// CanSendPolls restricted only.
	// True, if the user is allowed to send polls
	//
	// optional
	CanSendPolls bool `json:"can_send_polls,omitempty"`
	// CanSendOtherMessages restricted only.
	// True, if the user is allowed to send audios, documents,
	// photos, videos, video notes and voice notes.
	//
	// optional
	CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"`
	// CanAddWebPagePreviews restricted only.
	// True, if the user is allowed to add web page previews to their messages.
	//
	// optional
	CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"`
}

ChatMember contains information about one member of a chat.

func (ChatMember) HasLeft

func (chat ChatMember) HasLeft() bool

HasLeft returns if the ChatMember left the chat.

func (ChatMember) IsAdministrator

func (chat ChatMember) IsAdministrator() bool

IsAdministrator returns if the ChatMember is a chat administrator.

func (ChatMember) IsCreator

func (chat ChatMember) IsCreator() bool

IsCreator returns if the ChatMember was the creator of the chat.

func (ChatMember) WasKicked

func (chat ChatMember) WasKicked() bool

WasKicked returns if the ChatMember was kicked from the chat.

type ChatMemberConfig

type ChatMemberConfig struct {
	ChatID             int64
	SuperGroupUsername string
	ChannelUsername    string
	UserID             int64
}

ChatMemberConfig contains information about a user in a chat for use with administrative functions such as kicking or unbanning a user.

type ChatMemberCountConfig

type ChatMemberCountConfig struct {
	ChatConfig
}

ChatMemberCountConfig contains information about getting the number of users in a chat.

func (ChatMemberCountConfig) Method

func (ChatMemberCountConfig) Method() string

type ChatMemberUpdated

type ChatMemberUpdated struct {
	// Chat the user belongs to.
	Chat Chat `json:"chat"`
	// From is the performer of the action, which resulted in the change.
	From User `json:"from"`
	// Date the change was done in Unix time.
	Date int `json:"date"`
	// Previous information about the chat member.
	OldChatMember ChatMember `json:"old_chat_member"`
	// New information about the chat member.
	NewChatMember ChatMember `json:"new_chat_member"`
	// InviteLink is the link which was used by the user to join the chat;
	// for joining by invite link events only.
	//
	// optional
	InviteLink *ChatInviteLink `json:"invite_link"`
}

ChatMemberUpdated represents changes in the status of a chat member.

type ChatPermissions

type ChatPermissions struct {
	// CanSendMessages is true, if the user is allowed to send text messages,
	// contacts, locations and venues
	//
	// optional
	CanSendMessages bool `json:"can_send_messages,omitempty"`
	// CanSendMediaMessages is true, if the user is allowed to send audios,
	// documents, photos, videos, video notes and voice notes, implies
	// can_send_messages
	//
	// optional
	CanSendMediaMessages bool `json:"can_send_media_messages,omitempty"`
	// CanSendPolls is true, if the user is allowed to send polls, implies
	// can_send_messages
	//
	// optional
	CanSendPolls bool `json:"can_send_polls,omitempty"`
	// CanSendOtherMessages is true, if the user is allowed to send animations,
	// games, stickers and use inline bots, implies can_send_media_messages
	//
	// optional
	CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"`
	// CanAddWebPagePreviews is true, if the user is allowed to add web page
	// previews to their messages, implies can_send_media_messages
	//
	// optional
	CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"`
	// CanChangeInfo is true, if the user is allowed to change the chat title,
	// photo and other settings. Ignored in public supergroups
	//
	// optional
	CanChangeInfo bool `json:"can_change_info,omitempty"`
	// CanInviteUsers is true, if the user is allowed to invite new users to the
	// chat
	//
	// optional
	CanInviteUsers bool `json:"can_invite_users,omitempty"`
	// CanPinMessages is true, if the user is allowed to pin messages. Ignored
	// in public supergroups
	//
	// optional
	CanPinMessages bool `json:"can_pin_messages,omitempty"`
}

ChatPermissions describes actions that a non-administrator user is allowed to take in a chat. All fields are optional.

type ChatPhoto

type ChatPhoto struct {
	// SmallFileID is a file identifier of small (160x160) chat photo.
	// This file_id can be used only for photo download and
	// only for as long as the photo is not changed.
	SmallFileID string `json:"small_file_id"`
	// SmallFileUniqueID is a unique file identifier of small (160x160) chat
	// photo, which is supposed to be the same over time and for different bots.
	// Can't be used to download or reuse the file.
	SmallFileUniqueID string `json:"small_file_unique_id"`
	// BigFileID is a file identifier of big (640x640) chat photo.
	// This file_id can be used only for photo download and
	// only for as long as the photo is not changed.
	BigFileID string `json:"big_file_id"`
	// BigFileUniqueID is a file identifier of big (640x640) chat photo, which
	// is supposed to be the same over time and for different bots. Can't be
	// used to download or reuse the file.
	BigFileUniqueID string `json:"big_file_unique_id"`
}

ChatPhoto represents a chat photo.

type Chattable

type Chattable interface {
	Params() (Params, error)
	Method() string
}

Chattable is any config type that can be sent.

type ChosenInlineResult

type ChosenInlineResult struct {
	// ResultID the unique identifier for the result that was chosen
	ResultID string `json:"result_id"`
	// From the user that chose the result
	From *User `json:"from"`
	// Location sender location, only for bots that require user location
	//
	// optional
	Location *Location `json:"location,omitempty"`
	// InlineMessageID identifier of the sent inline message.
	// Available only if there is an inline keyboard attached to the message.
	// Will be also received in callback queries and can be used to edit the message.
	//
	// optional
	InlineMessageID string `json:"inline_message_id,omitempty"`
	// Query the query that was used to obtain the result
	Query string `json:"query"`
}

ChosenInlineResult is an inline query result chosen by a User

type CloseConfig

type CloseConfig struct{}

CloseConfig is a request to close the bot instance on a local server.

Note that you may not close an instance for the first 10 minutes after the bot has started.

func (CloseConfig) Method

func (CloseConfig) Method() string

func (CloseConfig) Params

func (CloseConfig) Params() (Params, error)

type Config

type Config struct {
	Token       string // 默认直接隐藏好了
	Debug       bool   // 小写
	ApiEndpoint string // 没啥用,放入配置
}

type Contact

type Contact struct {
	// PhoneNumber contact's phone number
	PhoneNumber string `json:"phone_number"`
	// FirstName contact's first name
	FirstName string `json:"first_name"`
	// LastName contact's last name
	//
	// optional
	LastName string `json:"last_name,omitempty"`
	// UserID contact's user identifier in Telegram
	//
	// optional
	UserID int64 `json:"user_id,omitempty"`
	// VCard is additional data about the contact in the form of a vCard.
	//
	// optional
	VCard string `json:"vcard,omitempty"`
}

Contact represents a phone contact.

Note that LastName and UserID may be empty.

type ContactConfig

type ContactConfig struct {
	BaseChat
	PhoneNumber string
	FirstName   string
	LastName    string
	VCard       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) Method

func (config ContactConfig) Method() string

func (ContactConfig) Params

func (config ContactConfig) Params() (Params, error)

type Context

type Context struct {
	Engine  *Engine
	Message Update

	ID string
}

func (*Context) CommandIs

func (c *Context) CommandIs(command string) bool

func (*Context) DownloadAndSave

func (c *Context) DownloadAndSave(fileID, fileDir string) string

func (*Context) GetFileDirectURL

func (c *Context) GetFileDirectURL(fileID string) string

func (*Context) IsMessageToMe

func (c *Context) IsMessageToMe(message Message) bool

func (*Context) NewEditListMessage

func (c *Context) NewEditListMessage(text string, ikb *InlineKeyboardMarkup) EditMessageTextConfig

func (*Context) NewMessage

func (c *Context) NewMessage(text string, ikb *InlineKeyboardMarkup) MessageConfig

func (*Context) ReplyText

func (c *Context) ReplyText(s string)

func (*Context) Send

func (c *Context) Send(ct Chattable) (Message, error)

func (*Context) SendText

func (c *Context) SendText(s string)

type CopyMessageConfig

type CopyMessageConfig struct {
	BaseChat
	FromChatID          int64
	FromChannelUsername string
	MessageID           int
	Caption             string
	ParseMode           string
	CaptionEntities     []MessageEntity
}

CopyMessageConfig contains information about a copyMessage request.

func NewCopyMessage

func NewCopyMessage(chatID int64, fromChatID int64, messageID int) CopyMessageConfig

NewCopyMessage creates a new copy message.

chatID is where to send it, fromChatID is the source chat, and messageID is the ID of the original message.

func (CopyMessageConfig) Method

func (config CopyMessageConfig) Method() string

func (CopyMessageConfig) Params

func (config CopyMessageConfig) Params() (Params, error)

type CreateChatInviteLinkConfig

type CreateChatInviteLinkConfig struct {
	ChatConfig
	ExpireDate  int
	MemberLimit int
}

CreateChatInviteLinkConfig allows you to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. The link can be revoked using the RevokeChatInviteLinkConfig.

func (CreateChatInviteLinkConfig) Method

func (CreateChatInviteLinkConfig) Params

func (config CreateChatInviteLinkConfig) Params() (Params, error)

type Credentials

type Credentials struct {
	Data SecureData `json:"secure_data"`
	// Nonce the same nonce given in the request
	Nonce string `json:"nonce"`
}

Credentials contains encrypted data.

type DataCredentials

type DataCredentials struct {
	// DataHash checksum of encrypted data
	DataHash string `json:"data_hash"`
	// Secret of encrypted data
	Secret string `json:"secret"`
}

DataCredentials contains information required to decrypt data.

type DeleteChatPhotoConfig

type DeleteChatPhotoConfig struct {
	ChatID          int64
	ChannelUsername string
}

DeleteChatPhotoConfig allows you to delete a group, supergroup, or channel's photo.

func NewDeleteChatPhoto

func NewDeleteChatPhoto(chatID int64, photo interface{}) DeleteChatPhotoConfig

NewDeleteChatPhoto allows you to delete the photo for a chat.

func (DeleteChatPhotoConfig) Method

func (config DeleteChatPhotoConfig) Method() string

func (DeleteChatPhotoConfig) Params

func (config DeleteChatPhotoConfig) Params() (Params, error)

type DeleteChatStickerSetConfig

type DeleteChatStickerSetConfig struct {
	ChatID             int64
	SuperGroupUsername string
}

DeleteChatStickerSetConfig allows you to remove a supergroup's sticker set.

func (DeleteChatStickerSetConfig) Method

func (config DeleteChatStickerSetConfig) Method() string

func (DeleteChatStickerSetConfig) Params

func (config DeleteChatStickerSetConfig) Params() (Params, error)

type DeleteMessageConfig

type DeleteMessageConfig struct {
	ChannelUsername string
	ChatID          int64
	MessageID       int
}

DeleteMessageConfig contains information of a message in a chat to delete.

func NewDeleteMessage

func NewDeleteMessage(chatID int64, messageID int) DeleteMessageConfig

NewDeleteMessage creates a request to delete a message.

func (DeleteMessageConfig) Method

func (config DeleteMessageConfig) Method() string

func (DeleteMessageConfig) Params

func (config DeleteMessageConfig) Params() (Params, error)

type DeleteStickerConfig

type DeleteStickerConfig struct {
	Sticker string
}

DeleteStickerConfig allows you to delete a sticker from a set.

func (DeleteStickerConfig) Method

func (config DeleteStickerConfig) Method() string

func (DeleteStickerConfig) Params

func (config DeleteStickerConfig) Params() (Params, error)

type DeleteWebhookConfig

type DeleteWebhookConfig struct {
	DropPendingUpdates bool
}

DeleteWebhookConfig is a helper to delete a webhook.

func (DeleteWebhookConfig) Method

func (config DeleteWebhookConfig) Method() string

func (DeleteWebhookConfig) Params

func (config DeleteWebhookConfig) Params() (Params, error)

type Dice

type Dice struct {
	// Emoji on which the dice throw animation is based
	Emoji string `json:"emoji"`
	// Value of the dice
	Value int `json:"value"`
}

Dice represents an animated emoji that displays a random value.

type DiceConfig

type DiceConfig struct {
	BaseChat
	// Emoji on which the dice throw animation is based.
	// Currently, must be one of 🎲, 🎯, 🏀, ⚽, 🎳, or 🎰.
	// Dice can have values 1-6 for 🎲, 🎯, and 🎳, values 1-5 for 🏀 and ⚽,
	// and values 1-64 for 🎰.
	// Defaults to “🎲”
	Emoji string
}

DiceConfig contains information about a sendDice request.

func NewDice

func NewDice(chatID int64) DiceConfig

NewDice allows you to send a random dice roll.

func NewDiceWithEmoji

func NewDiceWithEmoji(chatID int64, emoji string) DiceConfig

NewDiceWithEmoji allows you to send a random roll of one of many types.

Emoji may be 🎲 (1-6), 🎯 (1-6), or 🏀 (1-5).

func NewSendDice deprecated

func NewSendDice(chatID int64) DiceConfig

NewSendDice allows you to send a random dice roll.

Deprecated: Use NewDice instead.

func (DiceConfig) Method

func (config DiceConfig) Method() string

func (DiceConfig) Params

func (config DiceConfig) Params() (Params, error)

type Document

type Document struct {
	// FileID is a identifier for this file, which can be used to download or
	// reuse the file
	FileID string `json:"file_id"`
	// FileUniqueID is the 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"`
	// Thumbnail document thumbnail as defined by sender
	//
	// optional
	Thumbnail *PhotoSize `json:"thumb,omitempty"`
	// FileName original filename as defined by sender
	//
	// optional
	FileName string `json:"file_name,omitempty"`
	// MimeType  of the file as defined by sender
	//
	// optional
	MimeType string `json:"mime_type,omitempty"`
	// FileSize file size
	//
	// optional
	FileSize int `json:"file_size,omitempty"`
}

Document represents a general file.

type DocumentConfig

type DocumentConfig struct {
	BaseFile
	Thumb                       interface{}
	Caption                     string
	ParseMode                   string
	CaptionEntities             []MessageEntity
	DisableContentTypeDetection bool
}

DocumentConfig contains information about a SendDocument request.

func NewDocument

func NewDocument(chatID int64, file interface{}) DocumentConfig

NewDocument creates a new sendDocument request.

func (DocumentConfig) Files

func (config DocumentConfig) Files() []RequestFile

func (DocumentConfig) Method

func (config DocumentConfig) Method() string

func (DocumentConfig) Params

func (config DocumentConfig) Params() (Params, error)

type EditChatInviteLinkConfig

type EditChatInviteLinkConfig struct {
	ChatConfig
	InviteLink  string
	ExpireDate  int
	MemberLimit int
}

EditChatInviteLinkConfig allows you to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.

func (EditChatInviteLinkConfig) Method

func (EditChatInviteLinkConfig) Params

func (config EditChatInviteLinkConfig) Params() (Params, error)

type EditMessageCaptionConfig

type EditMessageCaptionConfig struct {
	BaseEdit
	Caption         string
	ParseMode       string
	CaptionEntities []MessageEntity
}

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

func (config EditMessageCaptionConfig) Method() string

func (EditMessageCaptionConfig) Params

func (config EditMessageCaptionConfig) Params() (Params, error)

type EditMessageLiveLocationConfig

type EditMessageLiveLocationConfig struct {
	BaseEdit
	Latitude             float64 // required
	Longitude            float64 // required
	HorizontalAccuracy   float64 // optional
	Heading              int     // optional
	ProximityAlertRadius int     // optional
}

EditMessageLiveLocationConfig allows you to update a live location.

func (EditMessageLiveLocationConfig) Method

func (config EditMessageLiveLocationConfig) Method() string

func (EditMessageLiveLocationConfig) Params

func (config EditMessageLiveLocationConfig) Params() (Params, error)

type EditMessageMediaConfig

type EditMessageMediaConfig struct {
	BaseEdit

	Media interface{}
}

EditMessageMediaConfig allows you to make an editMessageMedia request.

func (EditMessageMediaConfig) Files

func (config EditMessageMediaConfig) Files() []RequestFile

func (EditMessageMediaConfig) Method

func (EditMessageMediaConfig) Method() string

func (EditMessageMediaConfig) Params

func (config EditMessageMediaConfig) Params() (Params, error)

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, replyMarkup InlineKeyboardMarkup) EditMessageReplyMarkupConfig

NewEditMessageReplyMarkup allows you to edit the inline keyboard markup.

func (EditMessageReplyMarkupConfig) Method

func (config EditMessageReplyMarkupConfig) Method() string

func (EditMessageReplyMarkupConfig) Params

func (config EditMessageReplyMarkupConfig) Params() (Params, error)

type EditMessageTextConfig

type EditMessageTextConfig struct {
	BaseEdit
	Text                  string
	ParseMode             string
	Entities              []MessageEntity
	DisableWebPagePreview bool
}

EditMessageTextConfig allows you to modify the text in a message.

func NewEditMessageText

func NewEditMessageText(chatID int64, messageID int, text string) EditMessageTextConfig

NewEditMessageText allows you to edit the text of a message.

func NewEditMessageTextAndMarkup

func NewEditMessageTextAndMarkup(chatID int64, messageID int, text string, replyMarkup InlineKeyboardMarkup) EditMessageTextConfig

NewEditMessageTextAndMarkup allows you to edit the text and replymarkup of a message.

func (EditMessageTextConfig) Method

func (config EditMessageTextConfig) Method() string

func (EditMessageTextConfig) Params

func (config EditMessageTextConfig) Params() (Params, error)

type EncryptedCredentials

type EncryptedCredentials struct {
	// Base64-encoded encrypted JSON-serialized data with unique user's
	// payload, data hashes and secrets required for EncryptedPassportElement
	// decryption and authentication
	Data string `json:"data"`

	// Base64-encoded data hash for data authentication
	Hash string `json:"hash"`

	// Base64-encoded secret, encrypted with the bot's public RSA key,
	// required for data decryption
	Secret string `json:"secret"`
}

EncryptedCredentials contains data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes.

type EncryptedPassportElement

type EncryptedPassportElement struct {
	// Element type.
	Type string `json:"type"`

	// Base64-encoded encrypted Telegram Passport element data provided by
	// the user, available for "personal_details", "passport",
	// "driver_license", "identity_card", "identity_passport" and "address"
	// types. Can be decrypted and verified using the accompanying
	// EncryptedCredentials.
	Data string `json:"data,omitempty"`

	// User's verified phone number, available only for "phone_number" type
	PhoneNumber string `json:"phone_number,omitempty"`

	// User's verified email address, available only for "email" type
	Email string `json:"email,omitempty"`

	// Array of encrypted files with documents provided by the user,
	// available for "utility_bill", "bank_statement", "rental_agreement",
	// "passport_registration" and "temporary_registration" types. Files can
	// be decrypted and verified using the accompanying EncryptedCredentials.
	Files []PassportFile `json:"files,omitempty"`

	// Encrypted file with the front side of the document, provided by the
	// user. Available for "passport", "driver_license", "identity_card" and
	// "internal_passport". The file can be decrypted and verified using the
	// accompanying EncryptedCredentials.
	FrontSide *PassportFile `json:"front_side,omitempty"`

	// Encrypted file with the reverse side of the document, provided by the
	// user. Available for "driver_license" and "identity_card". The file can
	// be decrypted and verified using the accompanying EncryptedCredentials.
	ReverseSide *PassportFile `json:"reverse_side,omitempty"`

	// Encrypted file with the selfie of the user holding a document,
	// provided by the user; available for "passport", "driver_license",
	// "identity_card" and "internal_passport". The file can be decrypted
	// and verified using the accompanying EncryptedCredentials.
	Selfie *PassportFile `json:"selfie,omitempty"`
}

EncryptedPassportElement contains information about documents or other Telegram Passport elements shared with the bot by the user.

type Engine

type Engine struct {
	Token string `json:"token"`
	Debug bool   `json:"debug"`

	Self   User       `json:"-"`
	Client HTTPClient `json:"-"`

	UpdateConfig UpdateConfig
	// contains filtered or unexported fields
}

Engine allows you to interact with the Telegram Bot API.

func New

func New(token string) (*Engine, error)

New creates a new Engine instance.

It requires a token, provided by @BotFather on Telegram.

func NewEngine

func NewEngine(token, apiEndpoint string, client HTTPClient) (*Engine, error)

NewEngine creates a new Engine instance and allows you to pass a http.Client.

It requires a token, provided by @BotFather on Telegram and API endpoint.

func (*Engine) CopyMessage

func (bot *Engine) CopyMessage(config CopyMessageConfig) (MessageID, error)

CopyMessage copy messages of any kind. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageID of the sent message on success.

func (*Engine) GetChat

func (bot *Engine) GetChat(config ChatInfoConfig) (Chat, error)

GetChat gets information about a chat.

func (*Engine) GetChatAdministrators

func (bot *Engine) GetChatAdministrators(config ChatAdministratorsConfig) ([]ChatMember, error)

GetChatAdministrators gets a list of administrators in the chat.

If none have been appointed, only the creator will be returned. Bots are not shown, even if they are an administrator.

func (*Engine) GetChatMember

func (bot *Engine) GetChatMember(config GetChatMemberConfig) (ChatMember, error)

GetChatMember gets a specific chat member.

func (*Engine) GetChatMembersCount

func (bot *Engine) GetChatMembersCount(config ChatMemberCountConfig) (int, error)

GetChatMembersCount gets the number of users in a chat.

func (*Engine) GetFile

func (bot *Engine) GetFile(config FileConfig) (File, error)

GetFile returns a File which can download a file from Telegram.

Requires FileID.

func (*Engine) GetFileDirectURL

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

GetFileDirectURL returns direct URL to file

It requires the FileID.

func (*Engine) GetGameHighScores

func (bot *Engine) GetGameHighScores(config GetGameHighScoresConfig) ([]GameHighScore, error)

GetGameHighScores allows you to get the high scores for a game.

func (bot *Engine) GetInviteLink(config ChatInviteLinkConfig) (string, error)

GetInviteLink get InviteLink for a chat

func (*Engine) GetMe

func (bot *Engine) 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 Engine.Self without the need for another request.

func (*Engine) GetMyCommands

func (bot *Engine) GetMyCommands() ([]BotCommand, error)

GetMyCommands gets the currently registered commands.

func (*Engine) GetStickerSet

func (bot *Engine) GetStickerSet(config GetStickerSetConfig) (StickerSet, error)

GetStickerSet returns a StickerSet.

func (*Engine) GetUpdates

func (bot *Engine) GetUpdates(config UpdateConfig) ([]Update, error)

GetUpdates fetches updates. If a WebHook is set, this will not return any data!

Offset, Limit, Timeout, and AllowedUpdates 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 (*Engine) GetUserProfilePhotos

func (bot *Engine) GetUserProfilePhotos(config UserProfilePhotosConfig) (UserProfilePhotos, error)

GetUserProfilePhotos gets a user's profile photos.

It requires UserID. Offset and Limit are optional.

func (*Engine) GetWebhookInfo

func (bot *Engine) GetWebhookInfo() (WebhookInfo, error)

GetWebhookInfo allows you to fetch information about a webhook and if one currently is set, along with pending update count and error messages.

func (*Engine) HandleUpdate

func (bot *Engine) HandleUpdate(r *http.Request) (*Update, error)

HandleUpdate parses and returns update received via webhook

func (*Engine) IsMessageToMe

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

IsMessageToMe returns true if message directed to this bot.

It requires the Message.

func (*Engine) ListenForWebhook

func (bot *Engine) ListenForWebhook(w http.ResponseWriter, r *http.Request)

ListenForWebhook return a http func

func (*Engine) MakeRequest

func (bot *Engine) MakeRequest(endpoint string, params Params) (*APIResponse, error)

MakeRequest makes a request to a specific endpoint with our token.

func (*Engine) Request

func (bot *Engine) Request(c Chattable) (*APIResponse, error)

Request sends a Chattable to Telegram, and returns the APIResponse.

func (*Engine) Run

func (bot *Engine) Run()

Run starts and returns a channel for getting updates.

func (*Engine) Send

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

Send will send a Chattable item to Telegram and provides the returned Message.

func (*Engine) SendMediaGroup

func (bot *Engine) SendMediaGroup(config MediaGroupConfig) ([]Message, error)

SendMediaGroup sends a media group and returns the resulting messages.

func (*Engine) SendSet

func (bot *Engine) SendSet(c Chattable) (bool, error)

SendSet will send a Chattable item to Telegram and provides the returned Message.

func (*Engine) SetAPIEndpoint

func (bot *Engine) SetAPIEndpoint(apiEndpoint string)

SetAPIEndpoint changes the Telegram Bot API endpoint used by the instance.

func (*Engine) SetAdapter

func (bot *Engine) SetAdapter(adapters ...Adapter)

func (*Engine) Stop

func (bot *Engine) Stop()

Stop stops the go routine which receives updates

func (*Engine) StopPoll

func (bot *Engine) StopPoll(config StopPollConfig) (Poll, error)

StopPoll stops a poll and returns the result.

func (*Engine) UploadFiles

func (bot *Engine) UploadFiles(endpoint string, params Params, files []RequestFile) (*APIResponse, error)

UploadFiles makes a request to the API with files.

func (*Engine) Username

func (bot *Engine) Username() string

type Error

type Error struct {
	Code    int
	Message string
	ResponseParameters
}

Error is an error containing extra information returned by the Telegram API.

func (Error) Error

func (e Error) Error() string

Error message string.

type File

type File struct {
	// FileID identifier for this file, which can be used to download or reuse
	// the file
	FileID string `json:"file_id"`
	// FileUniqueID is the 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"`
	// FileSize file size, if known
	//
	// optional
	FileSize int `json:"file_size,omitempty"`
	// FilePath file path
	//
	// optional
	FilePath string `json:"file_path,omitempty"`
}

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.

type FileBytes

type FileBytes struct {
	Name  string
	Bytes []byte
}

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

type FileConfig

type FileConfig struct {
	FileID string
}

FileConfig has information about a file hosted on Telegram.

func (FileConfig) Method

func (FileConfig) Method() string

func (FileConfig) Params

func (config FileConfig) Params() (Params, error)

type FileCredentials

type FileCredentials struct {
	// FileHash checksum of encrypted data
	FileHash string `json:"file_hash"`
	// Secret of encrypted data
	Secret string `json:"secret"`
}

FileCredentials contains information required to decrypt files.

type FileID

type FileID string

FileID is an ID of a file already uploaded to Telegram.

type FileReader

type FileReader struct {
	Name   string
	Reader io.Reader
}

FileReader contains information about a reader to upload as a File.

type FileURL

type FileURL string

FileURL is a URL to use as a file for a request.

type Fileable

type Fileable interface {
	Chattable
	Files() []RequestFile
}

Fileable is any config type that can be sent that includes a file.

type ForceReply

type ForceReply struct {
	// ForceReply shows reply interface to the user,
	// as if they manually selected the bot's message and tapped 'Reply'.
	ForceReply bool `json:"force_reply"`
	// Selective use this parameter if you want to force reply from specific users only.
	// Targets:
	//  1) users that are @mentioned in the text of the Message object;
	//  2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
	//
	// optional
	Selective bool `json:"selective,omitempty"`
}

ForceReply when receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.

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

func (config ForwardConfig) Method() string

func (ForwardConfig) Params

func (config ForwardConfig) Params() (Params, error)

type Game

type Game struct {
	// Title of the game
	Title string `json:"title"`
	// Description of the game
	Description string `json:"description"`
	// Photo that will be displayed in the game message in chats.
	Photo []PhotoSize `json:"photo"`
	// Text a brief description of the game or high scores included in the game message.
	// Can be automatically edited to include current high scores for the game
	// when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters.
	//
	// optional
	Text string `json:"text,omitempty"`
	// TextEntities special entities that appear in text, such as usernames, URLs, bot commands, etc.
	//
	// optional
	TextEntities []MessageEntity `json:"text_entities,omitempty"`
	// Animation animation that will be displayed in the game message in chats.
	// Upload via BotFather (https://t.me/botfather).
	//
	// optional
	Animation Animation `json:"animation,omitempty"`
}

Game represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.

type GameConfig

type GameConfig struct {
	BaseChat
	GameShortName string
}

GameConfig allows you to send a game.

func (GameConfig) Method

func (config GameConfig) Method() string

func (GameConfig) Params

func (config GameConfig) Params() (Params, error)

type GameHighScore

type GameHighScore struct {
	// Position in high score table for the game
	Position int `json:"position"`
	// User user
	User User `json:"user"`
	// Score score
	Score int `json:"score"`
}

GameHighScore is a user's score and position on the leaderboard.

type GetChatMemberConfig

type GetChatMemberConfig struct {
	ChatConfigWithUser
}

GetChatMemberConfig is information about getting a specific member in a chat.

func (GetChatMemberConfig) Method

func (GetChatMemberConfig) Method() string

type GetGameHighScoresConfig

type GetGameHighScoresConfig struct {
	UserID          int64
	ChatID          int64
	ChannelUsername string
	MessageID       int
	InlineMessageID string
}

GetGameHighScoresConfig allows you to fetch the high scores for a game.

func (GetGameHighScoresConfig) Method

func (config GetGameHighScoresConfig) Method() string

func (GetGameHighScoresConfig) Params

func (config GetGameHighScoresConfig) Params() (Params, error)

type GetMyCommandsConfig

type GetMyCommandsConfig struct{}

GetMyCommandsConfig gets a list of the currently registered commands.

func (GetMyCommandsConfig) Method

func (config GetMyCommandsConfig) Method() string

func (GetMyCommandsConfig) Params

func (config GetMyCommandsConfig) Params() (Params, error)

type GetStickerSetConfig

type GetStickerSetConfig struct {
	Name string
}

GetStickerSetConfig allows you to get the stickers in a set.

func (GetStickerSetConfig) Method

func (config GetStickerSetConfig) Method() string

func (GetStickerSetConfig) Params

func (config GetStickerSetConfig) Params() (Params, error)

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
	PostForm(url string, data url.Values) (*http.Response, error)
}

HTTPClient is the type needed for the bot to perform HTTP requests.

func NewProxyClient

func NewProxyClient(proxyUrl string) (HTTPClient, error)

type Handler

type Handler func(*Context) error

type IDDocumentData

type IDDocumentData struct {
	DocumentNumber string `json:"document_no"`
	ExpiryDate     string `json:"expiry_date"`
}

IDDocumentData https://core.telegram.org/passport#iddocumentdata

type InlineConfig

type InlineConfig struct {
	InlineQueryID     string        `json:"inline_query_id"`
	Results           []interface{} `json:"results"`
	CacheTime         int           `json:"cache_time"`
	IsPersonal        bool          `json:"is_personal"`
	NextOffset        string        `json:"next_offset"`
	SwitchPMText      string        `json:"switch_pm_text"`
	SwitchPMParameter string        `json:"switch_pm_parameter"`
}

InlineConfig contains information on making an InlineQuery response.

func (InlineConfig) Method

func (config InlineConfig) Method() string

func (InlineConfig) Params

func (config InlineConfig) Params() (Params, error)

type InlineKeyboardButton

type InlineKeyboardButton struct {
	// Text label text on the button
	Text string `json:"text"`
	// URL HTTP or tg:// url to be opened when button is pressed.
	//
	// optional
	URL *string `json:"url,omitempty"`
	// LoginURL is an HTTP URL used to automatically authorize the user. Can be
	// used as a replacement for the Telegram Login Widget
	//
	// optional
	LoginURL *LoginURL `json:"login_url,omitempty"`
	// CallbackData data to be sent in a callback query to the bot when button is pressed, 1-64 bytes.
	//
	// optional
	CallbackData *string `json:"callback_data,omitempty"`
	// SwitchInlineQuery 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.
	// Can be empty, in which case just the bot's username will be inserted.
	//
	// This offers an easy way for users to start using your bot
	// in inline mode when they are currently in a private chat with it.
	// Especially useful when combined with switch_pm… actions – in this case
	// the user will be automatically returned to the chat they switched from,
	// skipping the chat selection screen.
	//
	// optional
	SwitchInlineQuery *string `json:"switch_inline_query,omitempty"`
	// SwitchInlineQueryCurrentChat if set, pressing the button will insert the bot's username
	// and the specified inline query in the current chat's input field.
	// Can 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.
	//
	// optional
	SwitchInlineQueryCurrentChat *string `json:"switch_inline_query_current_chat,omitempty"`
	// CallbackGame description of the game that will be launched when the user presses the button.
	//
	// optional
	CallbackGame *CallbackGame `json:"callback_game,omitempty"`
	// Pay specify True, to send a Pay button.
	//
	// NOTE: This type of button must always be the first button in the first row.
	//
	// optional
	Pay bool `json:"pay,omitempty"`
}

InlineKeyboardButton represents one button of an inline keyboard. You must use exactly one of the optional fields.

Note that some values are references as even an empty string will change behavior.

CallbackGame, if set, MUST be first button in first row.

func NewInlineKeyboardButtonData

func NewInlineKeyboardButtonData(text, data string) InlineKeyboardButton

NewInlineKeyboardButtonData creates an inline keyboard button with text and data for a callback.

func NewInlineKeyboardButtonLoginURL

func NewInlineKeyboardButtonLoginURL(text string, loginURL LoginURL) InlineKeyboardButton

NewInlineKeyboardButtonLoginURL creates an inline keyboard button with text which goes to a LoginURL.

func NewInlineKeyboardButtonSwitch

func NewInlineKeyboardButtonSwitch(text, sw string) InlineKeyboardButton

NewInlineKeyboardButtonSwitch creates an inline keyboard button with text which allows the user to switch to a chat or return to a chat.

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.

type InlineKeyboardMarkup

type InlineKeyboardMarkup struct {
	// InlineKeyboard array of button rows, each represented by an Array of
	// InlineKeyboardButton objects
	InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
}

InlineKeyboardMarkup represents an inline keyboard that appears right next to the message it belongs to.

func NewInlineKeyboardMarkup

func NewInlineKeyboardMarkup(rows ...[]InlineKeyboardButton) InlineKeyboardMarkup

NewInlineKeyboardMarkup creates a new inline keyboard.

type InlineQuery

type InlineQuery struct {
	// ID unique identifier for this query
	ID string `json:"id"`
	// From sender
	From *User `json:"from"`
	// Query text of the query (up to 256 characters).
	Query string `json:"query"`
	// Offset of the results to be returned, can be controlled by the bot.
	Offset string `json:"offset"`
	// Type of the chat, from which the inline query was sent. Can be either
	// “sender” for a private chat with the inline query sender, “private”,
	// “group”, “supergroup”, or “channel”. The chat type should be always known
	// for requests sent from official clients and most third-party clients,
	// unless the request was sent from a secret chat
	//
	// optional
	ChatType string `json:"chat_type"`
	// Location sender location, only for bots that request user location.
	//
	// optional
	Location *Location `json:"location,omitempty"`
}

InlineQuery is a Query from Telegram for an inline request.

type InlineQueryResultArticle

type InlineQueryResultArticle struct {
	// Type of the result, must be article.
	Type string `json:"type"`
	// ID unique identifier for this result, 1-64 Bytes.
	ID string `json:"id"`
	// Title of the result
	Title string `json:"title"`
	// InputMessageContent content of the message to be sent.
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
	// ReplyMarkup Inline keyboard attached to the message.
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// URL of the result.
	//
	// optional
	URL string `json:"url,omitempty"`
	// HideURL pass True, if you don't want the URL to be shown in the message.
	//
	// optional
	HideURL bool `json:"hide_url,omitempty"`
	// Description short description of the result.
	//
	// optional
	Description string `json:"description,omitempty"`
	// ThumbURL url of the thumbnail for the result
	//
	// optional
	ThumbURL string `json:"thumb_url,omitempty"`
	// ThumbWidth thumbnail width
	//
	// optional
	ThumbWidth int `json:"thumb_width,omitempty"`
	// ThumbHeight thumbnail height
	//
	// optional
	ThumbHeight int `json:"thumb_height,omitempty"`
}

InlineQueryResultArticle represents a link to an article or web page.

func NewInlineQueryResultArticle

func NewInlineQueryResultArticle(id, title, messageText string) InlineQueryResultArticle

NewInlineQueryResultArticle creates a new inline query article.

func NewInlineQueryResultArticleHTML

func NewInlineQueryResultArticleHTML(id, title, messageText string) InlineQueryResultArticle

NewInlineQueryResultArticleHTML creates a new inline query article with HTML parsing.

func NewInlineQueryResultArticleMarkdown

func NewInlineQueryResultArticleMarkdown(id, title, messageText string) InlineQueryResultArticle

NewInlineQueryResultArticleMarkdown creates a new inline query article with Markdown parsing.

func NewInlineQueryResultArticleMarkdownV2

func NewInlineQueryResultArticleMarkdownV2(id, title, messageText string) InlineQueryResultArticle

NewInlineQueryResultArticleMarkdownV2 creates a new inline query article with MarkdownV2 parsing.

type InlineQueryResultAudio

type InlineQueryResultAudio struct {
	// Type of the result, must be audio
	Type string `json:"type"`
	// ID unique identifier for this result, 1-64 bytes
	ID string `json:"id"`
	// URL a valid url for the audio file
	URL string `json:"audio_url"`
	// Title is a title
	Title string `json:"title"`
	// Caption 0-1024 characters after entities parsing
	//
	// optional
	Caption string `json:"caption,omitempty"`
	// ParseMode mode for parsing entities in the video caption.
	// See formatting options for more details
	// (https://core.telegram.org/bots/api#formatting-options).
	//
	// optional
	ParseMode string `json:"parse_mode,omitempty"`
	// CaptionEntities is a list of special entities that appear in the caption,
	// which can be specified instead of parse_mode
	//
	// optional
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Performer is a performer
	//
	// optional
	Performer string `json:"performer,omitempty"`
	// Duration audio duration in seconds
	//
	// optional
	Duration int `json:"audio_duration,omitempty"`
	// ReplyMarkup inline keyboard attached to the message
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// InputMessageContent content of the message to be sent instead of the audio
	//
	// optional
	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.

type InlineQueryResultCachedAudio

type InlineQueryResultCachedAudio struct {
	// Type of the result, must be audio
	Type string `json:"type"`
	// ID unique identifier for this result, 1-64 bytes
	ID string `json:"id"`
	// AudioID a valid file identifier for the audio file
	AudioID string `json:"audio_file_id"`
	// Caption 0-1024 characters after entities parsing
	//
	// optional
	Caption string `json:"caption,omitempty"`
	// ParseMode mode for parsing entities in the video caption.
	// See formatting options for more details
	// (https://core.telegram.org/bots/api#formatting-options).
	//
	// optional
	ParseMode string `json:"parse_mode,omitempty"`
	// CaptionEntities is a list of special entities that appear in the caption,
	// which can be specified instead of parse_mode
	//
	// optional
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// ReplyMarkup inline keyboard attached to the message
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// InputMessageContent content of the message to be sent instead of the audio
	//
	// optional
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
}

InlineQueryResultCachedAudio is an inline query response with cached audio.

func NewInlineQueryResultCachedAudio

func NewInlineQueryResultCachedAudio(id, audioID string) InlineQueryResultCachedAudio

NewInlineQueryResultCachedAudio create a new inline query with cached photo.

type InlineQueryResultCachedDocument

type InlineQueryResultCachedDocument struct {
	// Type of the result, must be document
	Type string `json:"type"`
	// ID unique identifier for this result, 1-64 bytes
	ID string `json:"id"`
	// DocumentID a valid file identifier for the file
	DocumentID string `json:"document_file_id"`
	// Title for the result
	//
	// optional
	Title string `json:"title,omitempty"`
	// Caption of the document to be sent, 0-1024 characters after entities parsing
	//
	// optional
	Caption string `json:"caption,omitempty"`
	// Description short description of the result
	//
	// optional
	Description string `json:"description,omitempty"`
	// ParseMode mode for parsing entities in the video caption.
	//	// See formatting options for more details
	//	// (https://core.telegram.org/bots/api#formatting-options).
	//
	// optional
	ParseMode string `json:"parse_mode,omitempty"`
	// CaptionEntities is a list of special entities that appear in the caption,
	// which can be specified instead of parse_mode
	//
	// optional
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// ReplyMarkup inline keyboard attached to the message
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// InputMessageContent content of the message to be sent instead of the file
	//
	// optional
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
}

InlineQueryResultCachedDocument is an inline query response with cached document.

func NewInlineQueryResultCachedDocument

func NewInlineQueryResultCachedDocument(id, documentID, title string) InlineQueryResultCachedDocument

NewInlineQueryResultCachedDocument create a new inline query with cached photo.

type InlineQueryResultCachedGIF

type InlineQueryResultCachedGIF struct {
	// Type of the result, must be gif.
	Type string `json:"type"`
	// ID unique identifier for this result, 1-64 bytes.
	ID string `json:"id"`
	// GifID a valid file identifier for the GIF file.
	GIFID string `json:"gif_file_id"`
	// Title for the result
	//
	// optional
	Title string `json:"title,omitempty"`
	// Caption of the GIF file to be sent, 0-1024 characters after entities parsing.
	//
	// optional
	Caption string `json:"caption,omitempty"`
	// ParseMode mode for parsing entities in the caption.
	// See formatting options for more details
	// (https://core.telegram.org/bots/api#formatting-options).
	//
	// optional
	ParseMode string `json:"parse_mode,omitempty"`
	// CaptionEntities is a list of special entities that appear in the caption,
	// which can be specified instead of parse_mode
	//
	// optional
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// ReplyMarkup inline keyboard attached to the message.
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// InputMessageContent content of the message to be sent instead of the GIF animation.
	//
	// optional
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
}

InlineQueryResultCachedGIF is an inline query response with cached gif.

func NewInlineQueryResultCachedGIF

func NewInlineQueryResultCachedGIF(id, gifID string) InlineQueryResultCachedGIF

NewInlineQueryResultCachedGIF create a new inline query with cached photo.

type InlineQueryResultCachedMPEG4GIF

type InlineQueryResultCachedMPEG4GIF struct {
	// Type of the result, must be mpeg4_gif
	Type string `json:"type"`
	// ID unique identifier for this result, 1-64 bytes
	ID string `json:"id"`
	// MPEG4FileID a valid file identifier for the MP4 file
	MPEG4FileID string `json:"mpeg4_file_id"`
	// Title for the result
	//
	// optional
	Title string `json:"title,omitempty"`
	// Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing.
	//
	// optional
	Caption string `json:"caption,omitempty"`
	// ParseMode mode for parsing entities in the caption.
	// See formatting options for more details
	// (https://core.telegram.org/bots/api#formatting-options).
	//
	// optional
	ParseMode string `json:"parse_mode,omitempty"`
	// ParseMode mode for parsing entities in the video caption.
	// See formatting options for more details
	// (https://core.telegram.org/bots/api#formatting-options).
	//
	// optional
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// ReplyMarkup inline keyboard attached to the message.
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// InputMessageContent content of the message to be sent instead of the video animation.
	//
	// optional
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
}

InlineQueryResultCachedMPEG4GIF is an inline query response with cached H.264/MPEG-4 AVC video without sound gif.

func NewInlineQueryResultCachedMPEG4GIF

func NewInlineQueryResultCachedMPEG4GIF(id, MPEG4GIFID string) InlineQueryResultCachedMPEG4GIF

NewInlineQueryResultCachedMPEG4GIF create a new inline query with cached MPEG4 GIF.

type InlineQueryResultCachedPhoto

type InlineQueryResultCachedPhoto struct {
	// Type of the result, must be photo.
	Type string `json:"type"`
	// ID unique identifier for this result, 1-64 bytes.
	ID string `json:"id"`
	// PhotoID a valid file identifier of the photo.
	PhotoID string `json:"photo_file_id"`
	// Title for the result.
	//
	// optional
	Title string `json:"title,omitempty"`
	// Description short description of the result.
	//
	// optional
	Description string `json:"description,omitempty"`
	// Caption of the photo to be sent, 0-1024 characters after entities parsing.
	//
	// optional
	Caption string `json:"caption,omitempty"`
	// ParseMode mode for parsing entities in the photo caption.
	// See formatting options for more details
	// (https://core.telegram.org/bots/api#formatting-options).
	//
	// optional
	ParseMode string `json:"parse_mode,omitempty"`
	// CaptionEntities is a list of special entities that appear in the caption,
	// which can be specified instead of parse_mode
	//
	// optional
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// ReplyMarkup inline keyboard attached to the message.
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// InputMessageContent content of the message to be sent instead of the photo.
	//
	// optional
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
}

InlineQueryResultCachedPhoto is an inline query response with cached photo.

func NewInlineQueryResultCachedPhoto

func NewInlineQueryResultCachedPhoto(id, photoID string) InlineQueryResultCachedPhoto

NewInlineQueryResultCachedPhoto create a new inline query with cached photo.

type InlineQueryResultCachedSticker

type InlineQueryResultCachedSticker struct {
	// Type of the result, must be sticker
	Type string `json:"type"`
	// ID unique identifier for this result, 1-64 bytes
	ID string `json:"id"`
	// StickerID a valid file identifier of the sticker
	StickerID string `json:"sticker_file_id"`
	// Title is a title
	Title string `json:"title"`
	// ReplyMarkup inline keyboard attached to the message
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// InputMessageContent content of the message to be sent instead of the sticker
	//
	// optional
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
}

InlineQueryResultCachedSticker is an inline query response with cached sticker.

func NewInlineQueryResultCachedSticker

func NewInlineQueryResultCachedSticker(id, stickerID, title string) InlineQueryResultCachedSticker

NewInlineQueryResultCachedSticker create a new inline query with cached sticker.

type InlineQueryResultCachedVideo

type InlineQueryResultCachedVideo struct {
	// Type of the result, must be video
	Type string `json:"type"`
	// ID unique identifier for this result, 1-64 bytes
	ID string `json:"id"`
	// VideoID a valid file identifier for the video file
	VideoID string `json:"video_file_id"`
	// Title for the result
	Title string `json:"title"`
	// Description short description of the result
	//
	// optional
	Description string `json:"description,omitempty"`
	// Caption of the video to be sent, 0-1024 characters after entities parsing
	//
	// optional
	Caption string `json:"caption,omitempty"`
	// ParseMode mode for parsing entities in the video caption.
	// See formatting options for more details
	// (https://core.telegram.org/bots/api#formatting-options).
	//
	// optional
	ParseMode string `json:"parse_mode,omitempty"`
	// CaptionEntities is a list of special entities that appear in the caption,
	// which can be specified instead of parse_mode
	//
	// optional
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// ReplyMarkup inline keyboard attached to the message
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// InputMessageContent content of the message to be sent instead of the video
	//
	// optional
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
}

InlineQueryResultCachedVideo is an inline query response with cached video.

func NewInlineQueryResultCachedVideo

func NewInlineQueryResultCachedVideo(id, videoID, title string) InlineQueryResultCachedVideo

NewInlineQueryResultCachedVideo create a new inline query with cached video.

type InlineQueryResultCachedVoice

type InlineQueryResultCachedVoice struct {
	// Type of the result, must be voice
	Type string `json:"type"`
	// ID unique identifier for this result, 1-64 bytes
	ID string `json:"id"`
	// VoiceID a valid file identifier for the voice message
	VoiceID string `json:"voice_file_id"`
	// Title voice message title
	Title string `json:"title"`
	// Caption 0-1024 characters after entities parsing
	//
	// optional
	Caption string `json:"caption,omitempty"`
	// ParseMode mode for parsing entities in the video caption.
	// See formatting options for more details
	// (https://core.telegram.org/bots/api#formatting-options).
	//
	// optional
	ParseMode string `json:"parse_mode,omitempty"`
	// CaptionEntities is a list of special entities that appear in the caption,
	// which can be specified instead of parse_mode
	//
	// optional
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// ReplyMarkup inline keyboard attached to the message
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// InputMessageContent content of the message to be sent instead of the voice message
	//
	// optional
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
}

InlineQueryResultCachedVoice is an inline query response with cached voice.

func NewInlineQueryResultCachedVoice

func NewInlineQueryResultCachedVoice(id, voiceID, title string) InlineQueryResultCachedVoice

NewInlineQueryResultCachedVoice create a new inline query with cached photo.

type InlineQueryResultContact

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

InlineQueryResultContact is an inline query response contact.

type InlineQueryResultDocument

type InlineQueryResultDocument struct {
	// Type of the result, must be document
	Type string `json:"type"`
	// ID unique identifier for this result, 1-64 bytes
	ID string `json:"id"`
	// Title for the result
	Title string `json:"title"`
	// Caption of the document to be sent, 0-1024 characters after entities parsing
	//
	// optional
	Caption string `json:"caption,omitempty"`
	// URL a valid url for the file
	URL string `json:"document_url"`
	// MimeType of the content of the file, either “application/pdf” or “application/zip”
	MimeType string `json:"mime_type"`
	// Description short description of the result
	//
	// optional
	Description string `json:"description,omitempty"`
	// ReplyMarkup nline keyboard attached to the message
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// InputMessageContent content of the message to be sent instead of the file
	//
	// optional
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
	// ThumbURL url of the thumbnail (jpeg only) for the file
	//
	// optional
	ThumbURL string `json:"thumb_url,omitempty"`
	// ThumbWidth thumbnail width
	//
	// optional
	ThumbWidth int `json:"thumb_width,omitempty"`
	// ThumbHeight thumbnail height
	//
	// optional
	ThumbHeight int `json:"thumb_height,omitempty"`
}

InlineQueryResultDocument is an inline query response document.

func NewInlineQueryResultDocument

func NewInlineQueryResultDocument(id, url, title, mimeType string) InlineQueryResultDocument

NewInlineQueryResultDocument creates a new inline query document.

type InlineQueryResultGIF

type InlineQueryResultGIF struct {
	// Type of the result, must be gif.
	Type string `json:"type"`
	// ID unique identifier for this result, 1-64 bytes.
	ID string `json:"id"`
	// URL a valid URL for the GIF file. File size must not exceed 1MB.
	URL string `json:"gif_url"`
	// ThumbURL url of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result.
	ThumbURL string `json:"thumb_url"`
	// Width of the GIF
	//
	// optional
	Width int `json:"gif_width,omitempty"`
	// Height of the GIF
	//
	// optional
	Height int `json:"gif_height,omitempty"`
	// Duration of the GIF
	//
	// optional
	Duration int `json:"gif_duration,omitempty"`
	// Title for the result
	//
	// optional
	Title string `json:"title,omitempty"`
	// Caption of the GIF file to be sent, 0-1024 characters after entities parsing.
	//
	// optional
	Caption string `json:"caption,omitempty"`
	// ParseMode mode for parsing entities in the video caption.
	// See formatting options for more details
	// (https://core.telegram.org/bots/api#formatting-options).
	//
	// optional
	ParseMode string `json:"parse_mode,omitempty"`
	// CaptionEntities is a list of special entities that appear in the caption,
	// which can be specified instead of parse_mode
	//
	// optional
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// ReplyMarkup inline keyboard attached to the message
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// InputMessageContent content of the message to be sent instead of the GIF animation.
	//
	// optional
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
}

InlineQueryResultGIF is an inline query response GIF.

func NewInlineQueryResultGIF

func NewInlineQueryResultGIF(id, url string) InlineQueryResultGIF

NewInlineQueryResultGIF creates a new inline query GIF.

type InlineQueryResultGame

type InlineQueryResultGame struct {
	// Type of the result, must be game
	Type string `json:"type"`
	// ID unique identifier for this result, 1-64 bytes
	ID string `json:"id"`
	// GameShortName short name of the game
	GameShortName string `json:"game_short_name"`
	// ReplyMarkup inline keyboard attached to the message
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

InlineQueryResultGame is an inline query response game.

type InlineQueryResultLocation

type InlineQueryResultLocation struct {
	// Type of the result, must be location
	Type string `json:"type"`
	// ID unique identifier for this result, 1-64 Bytes
	ID string `json:"id"`
	// Latitude  of the location in degrees
	Latitude float64 `json:"latitude"`
	// Longitude of the location in degrees
	Longitude float64 `json:"longitude"`
	// Title of the location
	Title string `json:"title"`
	// HorizontalAccuracy is the radius of uncertainty for the location,
	// measured in meters; 0-1500
	//
	// optional
	HorizontalAccuracy float64 `json:"horizontal_accuracy"`
	// LivePeriod is the period in seconds for which the location can be
	// updated, should be between 60 and 86400.
	//
	// optional
	LivePeriod int `json:"live_period"`
	// Heading is for live locations, a direction in which the user is moving,
	// in degrees. Must be between 1 and 360 if specified.
	//
	// optional
	Heading int `json:"heading"`
	// ProximityAlertRadius is for live locations, a maximum distance for
	// proximity alerts about approaching another chat member, in meters. Must
	// be between 1 and 100000 if specified.
	//
	// optional
	ProximityAlertRadius int `json:"proximity_alert_radius"`
	// ReplyMarkup inline keyboard attached to the message
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// InputMessageContent content of the message to be sent instead of the location
	//
	// optional
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
	// ThumbURL url of the thumbnail for the result
	//
	// optional
	ThumbURL string `json:"thumb_url,omitempty"`
	// ThumbWidth thumbnail width
	//
	// optional
	ThumbWidth int `json:"thumb_width,omitempty"`
	// ThumbHeight thumbnail height
	//
	// optional
	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.

type InlineQueryResultMPEG4GIF

type InlineQueryResultMPEG4GIF struct {
	// Type of the result, must be mpeg4_gif
	Type string `json:"type"`
	// ID unique identifier for this result, 1-64 bytes
	ID string `json:"id"`
	// URL a valid URL for the MP4 file. File size must not exceed 1MB
	URL string `json:"mpeg4_url"`
	// Width video width
	//
	// optional
	Width int `json:"mpeg4_width"`
	// Height vVideo height
	//
	// optional
	Height int `json:"mpeg4_height"`
	// Duration video duration
	//
	// optional
	Duration int `json:"mpeg4_duration"`
	// ThumbURL url of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result.
	ThumbURL string `json:"thumb_url"`
	// Title for the result
	//
	// optional
	Title string `json:"title,omitempty"`
	// Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing.
	//
	// optional
	Caption string `json:"caption,omitempty"`
	// ParseMode mode for parsing entities in the video caption.
	// See formatting options for more details
	// (https://core.telegram.org/bots/api#formatting-options).
	//
	// optional
	ParseMode string `json:"parse_mode,omitempty"`
	// CaptionEntities is a list of special entities that appear in the caption,
	// which can be specified instead of parse_mode
	//
	// optional
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// ReplyMarkup inline keyboard attached to the message
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// InputMessageContent content of the message to be sent instead of the video animation
	//
	// optional
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
}

InlineQueryResultMPEG4GIF is an inline query response MPEG4 GIF.

func NewInlineQueryResultMPEG4GIF

func NewInlineQueryResultMPEG4GIF(id, url string) InlineQueryResultMPEG4GIF

NewInlineQueryResultMPEG4GIF creates a new inline query MPEG4 GIF.

type InlineQueryResultPhoto

type InlineQueryResultPhoto struct {
	// Type of the result, must be article.
	Type string `json:"type"`
	// ID unique identifier for this result, 1-64 Bytes.
	ID string `json:"id"`
	// URL a valid URL of the photo. Photo must be in jpeg format.
	// Photo size must not exceed 5MB.
	URL string `json:"photo_url"`
	// MimeType
	MimeType string `json:"mime_type"`
	// Width of the photo
	//
	// optional
	Width int `json:"photo_width,omitempty"`
	// Height of the photo
	//
	// optional
	Height int `json:"photo_height,omitempty"`
	// ThumbURL url of the thumbnail for the photo.
	//
	// optional
	ThumbURL string `json:"thumb_url,omitempty"`
	// Title for the result
	//
	// optional
	Title string `json:"title,omitempty"`
	// Description short description of the result
	//
	// optional
	Description string `json:"description,omitempty"`
	// Caption of the photo to be sent, 0-1024 characters after entities parsing.
	//
	// optional
	Caption string `json:"caption,omitempty"`
	// ParseMode mode for parsing entities in the photo caption.
	// See formatting options for more details
	// (https://core.telegram.org/bots/api#formatting-options).
	//
	// optional
	ParseMode string `json:"parse_mode,omitempty"`
	// ReplyMarkup inline keyboard attached to the message.
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// CaptionEntities is a list of special entities that appear in the caption,
	// which can be specified instead of parse_mode
	//
	// optional
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// InputMessageContent content of the message to be sent instead of the photo.
	//
	// optional
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
}

InlineQueryResultPhoto is an inline query response photo.

func NewInlineQueryResultPhoto

func NewInlineQueryResultPhoto(id, url string) InlineQueryResultPhoto

NewInlineQueryResultPhoto creates a new inline query photo.

func NewInlineQueryResultPhotoWithThumb

func NewInlineQueryResultPhotoWithThumb(id, url, thumb string) InlineQueryResultPhoto

NewInlineQueryResultPhotoWithThumb creates a new inline query photo.

type InlineQueryResultVenue

type InlineQueryResultVenue struct {
	// Type of the result, must be venue
	Type string `json:"type"`
	// ID unique identifier for this result, 1-64 Bytes
	ID string `json:"id"`
	// Latitude of the venue location in degrees
	Latitude float64 `json:"latitude"`
	// Longitude of the venue location in degrees
	Longitude float64 `json:"longitude"`
	// Title of the venue
	Title string `json:"title"`
	// Address of the venue
	Address string `json:"address"`
	// FoursquareID foursquare identifier of the venue if known
	//
	// optional
	FoursquareID string `json:"foursquare_id,omitempty"`
	// FoursquareType foursquare type of the venue, if known.
	// (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
	//
	// optional
	FoursquareType string `json:"foursquare_type,omitempty"`
	// GooglePlaceID is the Google Places identifier of the venue
	//
	// optional
	GooglePlaceID string `json:"google_place_id,omitempty"`
	// GooglePlaceType is the Google Places type of the venue
	//
	// optional
	GooglePlaceType string `json:"google_place_type,omitempty"`
	// ReplyMarkup inline keyboard attached to the message
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// InputMessageContent content of the message to be sent instead of the venue
	//
	// optional
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
	// ThumbURL url of the thumbnail for the result
	//
	// optional
	ThumbURL string `json:"thumb_url,omitempty"`
	// ThumbWidth thumbnail width
	//
	// optional
	ThumbWidth int `json:"thumb_width,omitempty"`
	// ThumbHeight thumbnail height
	//
	// optional
	ThumbHeight int `json:"thumb_height,omitempty"`
}

InlineQueryResultVenue is an inline query response venue.

func NewInlineQueryResultVenue

func NewInlineQueryResultVenue(id, title, address string, latitude, longitude float64) InlineQueryResultVenue

NewInlineQueryResultVenue creates a new inline query venue.

type InlineQueryResultVideo

type InlineQueryResultVideo struct {
	// Type of the result, must be video
	Type string `json:"type"`
	// ID unique identifier for this result, 1-64 bytes
	ID string `json:"id"`
	// URL a valid url for the embedded video player or video file
	URL string `json:"video_url"`
	// MimeType of the content of video url, “text/html” or “video/mp4”
	MimeType string `json:"mime_type"`
	//
	// ThumbURL url of the thumbnail (jpeg only) for the video
	// optional
	ThumbURL string `json:"thumb_url,omitempty"`
	// Title for the result
	Title string `json:"title"`
	// Caption of the video to be sent, 0-1024 characters after entities parsing
	//
	// optional
	Caption string `json:"caption,omitempty"`
	// Width video width
	//
	// optional
	Width int `json:"video_width,omitempty"`
	// Height video height
	//
	// optional
	Height int `json:"video_height,omitempty"`
	// Duration video duration in seconds
	//
	// optional
	Duration int `json:"video_duration,omitempty"`
	// Description short description of the result
	//
	// optional
	Description string `json:"description,omitempty"`
	// ReplyMarkup inline keyboard attached to the message
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// InputMessageContent content of the message to be sent instead of the video.
	// This field is required if InlineQueryResultVideo is used to send
	// an HTML-page as a result (e.g., a YouTube video).
	//
	// optional
	InputMessageContent interface{} `json:"input_message_content,omitempty"`
}

InlineQueryResultVideo is an inline query response video.

func NewInlineQueryResultVideo

func NewInlineQueryResultVideo(id, url string) InlineQueryResultVideo

NewInlineQueryResultVideo creates a new inline query video.

type InlineQueryResultVoice

type InlineQueryResultVoice struct {
	// Type of the result, must be voice
	Type string `json:"type"`
	// ID unique identifier for this result, 1-64 bytes
	ID string `json:"id"`
	// URL a valid URL for the voice recording
	URL string `json:"voice_url"`
	// Title recording title
	Title string `json:"title"`
	// Caption 0-1024 characters after entities parsing
	//
	// optional
	Caption string `json:"caption,omitempty"`
	// ParseMode mode for parsing entities in the video caption.
	// See formatting options for more details
	// (https://core.telegram.org/bots/api#formatting-options).
	//
	// optional
	ParseMode string `json:"parse_mode,omitempty"`
	// CaptionEntities is a list of special entities that appear in the caption,
	// which can be specified instead of parse_mode
	//
	// optional
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Duration recording duration in seconds
	//
	// optional
	Duration int `json:"voice_duration,omitempty"`
	// ReplyMarkup inline keyboard attached to the message
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// InputMessageContent content of the message to be sent instead of the voice recording
	//
	// optional
	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.

type InputContactMessageContent

type InputContactMessageContent struct {
	// 	PhoneNumber contact's phone number
	PhoneNumber string `json:"phone_number"`
	// FirstName contact's first name
	FirstName string `json:"first_name"`
	// LastName contact's last name
	//
	// optional
	LastName string `json:"last_name,omitempty"`
	// Additional data about the contact in the form of a vCard
	//
	// optional
	VCard string `json:"vcard,omitempty"`
}

InputContactMessageContent contains a contact for displaying as an inline query result.

type InputInvoiceMessageContent

type InputInvoiceMessageContent struct {
	// Product name, 1-32 characters
	Title string `json:"title"`
	// Product description, 1-255 characters
	Description string `json:"description"`
	// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to
	// the user, use for your internal processes.
	Payload string `json:"payload"`
	// Payment provider token, obtained via Botfather
	ProviderToken string `json:"provider_token"`
	// Three-letter ISO 4217 currency code
	Currency string `json:"currency"`
	// Price breakdown, a JSON-serialized list of components (e.g. product
	// price, tax, discount, delivery cost, delivery tax, bonus, etc.)
	Prices []LabeledPrice `json:"prices"`
	// The maximum accepted amount for tips in the smallest units of the
	// currency (integer, not float/double).
	//
	// optional
	MaxTipAmount int `json:"max_tip_amount,omitempty"`
	// An array of suggested amounts of tip in the smallest units of the
	// currency (integer, not float/double). At most 4 suggested tip amounts can
	// be specified. The suggested tip amounts must be positive, passed in a
	// strictly increased order and must not exceed max_tip_amount.
	//
	// optional
	SuggestedTipAmounts []int `json:"suggested_tip_amounts,omitempty"`
	// A JSON-serialized object for data about the invoice, which will be shared
	// with the payment provider. A detailed description of the required fields
	// should be provided by the payment provider.
	//
	// optional
	ProviderData string `json:"provider_data,omitempty"`
	// URL of the product photo for the invoice. Can be a photo of the goods or
	// a marketing image for a service. People like it better when they see what
	// they are paying for.
	//
	// optional
	PhotoURL string `json:"photo_url,omitempty"`
	// Photo size
	//
	// optional
	PhotoSize int `json:"photo_size,omitempty"`
	// Photo width
	//
	// optional
	PhotoWidth int `json:"photo_width,omitempty"`
	// Photo height
	//
	// optional
	PhotoHeight int `json:"photo_height,omitempty"`
	// Pass True, if you require the user's full name to complete the order
	//
	// optional
	NeedName bool `json:"need_name,omitempty"`
	// Pass True, if you require the user's phone number to complete the order
	//
	// optional
	NeedPhoneNumber bool `json:"need_phone_number,omitempty"`
	// Pass True, if you require the user's email address to complete the order
	//
	// optional
	NeedEmail bool `json:"need_email,omitempty"`
	// Pass True, if you require the user's shipping address to complete the order
	//
	// optional
	NeedShippingAddress bool `json:"need_shipping_address,omitempty"`
	// Pass True, if user's phone number should be sent to provider
	//
	// optional
	SendPhoneNumberToProvider bool `json:"send_phone_number_to_provider,omitempty"`
	// Pass True, if user's email address should be sent to provider
	//
	// optional
	SendEmailToProvider bool `json:"send_email_to_provider,omitempty"`
	// Pass True, if the final price depends on the shipping method
	//
	// optional
	IsFlexible bool `json:"is_flexible,omitempty"`
}

InputInvoiceMessageContent represents the content of an invoice message to be sent as the result of an inline query.

type InputLocationMessageContent

type InputLocationMessageContent struct {
	// Latitude of the location in degrees
	Latitude float64 `json:"latitude"`
	// Longitude of the location in degrees
	Longitude float64 `json:"longitude"`
	// HorizontalAccuracy is the radius of uncertainty for the location,
	// measured in meters; 0-1500
	//
	// optional
	HorizontalAccuracy float64 `json:"horizontal_accuracy"`
	// LivePeriod is the period in seconds for which the location can be
	// updated, should be between 60 and 86400
	//
	// optional
	LivePeriod int `json:"live_period,omitempty"`
	// Heading is for live locations, a direction in which the user is moving,
	// in degrees. Must be between 1 and 360 if specified.
	//
	// optional
	Heading int `json:"heading"`
	// ProximityAlertRadius is for live locations, a maximum distance for
	// proximity alerts about approaching another chat member, in meters. Must
	// be between 1 and 100000 if specified.
	//
	// optional
	ProximityAlertRadius int `json:"proximity_alert_radius"`
}

InputLocationMessageContent contains a location for displaying as an inline query result.

type InputMediaAnimation

type InputMediaAnimation struct {
	BaseInputMedia
	// Thumbnail of the file sent; can be ignored if thumbnail generation for
	// the file is supported server-side.
	//
	// optional
	Thumb interface{} `json:"thumb,omitempty"`
	// Width video width
	//
	// optional
	Width int `json:"width,omitempty"`
	// Height video height
	//
	// optional
	Height int `json:"height,omitempty"`
	// Duration video duration
	//
	// optional
	Duration int `json:"duration,omitempty"`
}

InputMediaAnimation is an animation to send as part of a media group.

func NewInputMediaAnimation

func NewInputMediaAnimation(media interface{}) InputMediaAnimation

NewInputMediaAnimation creates a new InputMediaAnimation.

type InputMediaAudio

type InputMediaAudio struct {
	BaseInputMedia
	// Thumbnail of the file sent; can be ignored if thumbnail generation for
	// the file is supported server-side.
	//
	// optional
	Thumb interface{} `json:"thumb,omitempty"`
	// Duration of the audio in seconds
	//
	// optional
	Duration int `json:"duration,omitempty"`
	// Performer of the audio
	//
	// optional
	Performer string `json:"performer,omitempty"`
	// Title of the audio
	//
	// optional
	Title string `json:"title,omitempty"`
}

InputMediaAudio is a audio to send as part of a media group.

func NewInputMediaAudio

func NewInputMediaAudio(media interface{}) InputMediaAudio

NewInputMediaAudio creates a new InputMediaAudio.

type InputMediaDocument

type InputMediaDocument struct {
	BaseInputMedia
	// Thumbnail of the file sent; can be ignored if thumbnail generation for
	// the file is supported server-side.
	//
	// optional
	Thumb interface{} `json:"thumb,omitempty"`
	// DisableContentTypeDetection disables automatic server-side content type
	// detection for files uploaded using multipart/form-data. Always true, if
	// the document is sent as part of an album
	//
	// optional
	DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"`
}

InputMediaDocument is a general file to send as part of a media group.

func NewInputMediaDocument

func NewInputMediaDocument(media interface{}) InputMediaDocument

NewInputMediaDocument creates a new InputMediaDocument.

type InputMediaPhoto

type InputMediaPhoto struct {
	BaseInputMedia
}

InputMediaPhoto is a photo to send as part of a media group.

func NewInputMediaPhoto

func NewInputMediaPhoto(media interface{}) InputMediaPhoto

NewInputMediaPhoto creates a new InputMediaPhoto.

type InputMediaVideo

type InputMediaVideo struct {
	BaseInputMedia
	// Thumbnail of the file sent; can be ignored if thumbnail generation for
	// the file is supported server-side.
	//
	// optional
	Thumb interface{} `json:"thumb,omitempty"`
	// Width video width
	//
	// optional
	Width int `json:"width,omitempty"`
	// Height video height
	//
	// optional
	Height int `json:"height,omitempty"`
	// Duration video duration
	//
	// optional
	Duration int `json:"duration,omitempty"`
	// SupportsStreaming pass True, if the uploaded video is suitable for streaming.
	//
	// optional
	SupportsStreaming bool `json:"supports_streaming,omitempty"`
}

InputMediaVideo is a video to send as part of a media group.

func NewInputMediaVideo

func NewInputMediaVideo(media interface{}) InputMediaVideo

NewInputMediaVideo creates a new InputMediaVideo.

type InputTextMessageContent

type InputTextMessageContent struct {
	// Text of the message to be sent, 1-4096 characters
	Text string `json:"message_text"`
	// ParseMode mode for parsing entities in the message text.
	// See formatting options for more details
	// (https://core.telegram.org/bots/api#formatting-options).
	//
	// optional
	ParseMode string `json:"parse_mode,omitempty"`
	// Entities is a list of special entities that appear in message text, which
	// can be specified instead of parse_mode
	//
	// optional
	Entities []MessageEntity `json:"entities,omitempty"`
	// DisableWebPagePreview disables link previews for links in the sent message
	//
	// optional
	DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"`
}

InputTextMessageContent contains text for displaying as an inline query result.

type InputVenueMessageContent

type InputVenueMessageContent struct {
	// Latitude of the venue in degrees
	Latitude float64 `json:"latitude"`
	// Longitude of the venue in degrees
	Longitude float64 `json:"longitude"`
	// Title name of the venue
	Title string `json:"title"`
	// Address of the venue
	Address string `json:"address"`
	// FoursquareID foursquare identifier of the venue, if known
	//
	// optional
	FoursquareID string `json:"foursquare_id,omitempty"`
	// FoursquareType Foursquare type of the venue, if known
	//
	// optional
	FoursquareType string `json:"foursquare_type,omitempty"`
	// GooglePlaceID is the Google Places identifier of the venue
	//
	// optional
	GooglePlaceID string `json:"google_place_id"`
	// GooglePlaceType is the Google Places type of the venue
	//
	// optional
	GooglePlaceType string `json:"google_place_type"`
}

InputVenueMessageContent contains a venue for displaying as an inline query result.

type Invoice

type Invoice struct {
	// Title product name
	Title string `json:"title"`
	// Description product description
	Description string `json:"description"`
	// StartParameter unique bot deep-linking parameter that can be used to generate this invoice
	StartParameter string `json:"start_parameter"`
	// Currency three-letter ISO 4217 currency code
	// (see https://core.telegram.org/bots/payments#supported-currencies)
	Currency string `json:"currency"`
	// TotalAmount total price in the smallest units of the currency (integer, not float/double).
	// For example, for a price of US$ 1.45 pass amount = 145.
	// See the exp parameter in currencies.json
	// (https://core.telegram.org/bots/payments/currencies.json),
	// it shows the number of digits past the decimal point
	// for each currency (2 for the majority of currencies).
	TotalAmount int `json:"total_amount"`
}

Invoice contains basic information about an invoice.

type InvoiceConfig

type InvoiceConfig struct {
	BaseChat
	Title                     string         // required
	Description               string         // required
	Payload                   string         // required
	ProviderToken             string         // required
	Currency                  string         // required
	Prices                    []LabeledPrice // required
	MaxTipAmount              int
	SuggestedTipAmounts       []int
	StartParameter            string
	ProviderData              string
	PhotoURL                  string
	PhotoSize                 int
	PhotoWidth                int
	PhotoHeight               int
	NeedName                  bool
	NeedPhoneNumber           bool
	NeedEmail                 bool
	NeedShippingAddress       bool
	SendPhoneNumberToProvider bool
	SendEmailToProvider       bool
	IsFlexible                bool
}

InvoiceConfig contains information for sendInvoice request.

func NewInvoice

func NewInvoice(chatID int64, title, description, payload, providerToken, startParameter, currency string, prices []LabeledPrice) InvoiceConfig

NewInvoice creates a new Invoice request to the user.

func (InvoiceConfig) Method

func (config InvoiceConfig) Method() string

func (InvoiceConfig) Params

func (config InvoiceConfig) Params() (Params, error)

type KeyboardButton

type KeyboardButton struct {
	// Text of the button. If none of the optional fields are used,
	// it will be sent as a message when the button is pressed.
	Text string `json:"text"`
	// RequestContact if True, the user's phone number will be sent
	// as a contact when the button is pressed.
	// Available in private chats only.
	//
	// optional
	RequestContact bool `json:"request_contact,omitempty"`
	// RequestLocation if True, the user's current location will be sent when
	// the button is pressed.
	// Available in private chats only.
	//
	// optional
	RequestLocation bool `json:"request_location,omitempty"`
	// RequestPoll if True, the user will be asked to create a poll and send it
	// to the bot when the button is pressed. Available in private chats only
	//
	// optional
	RequestPoll *KeyboardButtonPollType `json:"request_poll,omitempty"`
}

KeyboardButton represents one button of the reply keyboard. For simple text buttons GetWithID can be used instead of this object to specify text of the button. Optional fields request_contact, request_location, and request_poll are mutually exclusive.

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.

type KeyboardButtonPollType

type KeyboardButtonPollType struct {
	// Type is 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"`
}

KeyboardButtonPollType represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed.

type KickChatMemberConfig

type KickChatMemberConfig struct {
	ChatMemberConfig
	UntilDate      int64
	RevokeMessages bool
}

KickChatMemberConfig contains extra fields to kick user

func (KickChatMemberConfig) Method

func (config KickChatMemberConfig) Method() string

func (KickChatMemberConfig) Params

func (config KickChatMemberConfig) Params() (Params, error)

type LabeledPrice

type LabeledPrice struct {
	// Label portion label
	Label string `json:"label"`
	// Amount price of the product in the smallest units of the currency (integer, not float/double).
	// For example, for a price of US$ 1.45 pass amount = 145.
	// See the exp parameter in currencies.json
	// (https://core.telegram.org/bots/payments/currencies.json),
	// it shows the number of digits past the decimal point
	// for each currency (2 for the majority of currencies).
	Amount int `json:"amount"`
}

LabeledPrice represents a portion of the price for goods or services.

type LeaveChatConfig

type LeaveChatConfig struct {
	ChatID          int64
	ChannelUsername string
}

LeaveChatConfig allows you to leave a chat.

func (LeaveChatConfig) Method

func (config LeaveChatConfig) Method() string

func (LeaveChatConfig) Params

func (config LeaveChatConfig) Params() (Params, error)

type Location

type Location struct {
	// Longitude as defined by sender
	Longitude float64 `json:"longitude"`
	// Latitude as defined by sender
	Latitude float64 `json:"latitude"`
	// HorizontalAccuracy is the radius of uncertainty for the location,
	// measured in meters; 0-1500
	//
	// optional
	HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
	// LivePeriod is time relative to the message sending date, during which the
	// location can be updated, in seconds. For active live locations only.
	//
	// optional
	LivePeriod int `json:"live_period,omitempty"`
	// Heading is the direction in which user is moving, in degrees; 1-360. For
	// active live locations only.
	//
	// optional
	Heading int `json:"heading,omitempty"`
	// ProximityAlertRadius is the maximum distance for proximity alerts about
	// approaching another chat member, in meters. For sent live locations only.
	//
	// optional
	ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`
}

Location represents a point on the map.

type LocationConfig

type LocationConfig struct {
	BaseChat
	Latitude             float64 // required
	Longitude            float64 // required
	HorizontalAccuracy   float64 // optional
	LivePeriod           int     // optional
	Heading              int     // optional
	ProximityAlertRadius int     // optional
}

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

func (config LocationConfig) Method() string

func (LocationConfig) Params

func (config LocationConfig) Params() (Params, error)

type LogOutConfig

type LogOutConfig struct{}

LogOutConfig is a request to log out of the cloud Bot API server.

Note that you may not log back in for at least 10 minutes.

func (LogOutConfig) Method

func (LogOutConfig) Method() string

func (LogOutConfig) Params

func (LogOutConfig) Params() (Params, error)

type LoginURL

type LoginURL struct {
	// URL is an HTTP 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.
	//
	// NOTE: You must always check the hash of the received data to verify the
	// authentication and the integrity of the data as described in Checking
	// authorization.
	URL string `json:"url"`
	// ForwardText is the new text of the button in forwarded messages
	//
	// optional
	ForwardText string `json:"forward_text,omitempty"`
	// BotUsername is the 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.
	//
	// optional
	BotUsername string `json:"bot_username,omitempty"`
	// RequestWriteAccess if true requests permission for your bot to send
	// messages to the user
	//
	// optional
	RequestWriteAccess bool `json:"request_write_access,omitempty"`
}

LoginURL represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in.

type MaskPosition

type MaskPosition struct {
	// The part of the face relative to which the mask should be placed.
	// One of “forehead”, “eyes”, “mouth”, or “chin”.
	Point string `json:"point"`
	// Shift by X-axis measured in widths of the mask scaled to the face size,
	// from left to right. For example, choosing -1.0 will place mask just to
	// the left of the default mask position.
	XShift float64 `json:"x_shift"`
	// Shift by Y-axis measured in heights of the mask scaled to the face size,
	// from top to bottom. For example, 1.0 will place the mask just below the
	// default mask position.
	YShift float64 `json:"y_shift"`
	// Mask scaling coefficient. For example, 2.0 means double size.
	Scale float64 `json:"scale"`
}

MaskPosition describes the position on faces where a mask should be placed by default.

type MediaGroupConfig

type MediaGroupConfig struct {
	ChatID          int64
	ChannelUsername string

	Media               []interface{}
	DisableNotification bool
	ReplyToMessageID    int
}

MediaGroupConfig allows you to send a group of media.

Media consist of InputMedia items (InputMediaPhoto, InputMediaVideo).

func NewMediaGroup

func NewMediaGroup(chatID int64, files []interface{}) MediaGroupConfig

NewMediaGroup creates a new media group. Files should be an array of two to ten InputMediaPhoto or InputMediaVideo.

func (MediaGroupConfig) Files

func (config MediaGroupConfig) Files() []RequestFile

func (MediaGroupConfig) Method

func (config MediaGroupConfig) Method() string

func (MediaGroupConfig) Params

func (config MediaGroupConfig) Params() (Params, error)

type Message

type Message struct {
	// MessageID is a unique message identifier inside this chat
	MessageID int `json:"message_id"`
	// From is a sender, empty for messages sent to channels;
	//
	// optional
	From *User `json:"from,omitempty"`
	// SenderChat is the sender of the message, sent on behalf of a chat. The
	// channel itself for channel messages. The supergroup itself for messages
	// from anonymous group administrators. The linked channel for messages
	// automatically forwarded to the discussion group
	//
	// optional
	SenderChat *Chat `json:"sender_chat,omitempty"`
	// Date of the message was sent in Unix time
	Date int `json:"date"`
	// Chat is the conversation the message belongs to
	Chat *Chat `json:"chat"`
	// ForwardFrom for forwarded messages, sender of the original message;
	//
	// optional
	ForwardFrom *User `json:"forward_from,omitempty"`
	// ForwardFromChat for messages forwarded from channels,
	// information about the original channel;
	//
	// optional
	ForwardFromChat *Chat `json:"forward_from_chat,omitempty"`
	// ForwardFromMessageID for messages forwarded from channels,
	// identifier of the original message in the channel;
	//
	// optional
	ForwardFromMessageID int `json:"forward_from_message_id,omitempty"`
	// ForwardSignature for messages forwarded from channels, signature of the
	// post author if present
	//
	// optional
	ForwardSignature string `json:"forward_signature,omitempty"`
	// ForwardSenderName is the sender's name for messages forwarded from users
	// who disallow adding a link to their account in forwarded messages
	//
	// optional
	ForwardSenderName string `json:"forward_sender_name,omitempty"`
	// ForwardDate for forwarded messages, date the original message was sent in Unix time;
	//
	// optional
	ForwardDate int `json:"forward_date,omitempty"`
	// ReplyToMessage for replies, the original message.
	// Note that the Message object in this field will not contain further ReplyToMessage fields
	// even if it itself is a reply;
	//
	// optional
	ReplyToMessage *Message `json:"reply_to_message,omitempty"`
	// ViaBot through which the message was sent;
	//
	// optional
	ViaBot *User `json:"via_bot,omitempty"`
	// EditDate of the message was last edited in Unix time;
	//
	// optional
	EditDate int `json:"edit_date,omitempty"`
	// MediaGroupID is the unique identifier of a media message group this message belongs to;
	//
	// optional
	MediaGroupID string `json:"media_group_id,omitempty"`
	// AuthorSignature is the signature of the post author for messages in channels;
	//
	// optional
	AuthorSignature string `json:"author_signature,omitempty"`
	// Text is for text messages, the actual UTF-8 text of the message, 0-4096 characters;
	//
	// optional
	Text string `json:"text,omitempty"`
	// Entities is for text messages, special entities like usernames,
	// URLs, bot commands, etc. that appear in the text;
	//
	// optional
	Entities []MessageEntity `json:"entities,omitempty"`
	// Animation message is an animation, information about the animation.
	// For backward compatibility, when this field is set, the document field will also be set;
	//
	// optional
	Animation *Animation `json:"animation,omitempty"`
	// Audio message is an audio file, information about the file;
	//
	// optional
	Audio *Audio `json:"audio,omitempty"`
	// Document message is a general file, information about the file;
	//
	// optional
	Document *Document `json:"document,omitempty"`
	// Photo message is a photo, available sizes of the photo;
	//
	// optional
	Photo []PhotoSize `json:"photo,omitempty"`
	// Sticker message is a sticker, information about the sticker;
	//
	// optional
	Sticker *Sticker `json:"sticker,omitempty"`
	// Video message is a video, information about the video;
	//
	// optional
	Video *Video `json:"video,omitempty"`
	// VideoNote message is a video note, information about the video message;
	//
	// optional
	VideoNote *VideoNote `json:"video_note,omitempty"`
	// Voice message is a voice message, information about the file;
	//
	// optional
	Voice *Voice `json:"voice,omitempty"`
	// Caption for the animation, audio, document, photo, video or voice, 0-1024 characters;
	//
	// optional
	Caption string `json:"caption,omitempty"`
	// CaptionEntities;
	//
	// optional
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Contact message is a shared contact, information about the contact;
	//
	// optional
	Contact *Contact `json:"contact,omitempty"`
	// Dice is a dice with random value;
	//
	// optional
	Dice *Dice `json:"dice,omitempty"`
	// Game message is a game, information about the game;
	//
	// optional
	Game *Game `json:"game,omitempty"`
	// Poll is a native poll, information about the poll;
	//
	// optional
	Poll *Poll `json:"poll,omitempty"`
	// Venue message is a venue, information about the venue.
	// For backward compatibility, when this field is set, the location field
	// will also be set;
	//
	// optional
	Venue *Venue `json:"venue,omitempty"`
	// Location message is a shared location, information about the location;
	//
	// optional
	Location *Location `json:"location,omitempty"`
	// NewChatMembers that were added to the group or supergroup
	// and information about them (the bot itself may be one of these members);
	//
	// optional
	NewChatMembers []User `json:"new_chat_members,omitempty"`
	// LeftChatMember is a member was removed from the group,
	// information about them (this member may be the bot itself);
	//
	// optional
	LeftChatMember *User `json:"left_chat_member,omitempty"`
	// NewChatTitle is a chat title was changed to this value;
	//
	// optional
	NewChatTitle string `json:"new_chat_title,omitempty"`
	// NewChatPhoto is a chat photo was change to this value;
	//
	// optional
	NewChatPhoto []PhotoSize `json:"new_chat_photo,omitempty"`
	// DeleteChatPhoto is a service message: the chat photo was deleted;
	//
	// optional
	DeleteChatPhoto bool `json:"delete_chat_photo,omitempty"`
	// GroupChatCreated is a service message: the group has been created;
	//
	// optional
	GroupChatCreated bool `json:"group_chat_created,omitempty"`
	// SuperGroupChatCreated is a service message: the supergroup has been created.
	// This field can't be received in a message coming through updates,
	// because bot can't be a member of a supergroup when it is created.
	// It can only be found in ReplyToMessage if someone replies to a very first message
	// in a directly created supergroup;
	//
	// optional
	SuperGroupChatCreated bool `json:"supergroup_chat_created,omitempty"`
	// ChannelChatCreated is a service message: the channel has been created.
	// This field can't be received in a message coming through updates,
	// because bot can't be a member of a channel when it is created.
	// It can only be found in ReplyToMessage
	// if someone replies to a very first message in a channel;
	//
	// optional
	ChannelChatCreated bool `json:"channel_chat_created,omitempty"`
	// MessageAutoDeleteTimerChanged is a service message: auto-delete timer
	// settings changed in the chat.
	//
	// optional
	MessageAutoDeleteTimerChanged *MessageAutoDeleteTimerChanged `json:"message_auto_delete_timer_changed"`
	// MigrateToChatID is the group has been migrated to a supergroup with the specified identifier.
	// This number may be greater than 32 bits and some programming languages
	// may have difficulty/silent defects in interpreting it.
	// But it is smaller than 52 bits, so a signed 64 bit integer
	// or double-precision float type are safe for storing this identifier;
	//
	// optional
	MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"`
	// MigrateFromChatID is the supergroup has been migrated from a group with the specified identifier.
	// This number may be greater than 32 bits and some programming languages
	// may have difficulty/silent defects in interpreting it.
	// But it is smaller than 52 bits, so a signed 64 bit integer
	// or double-precision float type are safe for storing this identifier;
	//
	// optional
	MigrateFromChatID int64 `json:"migrate_from_chat_id,omitempty"`
	// PinnedMessage is a specified message was pinned.
	// Note that the Message object in this field will not contain further ReplyToMessage
	// fields even if it is itself a reply;
	//
	// optional
	PinnedMessage *Message `json:"pinned_message,omitempty"`
	// Invoice message is an invoice for a payment;
	//
	// optional
	Invoice *Invoice `json:"invoice,omitempty"`
	// SuccessfulPayment message is a service message about a successful payment,
	// information about the payment;
	//
	// optional
	SuccessfulPayment *SuccessfulPayment `json:"successful_payment,omitempty"`
	// ConnectedWebsite is Tthe domain name of the website on which the user has
	// logged in;
	//
	// optional
	ConnectedWebsite string `json:"connected_website,omitempty"`
	// PassportData is a Telegram Passport data;
	//
	// optional
	PassportData *PassportData `json:"passport_data,omitempty"`
	// ProximityAlertTriggered is a service message. A user in the chat
	// triggered another user's proximity alert while sharing Live Location
	//
	// optional
	ProximityAlertTriggered *ProximityAlertTriggered `json:"proximity_alert_triggered"`
	// VoiceChatScheduled is a service message: voice chat scheduled.
	//
	// optional
	VoiceChatScheduled *VoiceChatScheduled `json:"voice_chat_scheduled"`
	// VoiceChatStarted is a service message: voice chat started.
	//
	// optional
	VoiceChatStarted *VoiceChatStarted `json:"voice_chat_started"`
	// VoiceChatEnded is a service message: voice chat ended.
	//
	// optional
	VoiceChatEnded *VoiceChatEnded `json:"voice_chat_ended"`
	// VoiceChatParticipantsInvited is a service message: new participants
	// invited to a voice chat.
	//
	// optional
	VoiceChatParticipantsInvited *VoiceChatParticipantsInvited `json:"voice_chat_participants_invited"`
	// ReplyMarkup is the Inline keyboard attached to the message.
	// login_url buttons are represented as ordinary url buttons.
	//
	// optional
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

Message represents a message.

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 name syntax, it is removed. Use CommandWithAt() if you do not want that.

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.

Note: The first character after the command name is omitted: - "/foo bar baz" yields "bar baz", not " bar baz" - "/foo-bar baz" yields "bar baz", too Even though the latter is not a command conforming to the spec, the API marks "/foo" as command entity.

func (*Message) CommandWithAt

func (m *Message) CommandWithAt() string

CommandWithAt 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 name syntax, it is not removed. Use Command() if you want that.

func (*Message) IsCommand

func (m *Message) IsCommand() bool

IsCommand returns true if message starts with a "bot_command" entity.

func (*Message) Time

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

Time converts the message timestamp into a Time.

type MessageAutoDeleteTimerChanged

type MessageAutoDeleteTimerChanged struct {
	// New auto-delete time for messages in the chat.
	MessageAutoDeleteTime int `json:"message_auto_delete_time"`
}

MessageAutoDeleteTimerChanged represents a service message about a change in auto-delete timer settings.

type MessageConfig

type MessageConfig struct {
	BaseChat
	Text                  string
	ParseMode             string
	Entities              []MessageEntity
	DisableWebPagePreview bool
}

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, and the username should be in the form of `@username`.

func (MessageConfig) Method

func (config MessageConfig) Method() string

func (MessageConfig) Params

func (config MessageConfig) Params() (Params, error)

type MessageEntity

type MessageEntity struct {
	// Type of the entity.
	// Can be:
	//  “mention” (@username),
	//  “hashtag” (#hashtag),
	//  “cashtag” ($USD),
	//  “bot_command” (/start@jobs_bot),
	//  “url” (https://telegram.org),
	//  “email” (do-not-reply@telegram.org),
	//  “phone_number” (+1-212-555-0123),
	//  “bold” (bold text),
	//  “italic” (italic text),
	//  “underline” (underlined text),
	//  “strikethrough” (strikethrough text),
	//  “code” (monowidth string),
	//  “pre” (monowidth block),
	//  “text_link” (for clickable text URLs),
	//  “text_mention” (for users without usernames)
	Type string `json:"type"`
	// Offset in UTF-16 code units to the start of the entity
	Offset int `json:"offset"`
	// Length
	Length int `json:"length"`
	// URL for “text_link” only, url that will be opened after user taps on the text
	//
	// optional
	URL string `json:"url,omitempty"`
	// User for “text_mention” only, the mentioned user
	//
	// optional
	User *User `json:"user,omitempty"`
	// Language for “pre” only, the programming language of the entity text
	//
	// optional
	Language string `json:"language,omitempty"`
}

MessageEntity represents one special entity in a text message.

func (MessageEntity) IsBold

func (e MessageEntity) IsBold() bool

IsBold returns true if the type of the message entity is "bold" (bold text).

func (MessageEntity) IsCode

func (e MessageEntity) IsCode() bool

IsCode returns true if the type of the message entity is "code" (monowidth string).

func (MessageEntity) IsCommand

func (e MessageEntity) IsCommand() bool

IsCommand returns true if the type of the message entity is "bot_command".

func (MessageEntity) IsEmail

func (e MessageEntity) IsEmail() bool

IsEmail returns true if the type of the message entity is "email".

func (MessageEntity) IsHashtag

func (e MessageEntity) IsHashtag() bool

IsHashtag returns true if the type of the message entity is "hashtag".

func (MessageEntity) IsItalic

func (e MessageEntity) IsItalic() bool

IsItalic returns true if the type of the message entity is "italic" (italic text).

func (MessageEntity) IsMention

func (e MessageEntity) IsMention() bool

IsMention returns true if the type of the message entity is "mention" (@username).

func (MessageEntity) IsPre

func (e MessageEntity) IsPre() bool

IsPre returns true if the type of the message entity is "pre" (monowidth block).

func (e MessageEntity) IsTextLink() bool

IsTextLink returns true if the type of the message entity is "text_link" (clickable text URL).

func (MessageEntity) IsURL

func (e MessageEntity) IsURL() bool

IsURL returns true if the type of the message entity is "url".

func (MessageEntity) ParseURL

func (e MessageEntity) ParseURL() (*url.URL, error)

ParseURL attempts to parse a URL contained within a MessageEntity.

type MessageID

type MessageID struct {
	MessageID int `json:"message_id"`
}

MessageID represents a unique message identifier.

type NewStickerSetConfig

type NewStickerSetConfig struct {
	UserID        int64
	Name          string
	Title         string
	PNGSticker    interface{}
	TGSSticker    interface{}
	Emojis        string
	ContainsMasks bool
	MaskPosition  *MaskPosition
}

NewStickerSetConfig allows creating a new sticker set.

You must set either PNGSticker or TGSSticker.

func (NewStickerSetConfig) Files

func (config NewStickerSetConfig) Files() []RequestFile

func (NewStickerSetConfig) Method

func (config NewStickerSetConfig) Method() string

func (NewStickerSetConfig) Params

func (config NewStickerSetConfig) Params() (Params, error)

type OrderInfo

type OrderInfo struct {
	// Name user name
	//
	// optional
	Name string `json:"name,omitempty"`
	// PhoneNumber user's phone number
	//
	// optional
	PhoneNumber string `json:"phone_number,omitempty"`
	// Email user email
	//
	// optional
	Email string `json:"email,omitempty"`
	// ShippingAddress user shipping address
	//
	// optional
	ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
}

OrderInfo represents information about an order.

type Params

type Params map[string]string

Params represents a set of parameters that gets passed to a request.

func (Params) AddBool

func (p Params) AddBool(key string, value bool)

AddBool adds a value of a bool if it is true.

func (Params) AddFirstValid

func (p Params) AddFirstValid(key string, args ...interface{})

AddFirstValid attempts to add the first item that is not a default value.

For example, AddFirstValid(0, "", "test") would add "test".

func (Params) AddInterface

func (p Params) AddInterface(key string, value interface{}) error

AddInterface adds an interface if it is not nill and can be JSON marshalled.

func (Params) AddNonEmpty

func (p Params) AddNonEmpty(key, value string)

AddNonEmpty adds a value if it not an empty string.

func (Params) AddNonZero

func (p Params) AddNonZero(key string, value int)

AddNonZero adds a value if it is not zero.

func (Params) AddNonZero64

func (p Params) AddNonZero64(key string, value int64)

AddNonZero64 is the same as AddNonZero except uses an int64.

func (Params) AddNonZeroFloat

func (p Params) AddNonZeroFloat(key string, value float64)

AddNonZeroFloat adds a floating point value that is not zero.

func (Params) Build

func (p Params) Build() url.Values

Build out url.Values.

type PassportData

type PassportData struct {
	// Array with information about documents and other Telegram Passport
	// elements that was shared with the bot
	Data []EncryptedPassportElement `json:"data"`

	// Encrypted credentials required to decrypt the data
	Credentials *EncryptedCredentials `json:"credentials"`
}

PassportData contains information about Telegram Passport data shared with the bot by the user.

type PassportElementError

type PassportElementError interface{}

PassportElementError represents an error in the Telegram Passport element which was submitted that should be resolved by the user.

type PassportElementErrorDataField

type PassportElementErrorDataField struct {
	// Error source, must be data
	Source string `json:"source"`

	// The section of the user's Telegram Passport which has the error, one
	// of "personal_details", "passport", "driver_license", "identity_card",
	// "internal_passport", "address"
	Type string `json:"type"`

	// Name of the data field which has the error
	FieldName string `json:"field_name"`

	// Base64-encoded data hash
	DataHash string `json:"data_hash"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorDataField represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes.

type PassportElementErrorFile

type PassportElementErrorFile struct {
	// Error source, must be file
	Source string `json:"source"`

	// The section of the user's Telegram Passport which has the issue, one
	// of "utility_bill", "bank_statement", "rental_agreement",
	// "passport_registration", "temporary_registration"
	Type string `json:"type"`

	// Base64-encoded file hash
	FileHash string `json:"file_hash"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorFile represents an issue with a document scan. The error is considered resolved when the file with the document scan changes.

type PassportElementErrorFiles

type PassportElementErrorFiles struct {
	// Error source, must be files
	Source string `json:"source"`

	// The section of the user's Telegram Passport which has the issue, one
	// of "utility_bill", "bank_statement", "rental_agreement",
	// "passport_registration", "temporary_registration"
	Type string `json:"type"`

	// List of base64-encoded file hashes
	FileHashes []string `json:"file_hashes"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorFiles represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes.

type PassportElementErrorFrontSide

type PassportElementErrorFrontSide struct {
	// Error source, must be front_side
	Source string `json:"source"`

	// The section of the user's Telegram Passport which has the issue, one
	// of "passport", "driver_license", "identity_card", "internal_passport"
	Type string `json:"type"`

	// Base64-encoded hash of the file with the front side of the document
	FileHash string `json:"file_hash"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorFrontSide represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes.

type PassportElementErrorReverseSide

type PassportElementErrorReverseSide struct {
	// Error source, must be reverse_side
	Source string `json:"source"`

	// The section of the user's Telegram Passport which has the issue, one
	// of "driver_license", "identity_card"
	Type string `json:"type"`

	// Base64-encoded hash of the file with the reverse side of the document
	FileHash string `json:"file_hash"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorReverseSide represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes.

type PassportElementErrorSelfie

type PassportElementErrorSelfie struct {
	// Error source, must be selfie
	Source string `json:"source"`

	// The section of the user's Telegram Passport which has the issue, one
	// of "passport", "driver_license", "identity_card", "internal_passport"
	Type string `json:"type"`

	// Base64-encoded hash of the file with the selfie
	FileHash string `json:"file_hash"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorSelfie represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes.

type PassportFile

type PassportFile struct {
	// Unique identifier for this file
	FileID string `json:"file_id"`

	FileUniqueID string `json:"file_unique_id"`

	// File size
	FileSize int `json:"file_size"`

	// Unix time when the file was uploaded
	FileDate int64 `json:"file_date"`
}

PassportFile represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB.

type PassportRequestInfoConfig

type PassportRequestInfoConfig struct {
	BotID     int            `json:"bot_id"`
	Scope     *PassportScope `json:"scope"`
	Nonce     string         `json:"nonce"`
	PublicKey string         `json:"public_key"`
}

PassportRequestInfoConfig allows you to request passport info

type PassportScope

type PassportScope struct {
	V    int                    `json:"v"`
	Data []PassportScopeElement `json:"data"`
}

PassportScope is the requested scopes of data.

type PassportScopeElement

type PassportScopeElement interface {
	ScopeType() string
}

PassportScopeElement supports using one or one of several elements.

type PassportScopeElementOne

type PassportScopeElementOne struct {
	Type        string `json:"type"` // One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”
	Selfie      bool   `json:"selfie"`
	Translation bool   `json:"translation"`
	NativeNames bool   `json:"native_name"`
}

PassportScopeElementOne requires the specified element be provided.

func (*PassportScopeElementOne) ScopeType

func (eo *PassportScopeElementOne) ScopeType() string

ScopeType is the scope type.

type PassportScopeElementOneOfSeveral

type PassportScopeElementOneOfSeveral struct {
}

PassportScopeElementOneOfSeveral allows you to request any one of the requested documents.

func (*PassportScopeElementOneOfSeveral) ScopeType

func (eo *PassportScopeElementOneOfSeveral) ScopeType() string

ScopeType is the scope type.

type PersonalDetails

type PersonalDetails struct {
	FirstName            string `json:"first_name"`
	LastName             string `json:"last_name"`
	MiddleName           string `json:"middle_name"`
	BirthDate            string `json:"birth_date"`
	Gender               string `json:"gender"`
	CountryCode          string `json:"country_code"`
	ResidenceCountryCode string `json:"residence_country_code"`
	FirstNameNative      string `json:"first_name_native"`
	LastNameNative       string `json:"last_name_native"`
	MiddleNameNative     string `json:"middle_name_native"`
}

PersonalDetails https://core.telegram.org/passport#personaldetails

type PhotoConfig

type PhotoConfig struct {
	BaseFile
	Thumb           interface{}
	Caption         string
	ParseMode       string
	CaptionEntities []MessageEntity
}

PhotoConfig contains information about a SendPhoto request.

func NewPhoto

func NewPhoto(chatID int64, file interface{}) PhotoConfig

NewPhoto creates a new sendPhoto request.

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 NewPhotoToChannel

func NewPhotoToChannel(username string, file interface{}) PhotoConfig

NewPhotoToChannel creates a new photo uploader to send a photo to a channel.

Note that you must send animated GIFs as a document.

func (PhotoConfig) Files

func (config PhotoConfig) Files() []RequestFile

func (PhotoConfig) Method

func (config PhotoConfig) Method() string

func (PhotoConfig) Params

func (config PhotoConfig) Params() (Params, error)

type PhotoSize

type PhotoSize struct {
	// FileID identifier for this file, which can be used to download or reuse
	// the file
	FileID string `json:"file_id"`
	// FileUniqueID is the 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"`
	// Width photo width
	Width int `json:"width"`
	// Height photo height
	Height int `json:"height"`
	// FileSize file size
	//
	// optional
	FileSize int `json:"file_size,omitempty"`
}

PhotoSize represents one size of a photo or a file / sticker thumbnail.

type PinChatMessageConfig

type PinChatMessageConfig struct {
	ChatID              int64
	ChannelUsername     string
	MessageID           int
	DisableNotification bool
}

PinChatMessageConfig contains information of a message in a chat to pin.

func (PinChatMessageConfig) Method

func (config PinChatMessageConfig) Method() string

func (PinChatMessageConfig) Params

func (config PinChatMessageConfig) Params() (Params, error)

type Poll

type Poll struct {
	// ID is the unique poll identifier
	ID string `json:"id"`
	// Question is the poll question, 1-255 characters
	Question string `json:"question"`
	// Options is the list of poll options
	Options []PollOption `json:"options"`
	// TotalVoterCount is the total numbers of users who voted in the poll
	TotalVoterCount int `json:"total_voter_count"`
	// IsClosed is if the poll is closed
	IsClosed bool `json:"is_closed"`
	// IsAnonymous is if the poll is anonymous
	IsAnonymous bool `json:"is_anonymous"`
	// Type is the poll type, currently can be "regular" or "quiz"
	Type string `json:"type"`
	// AllowsMultipleAnswers is true, if the poll allows multiple answers
	AllowsMultipleAnswers bool `json:"allows_multiple_answers"`
	// CorrectOptionID is the 0-based identifier of the correct answer option.
	// Available only for polls in quiz mode, which are closed, or was sent (not
	// forwarded) by the bot or to the private chat with the bot.
	//
	// optional
	CorrectOptionID int `json:"correct_option_id,omitempty"`
	// Explanation is text that is shown when a user chooses an incorrect answer
	// or taps on the lamp icon in a quiz-style poll, 0-200 characters
	//
	// optional
	Explanation string `json:"explanation,omitempty"`
	// ExplainationEntities are special entities like usernames, URLs, bot
	// commands, etc. that appear in the explanation
	//
	// optional
	ExplanationEntities []MessageEntity `json:"explanation_entities,omitempty"`
	// OpenPeriod is the amount of time in seconds the poll will be active
	// after creation
	//
	// optional
	OpenPeriod int `json:"open_period,omitempty"`
	// Closedate is the point in time (unix timestamp) when the poll will be
	// automatically closed
	//
	// optional
	CloseDate int `json:"close_date,omitempty"`
}

Poll contains information about a poll.

type PollAnswer

type PollAnswer struct {
	// PollID is the unique poll identifier
	PollID string `json:"poll_id"`
	// User who changed the answer to the poll
	User User `json:"user"`
	// OptionIDs is the 0-based identifiers of poll options chosen by the user.
	// May be empty if user retracted vote.
	OptionIDs []int `json:"option_ids"`
}

PollAnswer represents an answer of a user in a non-anonymous poll.

type PollOption

type PollOption struct {
	// Text is the option text, 1-100 characters
	Text string `json:"text"`
	// VoterCount is the number of users that voted for this option
	VoterCount int `json:"voter_count"`
}

PollOption contains information about one answer option in a poll.

type PreCheckoutConfig

type PreCheckoutConfig struct {
	PreCheckoutQueryID string // required
	OK                 bool   // required
	ErrorMessage       string
}

PreCheckoutConfig conatins information for answerPreCheckoutQuery request.

func (PreCheckoutConfig) Method

func (config PreCheckoutConfig) Method() string

func (PreCheckoutConfig) Params

func (config PreCheckoutConfig) Params() (Params, error)

type PreCheckoutQuery

type PreCheckoutQuery struct {
	// ID unique query identifier
	ID string `json:"id"`
	// From user who sent the query
	From *User `json:"from"`
	// Currency three-letter ISO 4217 currency code
	//	// (see https://core.telegram.org/bots/payments#supported-currencies)
	Currency string `json:"currency"`
	// TotalAmount total price in the smallest units of the currency (integer, not float/double).
	//	// For example, for a price of US$ 1.45 pass amount = 145.
	//	// See the exp parameter in currencies.json,
	//	// (https://core.telegram.org/bots/payments/currencies.json)
	//	// it shows the number of digits past the decimal point
	//	// for each currency (2 for the majority of currencies).
	TotalAmount int `json:"total_amount"`
	// InvoicePayload bot specified invoice payload
	InvoicePayload string `json:"invoice_payload"`
	// ShippingOptionID identifier of the shipping option chosen by the user
	//
	// optional
	ShippingOptionID string `json:"shipping_option_id,omitempty"`
	// OrderInfo order info provided by the user
	//
	// optional
	OrderInfo *OrderInfo `json:"order_info,omitempty"`
}

PreCheckoutQuery contains information about an incoming pre-checkout query.

type PromoteChatMemberConfig

type PromoteChatMemberConfig struct {
	ChatMemberConfig
	IsAnonymous         bool
	CanManageChat       bool
	CanChangeInfo       bool
	CanPostMessages     bool
	CanEditMessages     bool
	CanDeleteMessages   bool
	CanManageVoiceChats bool
	CanInviteUsers      bool
	CanRestrictMembers  bool
	CanPinMessages      bool
	CanPromoteMembers   bool
}

PromoteChatMemberConfig contains fields to promote members of chat

func (PromoteChatMemberConfig) Method

func (config PromoteChatMemberConfig) Method() string

func (PromoteChatMemberConfig) Params

func (config PromoteChatMemberConfig) Params() (Params, error)

type ProximityAlertTriggered

type ProximityAlertTriggered struct {
	// Traveler is the user that triggered the alert
	Traveler User `json:"traveler"`
	// Watcher is the user that set the alert
	Watcher User `json:"watcher"`
	// Distance is the distance between the users
	Distance int `json:"distance"`
}

ProximityAlertTriggered represents a service message sent when a user in the chat triggers a proximity alert sent by another user.

type ProxyClient

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

func (*ProxyClient) Do

func (p *ProxyClient) Do(req *http.Request) (*http.Response, error)

func (*ProxyClient) PostForm

func (p *ProxyClient) PostForm(url string, data url.Values) (*http.Response, error)

type ReplyKeyboardMarkup

type ReplyKeyboardMarkup struct {
	// Keyboard is an array of button rows, each represented by an Array of KeyboardButton objects
	Keyboard [][]KeyboardButton `json:"keyboard"`
	// ResizeKeyboard requests clients to resize the keyboard vertically for optimal fit
	// (e.g., make the keyboard smaller if there are just two rows of buttons).
	// Defaults to false, in which case the custom keyboard
	// is always of the same height as the app's standard keyboard.
	//
	// optional
	ResizeKeyboard bool `json:"resize_keyboard,omitempty"`
	// OneTimeKeyboard requests clients to hide the keyboard as soon as it's been used.
	// The keyboard will still be available, but clients will automatically display
	// the usual letter-keyboard in the chat – the user can press a special button
	// in the input field to see the custom keyboard again.
	// Defaults to false.
	//
	// optional
	OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"`
	// Selective use this parameter if you want to show the keyboard to specific users only.
	// Targets:
	//  1) users that are @mentioned in the text of the Message object;
	//  2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
	//
	// Example: A user requests to change the bot's language,
	// bot replies to the request with a keyboard to select the new language.
	// Other users in the group don't see the keyboard.
	//
	// optional
	Selective bool `json:"selective,omitempty"`
}

ReplyKeyboardMarkup represents a custom keyboard with reply options.

func NewOneTimeReplyKeyboard

func NewOneTimeReplyKeyboard(rows ...[]KeyboardButton) ReplyKeyboardMarkup

NewOneTimeReplyKeyboard creates a new one time keyboard.

func NewReplyKeyboard

func NewReplyKeyboard(rows ...[]KeyboardButton) ReplyKeyboardMarkup

NewReplyKeyboard creates a new regular keyboard with sane defaults.

type ReplyKeyboardRemove

type ReplyKeyboardRemove struct {
	// RemoveKeyboard requests clients to remove the custom keyboard
	// (user will not be able to summon this keyboard;
	// if you want to hide the keyboard from sight but keep it accessible,
	// use one_time_keyboard in ReplyKeyboardMarkup).
	RemoveKeyboard bool `json:"remove_keyboard"`
	// Selective use this parameter if you want to remove the keyboard for specific users only.
	// Targets:
	//  1) users that are @mentioned in the text of the Message object;
	//  2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
	//
	// Example: A user votes in a poll, bot returns confirmation message
	// in reply to the vote and removes the keyboard for that user,
	// while still showing the keyboard with poll options to users who haven't voted yet.
	//
	// optional
	Selective bool `json:"selective,omitempty"`
}

ReplyKeyboardRemove Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button.

func NewRemoveKeyboard

func NewRemoveKeyboard(selective bool) ReplyKeyboardRemove

NewRemoveKeyboard hides the keyboard, with the option for being selective or hiding for everyone.

type RequestFile

type RequestFile struct {
	// The multipart upload field name.
	Name string
	// The file to upload.
	File interface{}
}

RequestFile represents a file associated with a request. May involve uploading a file, or passing an existing ID.

type ResponseParameters

type ResponseParameters struct {
	// The group has been migrated to a supergroup with the specified identifier.
	//
	// optional
	MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"`
	// In case of exceeding flood control, the number of seconds left to wait
	// before the request can be repeated.
	//
	// optional
	RetryAfter int `json:"retry_after,omitempty"`
}

ResponseParameters are various errors that can be returned in APIResponse.

type RestrictChatMemberConfig

type RestrictChatMemberConfig struct {
	ChatMemberConfig
	UntilDate   int64
	Permissions *ChatPermissions
}

RestrictChatMemberConfig contains fields to restrict members of chat

func (RestrictChatMemberConfig) Method

func (config RestrictChatMemberConfig) Method() string

func (RestrictChatMemberConfig) Params

func (config RestrictChatMemberConfig) Params() (Params, error)

type RevokeChatInviteLinkConfig

type RevokeChatInviteLinkConfig struct {
	ChatConfig
	InviteLink string
}

RevokeChatInviteLinkConfig allows you to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.

func (RevokeChatInviteLinkConfig) Method

func (RevokeChatInviteLinkConfig) Params

func (config RevokeChatInviteLinkConfig) Params() (Params, error)

type SecureData

type SecureData map[string]*SecureValue

SecureData is a map of the fields and their encrypted values.

type SecureValue

type SecureValue struct {
	Data        *DataCredentials   `json:"data"`
	FrontSide   *FileCredentials   `json:"front_side"`
	ReverseSide *FileCredentials   `json:"reverse_side"`
	Selfie      *FileCredentials   `json:"selfie"`
	Translation []*FileCredentials `json:"translation"`
	Files       []*FileCredentials `json:"files"`
}

SecureValue contains encrypted values for a SecureData item.

type SendPollConfig

type SendPollConfig struct {
	BaseChat
	Question              string
	Options               []string
	IsAnonymous           bool
	Type                  string
	AllowsMultipleAnswers bool
	CorrectOptionID       int64
	Explanation           string
	ExplanationParseMode  string
	ExplanationEntities   []MessageEntity
	OpenPeriod            int
	CloseDate             int
	IsClosed              bool
}

SendPollConfig allows you to send a poll.

func NewPoll

func NewPoll(chatID int64, question string, options ...string) SendPollConfig

NewPoll allows you to create a new poll.

func (SendPollConfig) Method

func (SendPollConfig) Method() string

func (SendPollConfig) Params

func (config SendPollConfig) Params() (Params, error)

type SetChatAdministratorCustomTitle

type SetChatAdministratorCustomTitle struct {
	ChatMemberConfig
	CustomTitle string
}

SetChatAdministratorCustomTitle sets the title of an administrative user promoted by the bot for a chat.

func (SetChatAdministratorCustomTitle) Method

func (SetChatAdministratorCustomTitle) Params

func (config SetChatAdministratorCustomTitle) Params() (Params, error)

type SetChatDescriptionConfig

type SetChatDescriptionConfig struct {
	ChatID          int64
	ChannelUsername string

	Description string
}

SetChatDescriptionConfig allows you to set the description of a supergroup or channel.

func NewChatDescription

func NewChatDescription(chatID int64, description string) SetChatDescriptionConfig

NewChatDescription allows you to update the description of a chat.

func (SetChatDescriptionConfig) Method

func (config SetChatDescriptionConfig) Method() string

func (SetChatDescriptionConfig) Params

func (config SetChatDescriptionConfig) Params() (Params, error)

type SetChatPermissionsConfig

type SetChatPermissionsConfig struct {
	ChatConfig
	Permissions *ChatPermissions
}

SetChatPermissionsConfig allows you to set default permissions for the members in a group. The bot must be an administrator and have rights to restrict members.

func (SetChatPermissionsConfig) Method

func (SetChatPermissionsConfig) Params

func (config SetChatPermissionsConfig) Params() (Params, error)

type SetChatPhotoConfig

type SetChatPhotoConfig struct {
	BaseFile
}

SetChatPhotoConfig allows you to set a group, supergroup, or channel's photo.

func NewChatPhoto

func NewChatPhoto(chatID int64, photo interface{}) SetChatPhotoConfig

NewChatPhoto allows you to update the photo for a chat.

func (SetChatPhotoConfig) Files

func (config SetChatPhotoConfig) Files() []RequestFile

func (SetChatPhotoConfig) Method

func (config SetChatPhotoConfig) Method() string

type SetChatStickerSetConfig

type SetChatStickerSetConfig struct {
	ChatID             int64
	SuperGroupUsername string

	StickerSetName string
}

SetChatStickerSetConfig allows you to set the sticker set for a supergroup.

func (SetChatStickerSetConfig) Method

func (config SetChatStickerSetConfig) Method() string

func (SetChatStickerSetConfig) Params

func (config SetChatStickerSetConfig) Params() (Params, error)

type SetChatTitleConfig

type SetChatTitleConfig struct {
	ChatID          int64
	ChannelUsername string

	Title string
}

SetChatTitleConfig allows you to set the title of something other than a private chat.

func NewChatTitle

func NewChatTitle(chatID int64, title string) SetChatTitleConfig

NewChatTitle allows you to update the title of a chat.

func (SetChatTitleConfig) Method

func (config SetChatTitleConfig) Method() string

func (SetChatTitleConfig) Params

func (config SetChatTitleConfig) Params() (Params, error)

type SetGameScoreConfig

type SetGameScoreConfig struct {
	UserID             int64
	Score              int
	Force              bool
	DisableEditMessage bool
	ChatID             int64
	ChannelUsername    string
	MessageID          int
	InlineMessageID    string
}

SetGameScoreConfig allows you to update the game score in a chat.

func (SetGameScoreConfig) Method

func (config SetGameScoreConfig) Method() string

func (SetGameScoreConfig) Params

func (config SetGameScoreConfig) Params() (Params, error)

type SetMyCommandsConfig

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

SetMyCommandsConfig sets a list of commands the bot understands.

func NewSetMyCommands

func NewSetMyCommands(commands ...BotCommand) SetMyCommandsConfig

NewSetMyCommands allows you to set the registered commands.

func (SetMyCommandsConfig) Method

func (config SetMyCommandsConfig) Method() string

func (SetMyCommandsConfig) Params

func (config SetMyCommandsConfig) Params() (Params, error)

func (SetMyCommandsConfig) Set

type SetStickerPositionConfig

type SetStickerPositionConfig struct {
	Sticker  string
	Position int
}

SetStickerPositionConfig allows you to change the position of a sticker in a set.

func (SetStickerPositionConfig) Method

func (config SetStickerPositionConfig) Method() string

func (SetStickerPositionConfig) Params

func (config SetStickerPositionConfig) Params() (Params, error)

type SetStickerSetThumbConfig

type SetStickerSetThumbConfig struct {
	Name   string
	UserID int64
	Thumb  interface{}
}

SetStickerSetThumbConfig allows you to set the thumbnail for a sticker set.

func (SetStickerSetThumbConfig) Files

func (config SetStickerSetThumbConfig) Files() []RequestFile

func (SetStickerSetThumbConfig) Method

func (config SetStickerSetThumbConfig) Method() string

func (SetStickerSetThumbConfig) Params

func (config SetStickerSetThumbConfig) Params() (Params, error)

type ShippingAddress

type ShippingAddress struct {
	// CountryCode ISO 3166-1 alpha-2 country code
	CountryCode string `json:"country_code"`
	// State if applicable
	State string `json:"state"`
	// City city
	City string `json:"city"`
	// StreetLine1 first line for the address
	StreetLine1 string `json:"street_line1"`
	// StreetLine2 second line for the address
	StreetLine2 string `json:"street_line2"`
	// PostCode address post code
	PostCode string `json:"post_code"`
}

ShippingAddress represents a shipping address.

type ShippingConfig

type ShippingConfig struct {
	ShippingQueryID string // required
	OK              bool   // required
	ShippingOptions []ShippingOption
	ErrorMessage    string
}

ShippingConfig contains information for answerShippingQuery request.

func (ShippingConfig) Method

func (config ShippingConfig) Method() string

func (ShippingConfig) Params

func (config ShippingConfig) Params() (Params, error)

type ShippingOption

type ShippingOption struct {
	// ID shipping option identifier
	ID string `json:"id"`
	// Title option title
	Title string `json:"title"`
	// Prices list of price portions
	Prices []LabeledPrice `json:"prices"`
}

ShippingOption represents one shipping option.

type ShippingQuery

type ShippingQuery struct {
	// ID unique query identifier
	ID string `json:"id"`
	// From user who sent the query
	From *User `json:"from"`
	// InvoicePayload bot specified invoice payload
	InvoicePayload string `json:"invoice_payload"`
	// ShippingAddress user specified shipping address
	ShippingAddress *ShippingAddress `json:"shipping_address"`
}

ShippingQuery contains information about an incoming shipping query.

type Sticker

type Sticker struct {
	// FileID is an identifier for this file, which can be used to download or
	// reuse the file
	FileID string `json:"file_id"`
	// FileUniqueID is an 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"`
	// Width sticker width
	Width int `json:"width"`
	// Height sticker height
	Height int `json:"height"`
	// IsAnimated true, if the sticker is animated
	//
	// optional
	IsAnimated bool `json:"is_animated,omitempty"`
	// Thumbnail sticker thumbnail in the .WEBP or .JPG format
	//
	// optional
	Thumbnail *PhotoSize `json:"thumb,omitempty"`
	// Emoji associated with the sticker
	//
	// optional
	Emoji string `json:"emoji,omitempty"`
	// SetName of the sticker set to which the sticker belongs
	//
	// optional
	SetName string `json:"set_name,omitempty"`
	// MaskPosition is for mask stickers, the position where the mask should be
	// placed
	//
	// optional
	MaskPosition *MaskPosition `json:"mask_position,omitempty"`
	// FileSize
	//
	// optional
	FileSize int `json:"file_size,omitempty"`
}

Sticker represents a sticker.

type StickerConfig

type StickerConfig struct {
	BaseFile
}

StickerConfig contains information about a SendSticker request.

func NewSticker

func NewSticker(chatID int64, file interface{}) StickerConfig

NewSticker creates a new sendSticker request.

func (StickerConfig) Files

func (config StickerConfig) Files() []RequestFile

func (StickerConfig) Method

func (config StickerConfig) Method() string

func (StickerConfig) Params

func (config StickerConfig) Params() (Params, error)

type StickerSet

type StickerSet struct {
	// Name sticker set name
	Name string `json:"name"`
	// Title sticker set title
	Title string `json:"title"`
	// IsAnimated true, if the sticker set contains animated stickers
	IsAnimated bool `json:"is_animated"`
	// ContainsMasks true, if the sticker set contains masks
	ContainsMasks bool `json:"contains_masks"`
	// Stickers list of all set stickers
	Stickers []Sticker `json:"stickers"`
	// Thumb is the sticker set thumbnail in the .WEBP or .TGS format
	Thumbnail *PhotoSize `json:"thumb"`
}

StickerSet represents a sticker set.

type StopMessageLiveLocationConfig

type StopMessageLiveLocationConfig struct {
	BaseEdit
}

StopMessageLiveLocationConfig stops updating a live location.

func (StopMessageLiveLocationConfig) Method

func (config StopMessageLiveLocationConfig) Method() string

func (StopMessageLiveLocationConfig) Params

func (config StopMessageLiveLocationConfig) Params() (Params, error)

type StopPollConfig

type StopPollConfig struct {
	BaseEdit
}

StopPollConfig allows you to stop a poll sent by the bot.

func NewStopPoll

func NewStopPoll(chatID int64, messageID int) StopPollConfig

NewStopPoll allows you to stop a poll.

func (StopPollConfig) Method

func (StopPollConfig) Method() string

func (StopPollConfig) Params

func (config StopPollConfig) Params() (Params, error)

type SuccessfulPayment

type SuccessfulPayment struct {
	// Currency three-letter ISO 4217 currency code
	// (see https://core.telegram.org/bots/payments#supported-currencies)
	Currency string `json:"currency"`
	// TotalAmount total price in the smallest units of the currency (integer, not float/double).
	// For example, for a price of US$ 1.45 pass amount = 145.
	// See the exp parameter in currencies.json,
	// (https://core.telegram.org/bots/payments/currencies.json)
	// it shows the number of digits past the decimal point
	// for each currency (2 for the majority of currencies).
	TotalAmount int `json:"total_amount"`
	// InvoicePayload bot specified invoice payload
	InvoicePayload string `json:"invoice_payload"`
	// ShippingOptionID identifier of the shipping option chosen by the user
	//
	// optional
	ShippingOptionID string `json:"shipping_option_id,omitempty"`
	// OrderInfo order info provided by the user
	//
	// optional
	OrderInfo *OrderInfo `json:"order_info,omitempty"`
	// TelegramPaymentChargeID telegram payment identifier
	TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`
	// ProviderPaymentChargeID provider payment identifier
	ProviderPaymentChargeID string `json:"provider_payment_charge_id"`
}

SuccessfulPayment contains basic information about a successful payment.

type UnbanChatMemberConfig

type UnbanChatMemberConfig struct {
	ChatMemberConfig
	OnlyIfBanned bool
}

UnbanChatMemberConfig allows you to unban a user.

func (UnbanChatMemberConfig) Method

func (config UnbanChatMemberConfig) Method() string

func (UnbanChatMemberConfig) Params

func (config UnbanChatMemberConfig) Params() (Params, error)

type UnpinAllChatMessagesConfig

type UnpinAllChatMessagesConfig struct {
	ChatID          int64
	ChannelUsername string
}

UnpinAllChatMessagesConfig contains information of all messages to unpin in a chat.

func (UnpinAllChatMessagesConfig) Method

func (config UnpinAllChatMessagesConfig) Method() string

func (UnpinAllChatMessagesConfig) Params

func (config UnpinAllChatMessagesConfig) Params() (Params, error)

type UnpinChatMessageConfig

type UnpinChatMessageConfig struct {
	ChatID          int64
	ChannelUsername string
	MessageID       int
}

UnpinChatMessageConfig contains information of a chat message to unpin.

If MessageID is not specified, it will unpin the most recent pin.

func (UnpinChatMessageConfig) Method

func (config UnpinChatMessageConfig) Method() string

func (UnpinChatMessageConfig) Params

func (config UnpinChatMessageConfig) Params() (Params, error)

type Update

type Update struct {
	// UpdateID is the update's unique identifier.
	// Update identifiers start from a certain positive number and increase
	// sequentially.
	// This ID becomes especially handy if you're using Webhooks,
	// since it allows you to ignore repeated updates or to restore
	// the correct update sequence, should they get out of order.
	// If there are no new updates for at least a week, then identifier
	// of the next update will be chosen randomly instead of sequentially.
	UpdateID int `json:"update_id"`
	// Message new incoming message of any kind — text, photo, sticker, etc.
	//
	// optional
	Message *Message `json:"message,omitempty"`
	// EditedMessage new version of a message that is known to the bot and was
	// edited
	//
	// optional
	EditedMessage *Message `json:"edited_message,omitempty"`
	// ChannelPost new version of a message that is known to the bot and was
	// edited
	//
	// optional
	ChannelPost *Message `json:"channel_post,omitempty"`
	// EditedChannelPost new incoming channel post of any kind — text, photo,
	// sticker, etc.
	//
	// optional
	EditedChannelPost *Message `json:"edited_channel_post,omitempty"`
	// InlineQuery new incoming inline query
	//
	// optional
	InlineQuery *InlineQuery `json:"inline_query,omitempty"`
	// ChosenInlineResult is the result of an inline query
	// that was chosen by a user and sent to their chat partner.
	// Please see our documentation on the feedback collecting
	// for details on how to enable these updates for your bot.
	//
	// optional
	ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"`
	// CallbackQuery new incoming callback query
	//
	// optional
	CallbackQuery *CallbackQuery `json:"callback_query,omitempty"`
	// ShippingQuery new incoming shipping query. Only for invoices with
	// flexible price
	//
	// optional
	ShippingQuery *ShippingQuery `json:"shipping_query,omitempty"`
	// PreCheckoutQuery new incoming pre-checkout query. Contains full
	// information about checkout
	//
	// optional
	PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"`
	// Pool new poll state. Bots receive only updates about stopped polls and
	// polls, which are sent by the bot
	//
	// optional
	Poll *Poll `json:"poll,omitempty"`
	// PollAnswer user changed their answer in a non-anonymous poll. Bots
	// receive new votes only in polls that were sent by the bot itself.
	//
	// optional
	PollAnswer *PollAnswer `json:"poll_answer,omitempty"`
	// MyChatMember is the bot's chat member status was updated in a chat. For
	// private chats, this update is received only when the bot is blocked or
	// unblocked by the user.
	//
	// optional
	MyChatMember *ChatMemberUpdated `json:"my_chat_member,omitempty"`
	// ChatMember is a chat member's status was updated in a chat. The bot must
	// be an administrator in the chat and must explicitly specify "chat_member"
	// in the list of allowed_updates to receive these updates.
	//
	// optional
	ChatMember *ChatMemberUpdated `json:"chat_member,omitempty"`
}

Update is an update response, from GetUpdates.

type UpdateConfig

type UpdateConfig struct {
	Offset         int
	Limit          int
	Timeout        int
	AllowedUpdates []string
}

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

func (UpdateConfig) Method() string

func (UpdateConfig) Params

func (config UpdateConfig) Params() (Params, error)

type UploadStickerConfig

type UploadStickerConfig struct {
	UserID     int64
	PNGSticker interface{}
}

UploadStickerConfig allows you to upload a sticker for use in a set later.

func (UploadStickerConfig) Files

func (config UploadStickerConfig) Files() []RequestFile

func (UploadStickerConfig) Method

func (config UploadStickerConfig) Method() string

func (UploadStickerConfig) Params

func (config UploadStickerConfig) Params() (Params, error)

type User

type User struct {
	// ID is a unique identifier for this user or bot
	ID int64 `json:"id"`
	// IsBot true, if this user is a bot
	//
	// optional
	IsBot bool `json:"is_bot,omitempty"`
	// FirstName user's or bot's first name
	FirstName string `json:"first_name"`
	// LastName user's or bot's last name
	//
	// optional
	LastName string `json:"last_name,omitempty"`
	// UserName user's or bot's username
	//
	// optional
	UserName string `json:"username,omitempty"`
	// LanguageCode IETF language tag of the user's language
	// more info: https://en.wikipedia.org/wiki/IETF_language_tag
	//
	// optional
	LanguageCode string `json:"language_code,omitempty"`
	// CanJoinGroups is true, if the bot can be invited to groups.
	// Returned only in getMe.
	//
	// optional
	CanJoinGroups bool `json:"can_join_groups,omitempty"`
	// CanReadAllGroupMessages is true, if privacy mode is disabled for the bot.
	// Returned only in getMe.
	//
	// optional
	CanReadAllGroupMessages bool `json:"can_read_all_group_messages,omitempty"`
	// SupportsInlineQueries is true, if the bot supports inline queries.
	// Returned only in getMe.
	//
	// optional
	SupportsInlineQueries bool `json:"supports_inline_queries,omitempty"`
}

User represents a Telegram user or bot.

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.

type UserProfilePhotos

type UserProfilePhotos struct {
	// TotalCount total number of profile pictures the target user has
	TotalCount int `json:"total_count"`
	// Photos requested profile pictures (in up to 4 sizes each)
	Photos [][]PhotoSize `json:"photos"`
}

UserProfilePhotos contains a set of user profile photos.

type UserProfilePhotosConfig

type UserProfilePhotosConfig struct {
	UserID int64
	Offset int
	Limit  int
}

UserProfilePhotosConfig contains information about a GetUserProfilePhotos request.

func NewUserProfilePhotos

func NewUserProfilePhotos(userID int64) UserProfilePhotosConfig

NewUserProfilePhotos gets user profile photos.

userID is the ID of the user you wish to get profile photos from.

func (UserProfilePhotosConfig) Method

func (UserProfilePhotosConfig) Params

func (config UserProfilePhotosConfig) Params() (Params, error)

type Venue

type Venue struct {
	// Location is the venue location
	Location Location `json:"location"`
	// Title is the name of the venue
	Title string `json:"title"`
	// Address of the venue
	Address string `json:"address"`
	// FoursquareID is the foursquare identifier of the venue
	//
	// optional
	FoursquareID string `json:"foursquare_id,omitempty"`
	// FoursquareType is the foursquare type of the venue
	//
	// optional
	FoursquareType string `json:"foursquare_type,omitempty"`
	// GooglePlaceID is the Google Places identifier of the venue
	//
	// optional
	GooglePlaceID string `json:"google_place_id,omitempty"`
	// GooglePlaceType is the Google Places type of the venue
	//
	// optional
	GooglePlaceType string `json:"google_place_type,omitempty"`
}

Venue represents a venue.

type VenueConfig

type VenueConfig struct {
	BaseChat
	Latitude        float64 // required
	Longitude       float64 // required
	Title           string  // required
	Address         string  // required
	FoursquareID    string
	FoursquareType  string
	GooglePlaceID   string
	GooglePlaceType 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) Method

func (config VenueConfig) Method() string

func (VenueConfig) Params

func (config VenueConfig) Params() (Params, error)

type Video

type Video struct {
	// FileID identifier for this file, which can be used to download or reuse
	// the file
	FileID string `json:"file_id"`
	// FileUniqueID is the 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"`
	// Width video width as defined by sender
	Width int `json:"width"`
	// Height video height as defined by sender
	Height int `json:"height"`
	// Duration of the video in seconds as defined by sender
	Duration int `json:"duration"`
	// Thumbnail video thumbnail
	//
	// optional
	Thumbnail *PhotoSize `json:"thumb,omitempty"`
	// FileName is the original filename as defined by sender
	//
	// optional
	FileName string `json:"file_name,omitempty"`
	// MimeType of a file as defined by sender
	//
	// optional
	MimeType string `json:"mime_type,omitempty"`
	// FileSize file size
	//
	// optional
	FileSize int `json:"file_size,omitempty"`
}

Video represents a video file.

type VideoConfig

type VideoConfig struct {
	BaseFile
	Thumb             interface{}
	Duration          int
	Caption           string
	ParseMode         string
	CaptionEntities   []MessageEntity
	SupportsStreaming bool
}

VideoConfig contains information about a SendVideo request.

func NewVideo

func NewVideo(chatID int64, file interface{}) VideoConfig

NewVideo creates a new sendVideo request.

func (VideoConfig) Files

func (config VideoConfig) Files() []RequestFile

func (VideoConfig) Method

func (config VideoConfig) Method() string

func (VideoConfig) Params

func (config VideoConfig) Params() (Params, error)

type VideoNote

type VideoNote struct {
	// FileID identifier for this file, which can be used to download or reuse the file
	FileID string `json:"file_id"`
	// FileUniqueID is the 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"`
	// Length video width and height (diameter of the video message) as defined by sender
	Length int `json:"length"`
	// Duration of the video in seconds as defined by sender
	Duration int `json:"duration"`
	// Thumbnail video thumbnail
	//
	// optional
	Thumbnail *PhotoSize `json:"thumb,omitempty"`
	// FileSize file size
	//
	// optional
	FileSize int `json:"file_size,omitempty"`
}

VideoNote object represents a video message.

type VideoNoteConfig

type VideoNoteConfig struct {
	BaseFile
	Thumb    interface{}
	Duration int
	Length   int
}

VideoNoteConfig contains information about a SendVideoNote request.

func NewVideoNote

func NewVideoNote(chatID int64, length int, file interface{}) VideoNoteConfig

NewVideoNote creates a new sendVideoNote request.

chatID is where to send it, file is a string path to the file, FileReader, or FileBytes.

func (VideoNoteConfig) Files

func (config VideoNoteConfig) Files() []RequestFile

func (VideoNoteConfig) Method

func (config VideoNoteConfig) Method() string

func (VideoNoteConfig) Params

func (config VideoNoteConfig) Params() (Params, error)

type Voice

type Voice struct {
	// FileID identifier for this file, which can be used to download or reuse the file
	FileID string `json:"file_id"`
	// FileUniqueID is the 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"`
	// Duration of the audio in seconds as defined by sender
	Duration int `json:"duration"`
	// MimeType of the file as defined by sender
	//
	// optional
	MimeType string `json:"mime_type,omitempty"`
	// FileSize file size
	//
	// optional
	FileSize int `json:"file_size,omitempty"`
}

Voice represents a voice note.

type VoiceChatEnded

type VoiceChatEnded struct {
	// Voice chat duration; in seconds.
	Duration int `json:"duration"`
}

VoiceChatEnded represents a service message about a voice chat ended in the chat.

type VoiceChatParticipantsInvited

type VoiceChatParticipantsInvited struct {
	// New members that were invited to the voice chat.
	//
	// optional
	Users []User `json:"users"`
}

VoiceChatParticipantsInvited represents a service message about new members invited to a voice chat.

type VoiceChatScheduled

type VoiceChatScheduled struct {
	// Point in time (Unix timestamp) when the voice chat is supposed to be
	// started by a chat administrator
	StartDate int `json:"start_date"`
}

VoiceChatScheduled represents a service message about a voice chat scheduled in the chat.

func (*VoiceChatScheduled) Time

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

Time converts the scheduled start date into a Time.

type VoiceChatStarted

type VoiceChatStarted struct{}

VoiceChatStarted represents a service message about a voice chat started in the chat.

type VoiceConfig

type VoiceConfig struct {
	BaseFile
	Thumb           interface{}
	Caption         string
	ParseMode       string
	CaptionEntities []MessageEntity
	Duration        int
}

VoiceConfig contains information about a SendVoice request.

func NewVoice

func NewVoice(chatID int64, file interface{}) VoiceConfig

NewVoice creates a new sendVoice request.

func (VoiceConfig) Files

func (config VoiceConfig) Files() []RequestFile

func (VoiceConfig) Method

func (config VoiceConfig) Method() string

func (VoiceConfig) Params

func (config VoiceConfig) Params() (Params, error)

type WebhookConfig

type WebhookConfig struct {
	URL                *url.URL
	Certificate        interface{}
	IPAddress          string
	MaxConnections     int
	AllowedUpdates     []string
	DropPendingUpdates bool
}

WebhookConfig contains information about a SetWebhook request.

func NewWebhook

func NewWebhook(link string) (WebhookConfig, error)

NewWebhook creates a new webhook.

link is the url parsable link you wish to get the updates.

func NewWebhookWithCert

func NewWebhookWithCert(link string, file interface{}) (WebhookConfig, error)

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

func (config WebhookConfig) Files() []RequestFile

func (WebhookConfig) Method

func (config WebhookConfig) Method() string

func (WebhookConfig) Params

func (config WebhookConfig) Params() (Params, error)

type WebhookInfo

type WebhookInfo struct {
	// URL webhook URL, may be empty if webhook is not set up.
	URL string `json:"url"`
	// HasCustomCertificate true, if a custom certificate was provided for webhook certificate checks.
	HasCustomCertificate bool `json:"has_custom_certificate"`
	// PendingUpdateCount number of updates awaiting delivery.
	PendingUpdateCount int `json:"pending_update_count"`
	// IPAddress is the currently used webhook IP address
	//
	// optional
	IPAddress string `json:"ip_address,omitempty"`
	// LastErrorDate unix time for the most recent error
	// that happened when trying to deliver an update via webhook.
	//
	// optional
	LastErrorDate int `json:"last_error_date,omitempty"`
	// LastErrorMessage error message in human-readable format for the most recent error
	// that happened when trying to deliver an update via webhook.
	//
	// optional
	LastErrorMessage string `json:"last_error_message,omitempty"`
	// MaxConnections maximum allowed number of simultaneous
	// HTTPS connections to the webhook for update delivery.
	//
	// optional
	MaxConnections int `json:"max_connections,omitempty"`
	// AllowedUpdates is a list of update types the bot is subscribed to.
	// Defaults to all update types
	//
	// optional
	AllowedUpdates []string `json:"allowed_updates,omitempty"`
}

WebhookInfo is information about a currently set webhook.

func (WebhookInfo) IsSet

func (info WebhookInfo) IsSet() bool

IsSet returns true if a webhook is currently set.

Jump to

Keyboard shortcuts

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