telegraph

package module
v0.0.0-...-1b031c2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2018 License: MIT Imports: 7 Imported by: 0

README

Telegraph

Build Status Coverage Status Go Report Card GoDoc Version

Telegraph is Telegram bot API SDK for Go(Golang), Can use back off retry request to Telegram bot API

Reference to Telegram bot API Documentation

Installation

$ go get github.com/dynastymasra/telegraph

How to use

import library github.com/dynastymasra/telegraph, See Telegram API Documentation to know available method can used, and what params can use in a method.

Create new client with no use back off retry, use params access token obtain from telegram bot father.

client := telegraph.NewClient(<access_token>)

res, err := client.SetWebHook("https://www.cubesoft.co.id").SetCertificate("./LICENSE").SetMaxConnection(100).SetAllowedUpdates("1", "2", "3").Commit()
if err != nil {
	// Do something when error
}

info, res, err := client.GetWebHookInfo().Commit()
if err != nil {
	// Do something when error
}

Create new client with use back off retry, with params access token obtain from telegram bot father and max interval and max elapsed time

client := telegraph.NewClientWithBackOff(<access_token>, telegraph.NewBackOff(<max_interval>, <max_elapsed_time>))

res, err := client.DeleteWebHook().Commit()
if err != nil {
	// Do something when error
}

Parse telegram web hook request, reference to telegram Documentation

message, err := telegraph.WebHookParseRequest(<request_in_[]byte>)
if err != nil {
	// Do something when error
}

Send message to telegram use Telegraph SDK

client := telegraph.NewClientWithBackOff(<access_token>, telegraph.NewBackOff(<max_interval>, <max_elapsed_time>))

// Use upload false if file from url
message, res, err := client.SendPhoto(<chat_id>, "http://www.images.com/images/jpg", false).SetCaption("test image").Commit()
if err != nil {
	// Do something when error
}
// Use upload true if from path file

message, res, err := client.SendAudio(<chat_id>, "/home/audio/audio.mp3", true).SetCaption("test audio").SetDuration(1000).Commit()
if err != nil {
	// Do something when error
}

Contributing

If you find any issue you want to fix it, feel free to send me a pull request. And also if you have idea for improvement this library, feel free to send me a pull request.

Library

  • GoRequest - Simplified HTTP client ( inspired by famous SuperAgent lib in Node.js )
  • Backoff - The exponential backoff algorithm in Go (Golang)
  • Gock - HTTP traffic mocking and expectations made easy for Go
  • Testify - A toolkit with common assertions and mocks that plays nicely with the standard library

Documentation

Index

Constants

View Source
const (
	// Version of telegraph
	Version         = "2.0.0"
	UserAgentHeader = "User-Agent"
	BaseURL         = "https://api.telegram.org"

	// UserAgent header send to telegram
	UserAgent = "Telegram Go SDK(Telegraph)"

	EndpointGetMe                   = "/bot%v/getMe"
	EndpointSetWebHook              = "/bot%v/setWebhook"
	EndpointGetUpdate               = "/bot%v/getUpdates"
	EndpointDeleteWebHook           = "/bot%v/deleteWebhook"
	EndpointGetWebHookInfo          = "/bot%v/getWebhookInfo"
	EndpointSendMessage             = "/bot%v/sendMessage"
	EndpointForwardMessage          = "/bot%v/forwardMessage"
	EndpointSendPhoto               = "/bot%v/sendPhoto"
	EndpointSendAudio               = "/bot%v/sendAudio"
	EndpointSendDocument            = "/bot%v/sendDocument"
	EndpointSendVideo               = "/bot%v/sendVideo"
	EndpointSendVoice               = "/bot%v/sendVoice"
	EndpointSendVideoNote           = "/bot%v/sendVideoNote"
	EndpointSendMediaGroup          = "/bot%v/sendMediaGroup"
	EndpointSendLocation            = "/bot%v/sendLocation"
	EndpointEditMessageLiveLocation = "/bot%v/editMessageLiveLocation"
	EndpointStopMessageLiveLocation = "/bot%v/stopMessageLiveLocation"
	EndpointSendVenue               = "/bot%v/sendVenue"
	EndpointSendContact             = "/bot%v/sendContact"
	EndpointSendChatAction          = "/bot%v/sendChatAction"
	EndpointGetUserProfilePhoto     = "/bot%v/getUserProfilePhotos"
	EndpointGetFile                 = "/bot%v/getFile"
	EndpointGetContent              = "/file/bot%v/%v"
	EndpointKickChatMember          = "/bot%v/kickChatMember"
	EndpointUnbanChatMember         = "/bot%v/unbanChatMember"
	EndpointRestrictChatMember      = "/bot%v/restrictChatMember"
	EndpointPromoteChatMember       = "/bot%v/promoteChatMember"
	EndpointExportChatInviteLink    = "/bot%v/exportChatInviteLink"
	EndpointSetChatPhoto            = "/bot%v/setChatPhoto"
	EndpointDeleteChatPhoto         = "/bot%v/deleteChatPhoto"
	EndpointSetChatTitle            = "/bot%v/setChatTitle"
	EndpointSetChatDescription      = "/bot%v/setChatDescription"
	EndpointPinChatMessage          = "/bot%v/pinChatMessage"
	EndpointUnpinChatMessage        = "/bot%v/unpinChatMessage"
	EndpointLeaveChat               = "/bot%v/leaveChat"
	EndpointGetChat                 = "/bot%v/getChat"
	EndpointGetChatAdministrators   = "/bot%v/getChatAdministrators"
	EndpointGetChatMembersCount     = "/bot%v/getChatMembersCount"
	EndpointGetChatMember           = "/bot%v/getChatMember"
	EndpointSetChatStickerSet       = "/bot%v/setChatStickerSet"
	EndpointDeleteChatStickerSet    = "/bot%v/deleteChatStickerSet"
	EndpointAnswerCallbackQuery     = "/bot%v/answerCallbackQuery"
	EndpointEditMessageText         = "/bot%v/editMessageText"
	EndpointEditMessageCaption      = "/bot%v/editMessageCaption"
	EndpointEditMessageReplyMarkup  = "/bot%v/editMessageReplyMarkup"
	EndpointDeleteMessage           = "/bot%v/deleteMessage"
	EndpointSendSticker             = "/bot%v/sendSticker"
	EndpointGetStickerSet           = "/bot%v/getStickerSet"
	EndpointUploadStickerFile       = "/bot%v/uploadStickerFile"
	EndpointCreateNewStickerSet     = "/bot%v/createNewStickerSet"
	EndpointAddStickerToSet         = "/bot%v/addStickerToSet"
	EndpointSetStickerPositionInSet = "/bot%v/setStickerPositionInSet"
	EndpointDeleteStickerFromSet    = "/bot%v/deleteStickerFromSet"
	EndpointAnswerInlineQuery       = "/bot%v/answerInlineQuery"
)
View Source
const (
	ChatTypePrivate    ChatType = "private"
	ChatTypeGroup               = "group"
	ChatTypeSuperGroup          = "supergroup"
	ChatTypeChannel             = "channel"

	StatusTypeCreator       StatusType = "creator"
	StatusTypeAdministrator            = "administrator"
	StatusTypeMember                   = "member"
	StatusTypeRestricted               = "restricted"
	StatusTypeLeft                     = "left"
	StatusTypeKicked                   = "kicked"

	MediaTypePhoto MediaType = "photo"
	MediaTypeVideo           = "video"
)

Variables

This section is empty.

Functions

func MakeHTTPResponse

func MakeHTTPResponse(agent *gorequest.SuperAgent) *http.Response

MakeHTTPResponse create mock http response if request to API is error internal

func NewBackOff

func NewBackOff(maxInterval, maxElapsedTime int) *backoff.ExponentialBackOff

NewBackOff declare retry exponential back off with max interval time and max elapsed time in second

Types

type Animation

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

Animation You can provide an animation for your game so that it looks stylish in chats (check out Lumberjack for an example). This object represents an animation file to be displayed in the message containing a game.

type ArrayChatMemberResponse

type ArrayChatMemberResponse struct {
	Client  *Client
	Request *gorequest.SuperAgent
}

ArrayChatMemberResponse struct to handle request and response telegram api

func (*ArrayChatMemberResponse) Commit

func (void *ArrayChatMemberResponse) Commit() ([]ChatMember, *http.Response, error)

Commit execute request to telegram

type ArrayMessageResponse

type ArrayMessageResponse struct {
	Client  *Client
	Request *gorequest.SuperAgent
}

ArrayMessageResponse struct to handle request and array response telegram api

func (*ArrayMessageResponse) Commit

func (message *ArrayMessageResponse) Commit() ([]Message, *http.Response, error)

Commit execute request to telegram

func (*ArrayMessageResponse) SetDisableNotification

func (message *ArrayMessageResponse) SetDisableNotification(disable bool) *ArrayMessageResponse

SetDisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*ArrayMessageResponse) SetReplyToMessageID

func (message *ArrayMessageResponse) SetReplyToMessageID(id int64) *ArrayMessageResponse

SetReplyToMessageID If the message is a reply, ID of the original message

type ArrayUpdateResponse

type ArrayUpdateResponse struct {
	Client  *Client
	Request *gorequest.SuperAgent
}

ArrayUpdateResponse struct to handle request and response from telegram api with array update

func (*ArrayUpdateResponse) Commit

func (update *ArrayUpdateResponse) Commit() ([]Update, *http.Response, error)

Commit request to telegram api

func (*ArrayUpdateResponse) SetAllowedUpdates

func (update *ArrayUpdateResponse) SetAllowedUpdates(updates ...string) *ArrayUpdateResponse

SetAllowedUpdates List the types of updates you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used. Please note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time.

func (*ArrayUpdateResponse) SetLimit

func (update *ArrayUpdateResponse) SetLimit(limit int) *ArrayUpdateResponse

SetLimit Limits the number of updates to be retrieved. Values between 1—100 are accepted. Defaults to 100.

func (*ArrayUpdateResponse) SetOffset

func (update *ArrayUpdateResponse) SetOffset(offset int) *ArrayUpdateResponse

SetOffset Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will forgotten.

func (*ArrayUpdateResponse) SetTimeout

func (update *ArrayUpdateResponse) SetTimeout(timeout int) *ArrayUpdateResponse

SetTimeout Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.

type Audio

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

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

type CallbackGame

type CallbackGame struct{}

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

type CallbackQuery

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

CallbackQuery This object 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                     int64      `json:"id"`
	Type                   ChatType   `json:"type"`
	Title                  string     `json:"title,omitempty"`
	Username               string     `json:"username,omitempty"`
	FirstName              string     `json:"first_name,omitempty"`
	LastName               string     `json:"last_name,omitempty"`
	AllMemberAdministrator bool       `json:"all_members_are_administrators,omitempty"`
	Photo                  *ChatPhoto `json:"photo,omitempty"`
	Description            string     `json:"description,omitempty"`
	InviteLink             string     `json:"invite_link,omitempty"`
	PinnedMessage          *Message   `json:"pinned_message,omitempty"`
	StickerSetName         string     `json:"sticker_set_name,omitempty"`
	CanSetStickerSet       bool       `json:"can_set_sticker_set,omitempty"`
}

Chat This object represents a chat.

type ChatMember

type ChatMember struct {
	User                 *User      `json:"user"`
	Status               StatusType `json:"status"`
	UntilDate            int64      `json:"until_date,omitempty"`
	CanBeEdited          bool       `json:"can_be_edited,omitempty"`
	CanChangeInfo        bool       `json:"can_change_info,omitempty"`
	CanPostMessage       bool       `json:"can_post_messages,omitempty"`
	CanEditMessage       bool       `json:"can_edit_messages,omitempty"`
	CanDeleteMessage     bool       `json:"can_delete_messages,omitempty"`
	CanInviteUser        bool       `json:"can_invite_users,omitempty"`
	CanRestrictMember    bool       `json:"can_restrict_members,omitempty"`
	CanPinMessage        bool       `json:"can_pin_messages,omitempty"`
	CanPromoteMember     bool       `json:"can_promote_members,omitempty"`
	CanSendMessage       bool       `json:"can_send_messages,omitempty"`
	CanSendMediaMessage  bool       `json:"can_send_media_messages,omitempty"`
	CanSendOtherMessage  bool       `json:"can_send_other_messages,omitempty"`
	CanAddWebPagePreview bool       `json:"can_add_web_page_previews,omitempty"`
}

ChatMember This object contains information about one member of a chat.

type ChatMemberResponse

type ChatMemberResponse struct {
	Client  *Client
	Request *gorequest.SuperAgent
}

ChatMemberResponse struct to handle request and response telegram api

func (*ChatMemberResponse) Commit

func (void *ChatMemberResponse) Commit() (*ChatMember, *http.Response, error)

Commit execute request to telegram

type ChatPhoto

type ChatPhoto struct {
	SmallFileID string `json:"small_file_id"`
	BigFileID   string `json:"big_file_id"`
}

ChatPhoto This object represents a chat photo.

type ChatResponse

type ChatResponse struct {
	Client  *Client
	Request *gorequest.SuperAgent
}

ChatResponse struct to handle request and response telegram api

func (*ChatResponse) Commit

func (void *ChatResponse) Commit() (*Chat, *http.Response, error)

Commit execute request to telegram

type ChatType

type ChatType string

type ChosenInlineResult

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

ChosenInlineResult Represents a result of an inline query that was chosen by the user and sent to their chat partner.

type Client

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

Client struct configuration telegram

func NewClient

func NewClient(accessToken string) *Client

NewClient create new telegram configuration with access token

func NewClientWithBackOff

func NewClientWithBackOff(accessToken string, expBackOff *backoff.ExponentialBackOff) *Client

NewClientWithBackOff constructor for client with retry back off

func (*Client) AddStickerToSet

func (client *Client) AddStickerToSet(userId int64, name, pngSticker, emojis string) *VoidResponse

AddStickerToSet Use this method to add a new sticker to a set created by the bot. Returns True on success.

  • userId User identifier of sticker set owner
  • name Sticker set name
  • pngSticker Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data.
  • emojis One or more emoji corresponding to the sticker
  • upload set true if upload file to telegram from local
  • userId - User identifier of sticker set owner
  • name - Sticker set name
  • pngSticker - Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data.
  • emojis - One or more emoji corresponding to the sticker

Available method can used with this method + SetMaskPosition()

func (*Client) AnswerCallbackQuery

func (client *Client) AnswerCallbackQuery(queryId string) *VoidResponse

AnswerCallbackQuery Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.

Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via @Botfather and accept the terms. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter. + queryId - Unique identifier for the query to be answered

Available method can used with this method + SetText() + SetShowAlert() + SetURL() + SetCacheTime()

func (*Client) AnswerInlineQuery

func (client *Client) AnswerInlineQuery(inlineQueryId string, result ...JSON) *VoidResponse

AnswerInlineQuery Use this method to send answers to an inline query. On success, True is returned. No more than 50 results per query are allowed. + inlineQueryId - Unique identifier for the answered query + result - A JSON-serialized array of results for the inline query

Available method can used with this method + SetCacheTime() + SetIsPersonal() + SetNextOffset() + SetSwitchPMText() + SetSwitchPMParameter()

func (*Client) CreateNewStickerSet

func (client *Client) CreateNewStickerSet(userId int64, name, title, pngSticker, emojis string) *VoidResponse

CreateNewStickerSet Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success.

  • userId User identifier of created sticker set owner
  • name Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only english letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in “_by_<bot username>”. <bot_username> is case insensitive. 1-64 characters
  • title Sticker set title, 1-64 characters
  • pngSticker Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data
  • emojis One or more emoji corresponding to the sticker
  • upload set true if upload file to telegram from local
  • userId - User identifier of created sticker set owner
  • name - Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only english letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in “_by_<bot username>”. <bot_username> is case insensitive. 1-64 characters.
  • title - Sticker set title, 1-64 characters
  • pngSticker - Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data.
  • emojis - One or more emoji corresponding to the sticker

Available method can used with this method + SetContainsMask() + SetMaskPosition()

func (*Client) DeleteChatPhoto

func (client *Client) DeleteChatPhoto(chatId interface{}) *VoidResponse

DeleteChatPhoto Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is off in the target group. + chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*Client) DeleteChatStickerSet

func (client *Client) DeleteChatStickerSet(chatId interface{}) *VoidResponse

DeleteChatStickerSet Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success. + chatId - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*Client) DeleteMessage

func (client *Client) DeleteMessage(chatId interface{}, messageId int64) *VoidResponse

DeleteMessage Use this method to delete a message, including service messages, with the following limitations: - A message can only be deleted if it was sent less than 48 hours ago. - Bots can delete outgoing messages in groups and supergroups. - Bots granted can_post_messages permissions can delete outgoing messages in channels. - If the bot is an administrator of a group, it can delete any message there. - If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there. Returns True on success. + chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername) + messageId - Identifier of the message to delete

func (*Client) DeleteStickerFromSet

func (client *Client) DeleteStickerFromSet(sticker string) *VoidResponse

DeleteStickerFromSet Use this method to delete a sticker from a set created by the bot. Returns True on success. + sticker - File identifier of the sticker

func (*Client) DeleteWebHook

func (client *Client) DeleteWebHook() *VoidResponse

DeleteWebHook Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. Requires no parameters.

func (*Client) EditMessageCaption

func (client *Client) EditMessageCaption(caption string) *VoidResponse

EditMessageCaption Use this method to edit captions of messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. + caption - New caption of the message

Available method can used with this method + SetChatID() + SetMessageID() + SetInlineMessageID() + SetReplyMarkup()

func (*Client) EditMessageLiveLocation

func (client *Client) EditMessageLiveLocation(latitude, longitude float64) *VoidResponse

EditMessageLiveLocation Use this method to edit live location messages sent by the bot or via the bot (for inline bots). A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned. + latitude - Latitude of new location + longitude - Longitude of new location

Available method can used with this method + SetChatID() + SetMessageID() + SetInlineMessageID() + SetReplyMarkup()

func (*Client) EditMessageReplyMarkup

func (client *Client) EditMessageReplyMarkup() *VoidResponse

EditMessageReplyMarkup Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.

Available method can used with this method + SetChatID() + SetMessageID() + SetInlineMessageID() + SetReplyMarkup()

func (*Client) EditMessageText

func (client *Client) EditMessageText(text string) *VoidResponse

EditMessageText Use this method to edit text and game messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. + text - New text of the message

Available method can used with this method + SetChatID() + SetMessageID() + SetInlineMessageID() + SetParseMode() + SetDisableWebPagePreview() + SetReplyMarkup()

func (client *Client) ExportChatInviteLink(chatId interface{}) *StringResponse

ExportChatInviteLink Use this method to export an invite link to a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns exported invite link as String on success. + chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*Client) ForwardMessage

func (client *Client) ForwardMessage(chatId, fromChatId interface{}, messageId int) *MessageResponse

ForwardMessage Use this method to forward messages of any kind. On success, the sent Message is returned. + chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername) + fromChatId - Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername) + messageId - Message identifier in the chat specified in from_chat_id

Available method can used with this method + SetDisableNotification()

func (*Client) GetChat

func (client *Client) GetChat(chatId interface{}) *ChatResponse

GetChat Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success. + chatId - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)

func (*Client) GetChatAdministrator

func (client *Client) GetChatAdministrator(chatId interface{}) *ArrayChatMemberResponse

GetChatAdministrator Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned. + chatId - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)

func (*Client) GetChatMember

func (client *Client) GetChatMember(chatId interface{}, userId int64) *ChatMemberResponse

GetChatMember Use this method to get information about a member of a chat. Returns a ChatMember object on success. + chatId - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) + userId - Unique identifier of the target user

func (*Client) GetChatMembersCount

func (client *Client) GetChatMembersCount(chatId interface{}) *IntegerResponse

GetChatMembersCount Use this method to get the number of members in a chat. Returns Int on success. + chatId - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)

func (*Client) GetContent

func (client *Client) GetContent(path string) *VoidResponse

GetContent function for download file from telegram server, file path obtained from function GetFile() Exp https://api.telegram.org/file/bot<token>/<file_path>

func (*Client) GetFile

func (client *Client) GetFile(fileId string) *FileResponse

GetFile Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again. This function only return json value not file, download file use function GetContent() + fileId - File identifier to get info about

func (*Client) GetMe

func (client *Client) GetMe() *UserResponse

GetMe A simple method for testing your bot's auth token. Requires no parameters. Returns basic information about the bot in form of a User object.

func (*Client) GetStickerSet

func (client *Client) GetStickerSet(name string) *StickerSetResponse

GetStickerSet Use this method to get a sticker set. On success, a StickerSet object is returned. + name - Use this method to get a sticker set. On success, a StickerSet object is returned.

func (*Client) GetUpdates

func (client *Client) GetUpdates() *ArrayUpdateResponse

GetUpdates Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned. Notes 1. This method will not work if an outgoing webhook is set up. 2. In order to avoid getting duplicate updates, recalculate offset after each server response

Available method can used with this method + SetOffset() + SetLimit() + SetTimeout() + SetAllowedUpdates()

func (*Client) GetUserProfilePhotos

func (client *Client) GetUserProfilePhotos(userId int) *UserProfilePhotosResponse

GetUserProfilePhotos Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object. + userId - Unique identifier of the target user

Available method can used with this method + SetOffset() + SetLimit()

func (*Client) GetWebHookInfo

func (client *Client) GetWebHookInfo() *WebHookInfoResponse

GetWebHookInfo Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty.

func (*Client) KickChatMember

func (client *Client) KickChatMember(chatId interface{}, userId int64) *VoidResponse

KickChatMember Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.

Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is off in the target group. Otherwise members may only be removed by the group's creator or by the member that added them. + chatId - Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername) + userId - Unique identifier of the target user

Available method can used with this method + SetUntilDate()

func (*Client) LeaveChat

func (client *Client) LeaveChat(chatId interface{}) *VoidResponse

LeaveChat Use this method for your bot to leave a group, supergroup or channel. Returns True on success. + chatId - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)

func (*Client) PinChatMessage

func (client *Client) PinChatMessage(chatId interface{}, messageId int64) *VoidResponse

PinChatMessage Use this method to pin a message in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on success. + chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername) + messageId - Identifier of a message to pin

Available method can used with this method + SetDisableNotification()

func (*Client) PromoteChatMember

func (client *Client) PromoteChatMember(chatId interface{}, userId int64) *VoidResponse

PromoteChatMember Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user. Returns True on success. + chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername) + userId - Unique identifier of the target user

Available method can used with this method + SetCanChangeInfo() + SetCanPostMessage() + SetCanEditMessage() + SetCanDeleteMessage() + SetCanInviteUser() + SetCanRestrictMember() + SetCanPinMessage() + SetCanPromoteMember()

func (*Client) RestrictChatMember

func (client *Client) RestrictChatMember(chatId interface{}, userId int64) *VoidResponse

RestrictChatMember Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass True for all boolean parameters to lift restrictions from a user. Returns True on success. + chatId - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) + userId - Unique identifier of the target user

Available method can used with this method + SetUntilDate() + SetCanSendMessage() + SetCanSendMediaMessage() + SetCanSendOtherMessage() + SetCanAddWebPagePreview()

func (*Client) SendAudio

func (client *Client) SendAudio(chatId interface{}, audio string) *MessageResponse

SendAudio Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. For sending voice messages, use the sendVoice method instead.

  • chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • audio - Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data.

Available method can used with this method + SetCaption() + SetDuration() + SetPerformer() + SetTitle() + SetDisableNotification() + SetReplyToMessageID() + SetForceReply() + SetInlineKeyboardMarkup() + SetReplyKeyboardMarkup() + SetReplyKeyboardRemove()

func (*Client) SendChatAction

func (client *Client) SendChatAction(chatId interface{}, action string) *VoidResponse

SendChatAction Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.

Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of “Retrieving image, please wait…”, the bot may use sendChatAction with action = upload_photo. The user will see a “sending photo” status for the bot.

  • chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • action - Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_audio or upload_audio for audio files, upload_document for general files, find_location for location data, record_video_note or upload_video_note for video notes.

func (*Client) SendContact

func (client *Client) SendContact(chatId interface{}, phoneNumber, firstName string) *MessageResponse

SendContact Use this method to send phone contacts. On success, the sent Message is returned. + chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername) + phoneNumber - Contact's phone number + firstName - Contact's first name

Available method can used with this method + SetLastName() + SetDisableNotification() + SetReplyToMessageID() + SetForceReply() + SetInlineKeyboardMarkup() + SetReplyKeyboardMarkup() + SetReplyKeyboardRemove()

func (*Client) SendDocument

func (client *Client) SendDocument(chatId interface{}, document string) *MessageResponse

SendDocument Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.

  • chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • document - File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data.

Available method can used with this method + SetCaption() + SetDisableNotification() + SetReplyToMessageID() + SetForceReply() + SetInlineKeyboardMarkup() + SetReplyKeyboardMarkup() + SetReplyKeyboardRemove()

func (*Client) SendLocation

func (client *Client) SendLocation(chatId interface{}, latitude, longitude float64) *MessageResponse

SendLocation Use this method to send point on the map. On success, the sent Message is returned. + chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername) + latitude - Latitude of the location + longitude - Longitude of the location

Available method can used with this method + SetLivePeriod() + SetDisableNotification() + SetReplyToMessageID() + SetForceReply() + SetInlineKeyboardMarkup() + SetReplyKeyboardMarkup() + SetReplyKeyboardRemove()

func (*Client) SendMediaGroup

func (client *Client) SendMediaGroup(chatId interface{}, media []InputMedia) *ArrayMessageResponse

SendMediaGroup Use this method to send a group of photos or videos as an album. On success, an array of the sent Messages is returned. + chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername) + media - A JSON-serialized array describing photos and videos to be sent, must include 2–10 items

Available method can used with this method + SetDisableNotification() + SetReplyToMessageID()

func (*Client) SendMessage

func (client *Client) SendMessage(chatId interface{}, text string) *MessageResponse

SendMessage Use this method to send text messages. On success, the sent Message is returned. + chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername) + text - Text of the message to be sent

Available method can used with this method + SetParseMode() + SetDisableWebPagePreview() + SetDisableNotification() + SetReplyToMessageID() + SetForceReply() + SetInlineKeyboardMarkup() + SetReplyKeyboardMarkup() + SetReplyKeyboardRemove()

func (*Client) SendPhoto

func (client *Client) SendPhoto(chatId interface{}, photo string) *MessageResponse

SendPhoto Use this method to send photos. On success, the sent Message is returned.

  • chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • photo - Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data

Available method can used with this method + SetCaption() + SetDisableNotification() + SetReplyToMessageID() + SetForceReply() + SetInlineKeyboardMarkup() + SetReplyKeyboardMarkup() + SetReplyKeyboardRemove()

func (*Client) SendSticker

func (client *Client) SendSticker(chatId interface{}, sticker string) *MessageResponse

SendSticker Use this method to send .webp stickers. On success, the sent Message is returned.

  • chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • sticker - Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .webp file from the Internet, or upload a new one using multipart/form-data.

Available method can used with this method + SetDisableNotification() + SetReplyToMessageID() + SetForceReply() + SetInlineKeyboardMarkup() + SetReplyKeyboardMarkup() + SetReplyKeyboardRemove()

func (*Client) SendVenue

func (client *Client) SendVenue(chatId interface{}, latitude, longitude float64, title, address string) *MessageResponse

SendVenue Use this method to send information about a venue. On success, the sent Message is returned. + chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername) + latitude - Latitude of the venue + longitude - Longitude of the venue + title - Name of the venue + address - Address of the venue

Available method can used with this method + SetFoursquareID() + SetDisableNotification() + SetReplyToMessageID() + SetForceReply() + SetInlineKeyboardMarkup() + SetReplyKeyboardMarkup() + SetReplyKeyboardRemove()

func (*Client) SendVideo

func (client *Client) SendVideo(chatId interface{}, video string) *MessageResponse

SendVideo Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.

  • chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • video - Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data.

Available method can used with this method + SetDuration() + SetWidth() + SetHeight() + SetCaption() + SetDisableNotification() + SetReplyToMessageID() + SetForceReply() + SetInlineKeyboardMarkup() + SetReplyKeyboardMarkup() + SetReplyKeyboardRemove()

func (*Client) SendVideoNote

func (client *Client) SendVideoNote(chatId interface{}, videoNote string) *MessageResponse

SendVideoNote As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned.

  • chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • videoNote - Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. Sending video notes by a URL is currently unsupported

Available method can used with this method + SetDuration() + SetLength() + SetDisableNotification() + SetReplyToMessageID() + SetForceReply() + SetInlineKeyboardMarkup() + SetReplyKeyboardMarkup() + SetReplyKeyboardRemove()

func (*Client) SendVoice

func (client *Client) SendVoice(chatId interface{}, voice string) *MessageResponse

SendVoice Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.

  • chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • voice - Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data.

Available method can used with this method + SetCaption() + SetDuration() + SetDisableNotification() + SetReplyToMessageID() + SetForceReply() + SetInlineKeyboardMarkup() + SetReplyKeyboardMarkup() + SetReplyKeyboardRemove()

func (*Client) SetChatDescription

func (client *Client) SetChatDescription(chatId interface{}, description string) *VoidResponse

SetChatDescription Use this method to change the description of a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. + chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername) + description - New chat description, 0-255 characters

func (*Client) SetChatPhoto

func (client *Client) SetChatPhoto(chatId interface{}, photo string) *VoidResponse

SetChatPhoto Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is off in the target group. + chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername) + photo - New chat photo, uploaded using multipart/form-data

func (*Client) SetChatStickerSet

func (client *Client) SetChatStickerSet(chatId interface{}, name string) *VoidResponse

SetChatStickerSet Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success. + chatId - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) + name - Name of the sticker set to be set as the group sticker set

func (*Client) SetChatTitle

func (client *Client) SetChatTitle(chatId interface{}, title string) *VoidResponse

SetChatTitle Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is off in the target group. + chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername) + title - New chat title, 1-255 characters

func (*Client) SetStickerPositionInSet

func (client *Client) SetStickerPositionInSet(sticker string, position int) *VoidResponse

SetStickerPositionInSet Use this method to move a sticker in a set created by the bot to a specific position . Returns True on success. - sticker File identifier of the sticker - position New sticker position in the set, zero-based

+ sticker - File identifier of the sticker + position - New sticker position in the set, zero-based

func (*Client) SetWebHook

func (client *Client) SetWebHook(webHook string) *VoidResponse

SetWebHook Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns true. + webHook - HTTPS url to send updates to. Use an empty string to remove webhook integration

Available method can used with this method + SetCertificate() + SetMaxConnection() + SetAllowedUpdates()

func (*Client) StopMessageLiveLocation

func (client *Client) StopMessageLiveLocation() *VoidResponse

StopMessageLiveLocation Use this method to stop updating a live location message sent by the bot or via the bot (for inline bots) before live_period expires. On success, if the message was sent by the bot, the sent Message is returned, otherwise True is returned.

Available method can used with this method + SetChatID() + SetMessageID() + SetInlineMessageID() + SetReplyMarkup()

func (*Client) UnbanChatMember

func (client *Client) UnbanChatMember(chatId interface{}, userId int64) *VoidResponse

UnbanChatMember Use this method to unban a previously kicked user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. Returns True on success. + chatId - Unique identifier for the target group or username of the target supergroup or channel (in the format @username) + userId - Unique identifier of the target user

func (*Client) UnpinChatMessage

func (client *Client) UnpinChatMessage(chatId interface{}) *VoidResponse

UnpinChatMessage Use this method to unpin a message in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on success. + chatId - Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*Client) UploadStickerFile

func (client *Client) UploadStickerFile(userId int64, pngSticker string) *FileResponse

UploadStickerFile Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). Returns the uploaded File on success. + userId - User identifier of sticker file owner + pngSticker - Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px.

type Contact

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

Contact This object represents a phone contact.

type Document

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

Document This object represents a general file (as opposed to photos, voice messages and audio files).

type ErrorResponse

type ErrorResponse struct {
	OK          bool   `json:"ok"`
	ErrorCode   int    `json:"error_code,omitempty"`
	Description string `json:"description,omitempty"`
}

ErrorResponse struct parse error response from telegram

type File

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

File This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile. Maximum file size to download is 20 MB

type FileResponse

type FileResponse struct {
	Client  *Client
	Request *gorequest.SuperAgent
}

FileResponse struct to handle request and response telegram api

func (*FileResponse) Commit

func (user *FileResponse) Commit() (*File, *http.Response, error)

Commit execute request to telegram

type ForceReply

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

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 Game

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

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

type InlineKeyboardButton

type InlineKeyboardButton struct {
	Text                         string        `json:"text"`
	URL                          string        `json:"url,omitempty"`
	CallbackData                 string        `json:"callback_data,omitempty"`
	SwitchInlineQuery            string        `json:"switch_inline_query,omitempty"`
	SwitchInlineQueryCurrentChat string        `json:"switch_inline_query_current_chat,omitempty"`
	CallbackGame                 *CallbackGame `json:"callback_game,omitempty"`
	Pay                          bool          `json:"pay,omitempty"`
}

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

type InlineQuery

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

InlineQuery This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.

type InputMedia

type InputMedia struct {
	Type     MediaType `json:"type"`
	Media    string    `json:"media"`
	Caption  string    `json:"caption,omitempty"`
	Width    int       `json:"width,omitempty"`
	Height   int       `json:"height,omitempty"`
	Duration int       `json:"duration,omitempty"`
}

InputMedia This object represents the content of a media message to be sent. It should be one of InputMediaPhoto InputMediaVideo See documentation for details https://core.telegram.org/bots/api#inputmedia

type IntegerResponse

type IntegerResponse struct {
	Client  *Client
	Request *gorequest.SuperAgent
}

IntegerResponse struct to handle request and response telegram api

func (*IntegerResponse) Commit

func (void *IntegerResponse) Commit() (*int64, *http.Response, error)

Commit execute request to telegram

type Invoice

type Invoice struct {
	Title          string `json:"title"`
	Description    string `json:"description"`
	StartParameter string `json:"start_parameter"`
	Currency       string `json:"currency"`
	TotalAmount    int64  `json:"total_amount"`
}

Invoice This object contains basic information about an invoice.

type JSON

type JSON map[string]interface{}

JSON struct json type

type KeyboardButton

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

KeyboardButton This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields are mutually exclusive.

type Location

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

Location This object represents a point on the map.

type MaskPosition

type MaskPosition struct {
	Point  string  `json:"point"`
	XShift float64 `json:"x_shift"`
	YShift float64 `json:"y_shift"`
	Scale  float64 `json:"scale"`
}

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

type MediaType

type MediaType string

type Message

type Message struct {
	MessageID             int64              `json:"message_id"`
	From                  *User              `json:"from,omitempty"`
	Date                  int64              `json:"date"`
	Chat                  Chat               `json:"chat"`
	ForwardFrom           *User              `json:"forward_from,omitempty"`
	ForwardFromChat       *Chat              `json:"forward_from_chat,omitempty"`
	ForwardFromMessageID  int64              `json:"forward_from_message_id,omitempty"`
	ForwardSignature      string             `json:"forward_signature,omitempty"`
	ForwardDate           int64              `json:"forward_date,omitempty"`
	ReplyToMessage        string             `json:"reply_to_message,omitempty"`
	EditDate              int64              `json:"edit_date,omitempty"`
	AuthorSignature       string             `json:"author_signature,omitempty"`
	Text                  string             `json:"text,omitempty"`
	Entities              []MessageEntity    `json:"entities,omitempty"`
	CaptionEntities       []MessageEntity    `json:"caption_entities,omitempty"`
	Audio                 *Audio             `json:"audio,omitempty"`
	Document              *Document          `json:"document,omitempty"`
	Game                  *Game              `json:"game,omitempty"`
	Photos                []PhotoSize        `json:"photo,omitempty"`
	Sticker               *Sticker           `json:"sticker,omitempty"`
	Video                 *Video             `json:"video,omitempty"`
	Voice                 *Voice             `json:"voice,omitempty"`
	VideoNote             *VideoNote         `json:"video_note,omitempty"`
	Caption               string             `json:"caption,omitempty"`
	Contact               *Contact           `json:"contact,omitempty"`
	Location              *Location          `json:"location,omitempty"`
	Venue                 *Venue             `json:"venue,omitempty"`
	NewChatMembers        []User             `json:"new_chat_members,omitempty"`
	LeftChatMember        *User              `json:"left_chat_member,omitempty"`
	NewChatTitle          string             `json:"new_chat_title,omitempty"`
	NewChatPhoto          []PhotoSize        `json:"new_chat_photo,omitempty"`
	DeleteChatPhoto       bool               `json:"delete_chat_photo,omitempty"`
	GroupChatCreated      bool               `json:"group_chat_created,omitempty"`
	SuperGroupChatCreated bool               `json:"supergroup_chat_created,omitempty"`
	ChannelChatCreated    bool               `json:"channel_chat_created,omitempty"`
	MigrateToChatID       int64              `json:"migrate_to_chat_id,omitempty"`
	MigrateFromChatID     int64              `json:"migrate_from_chat_id,omitempty"`
	PinnedMessage         *Message           `json:"pinned_message,omitempty"`
	Invoice               *Invoice           `json:"invoice,omitempty"`
	SuccessfulPayment     *SuccessfulPayment `json:"successful_payment,omitempty"`
}

Message This object represents a message.

type MessageEntity

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

MessageEntity This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.

type MessageResponse

type MessageResponse struct {
	Client  *Client
	Request *gorequest.SuperAgent
}

MessageResponse struct to handle request and response telegram api

func (*MessageResponse) Commit

func (message *MessageResponse) Commit() (*Message, *http.Response, error)

Commit execute request to telegram

func (*MessageResponse) SetCaption

func (message *MessageResponse) SetCaption(caption string) *MessageResponse

SetCaption Photo caption (may also be used when resending photos by file_id), 0-200 characters

func (*MessageResponse) SetDisableNotification

func (message *MessageResponse) SetDisableNotification(disable bool) *MessageResponse

SetDisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*MessageResponse) SetDisableWebPagePreview

func (message *MessageResponse) SetDisableWebPagePreview(disable bool) *MessageResponse

SetDisableWebPagePreview Disables link previews for links in this message

func (*MessageResponse) SetDuration

func (message *MessageResponse) SetDuration(duration int) *MessageResponse

SetDuration Duration of the audio in seconds

func (*MessageResponse) SetForceReply

func (message *MessageResponse) SetForceReply(reply ForceReply) *MessageResponse

SetForceReply Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.

func (*MessageResponse) SetFoursquareID

func (message *MessageResponse) SetFoursquareID(id string) *MessageResponse

SetFoursquareID Foursquare identifier of the venue

func (*MessageResponse) SetHeight

func (message *MessageResponse) SetHeight(height int) *MessageResponse

SetHeight Video height

func (*MessageResponse) SetInlineKeyboardMarkup

func (message *MessageResponse) SetInlineKeyboardMarkup(inline [][]InlineKeyboardButton) *MessageResponse

SetInlineKeyboardMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.

func (*MessageResponse) SetLastName

func (message *MessageResponse) SetLastName(lastName string) *MessageResponse

SetLastName Contact's last name

func (*MessageResponse) SetLength

func (message *MessageResponse) SetLength(length int) *MessageResponse

SetLength Video width and height

func (*MessageResponse) SetLivePeriod

func (message *MessageResponse) SetLivePeriod(livePeriod int) *MessageResponse

SetLivePeriod Period in seconds for which the location will be updated (see Live Locations, should be between 60 and 86400.

func (*MessageResponse) SetParseMode

func (message *MessageResponse) SetParseMode(mode string) *MessageResponse

SetParseMode Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.

func (*MessageResponse) SetPerformer

func (message *MessageResponse) SetPerformer(performer string) *MessageResponse

SetPerformer Performer

func (*MessageResponse) SetReplyKeyboardMarkup

func (message *MessageResponse) SetReplyKeyboardMarkup(reply ReplyKeyboardMarkup) *MessageResponse

SetReplyKeyboardMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.

func (*MessageResponse) SetReplyKeyboardRemove

func (message *MessageResponse) SetReplyKeyboardRemove(remove ReplyKeyboardRemove) *MessageResponse

SetReplyKeyboardRemove Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.

func (*MessageResponse) SetReplyToMessageID

func (message *MessageResponse) SetReplyToMessageID(id int64) *MessageResponse

SetReplyToMessageID If the message is a reply, ID of the original message

func (*MessageResponse) SetTitle

func (message *MessageResponse) SetTitle(title string) *MessageResponse

SetTitle Track name

func (*MessageResponse) SetWidth

func (message *MessageResponse) SetWidth(width int) *MessageResponse

SetWidth Video width

type OrderInfo

type OrderInfo struct {
	Name            string           `json:"name,omitempty"`
	PhoneNumber     string           `json:"phone_number,omitempty"`
	Email           string           `json:"email,omitempty"`
	ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
}

OrderInfo This object represents information about an order.

type PhotoSize

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

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

type PreCheckoutQuery

type PreCheckoutQuery struct {
	ID               string `json:"id"`
	From             User   `json:"from"`
	Currency         string `json:"currency"`
	TotalAmount      int64  `json:"total_amount"`
	InvoicePayload   string `json:"invoice_payload"`
	ShippingOptionID string `json:"shipping_option_id,omitempty"`
	OrderInfo        string `json:"order_info,omitempty"`
}

PreCheckoutQuery This object contains information about an incoming pre-checkout query.

type ReplyKeyboardMarkup

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

ReplyKeyboardMarkup This object represents a custom keyboard with reply options (see Introduction to bots for details and examples).

type ReplyKeyboardRemove

type ReplyKeyboardRemove struct {
	RemoveKeyboard bool `json:"remove_keyboard"`
	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 (see ReplyKeyboardMarkup).

type ShippingAddress

type ShippingAddress struct {
	CountryCode string `json:"country_code"`
	State       string `json:"state"`
	City        string `json:"city"`
	StreetLine1 string `json:"street_line1"`
	StreetLine2 string `json:"street_line2"`
	PostCode    string `json:"post_code"`
}

ShippingAddress This object represents a shipping address.

type ShippingQuery

type ShippingQuery struct {
	ID              string          `json:"id"`
	From            User            `json:"from"`
	InvoicePayload  string          `json:"invoice_payload"`
	ShippingAddress ShippingAddress `json:"shipping_address"`
}

ShippingQuery This object contains information about an incoming shipping query.

type StatusType

type StatusType string

type Sticker

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

Sticker This object represents a sticker.

type StickerSet

type StickerSet struct {
	Name          string    `json:"name"`
	Title         string    `json:"title"`
	ContainsMasks bool      `json:"contains_masks"`
	Stickers      []Sticker `json:"stickers"`
}

StickerSet This object represents a sticker set.

type StickerSetResponse

type StickerSetResponse struct {
	Client  *Client
	Request *gorequest.SuperAgent
}

StickerSetResponse struct to handle request and response telegram api

func (*StickerSetResponse) Commit

func (sticker *StickerSetResponse) Commit() (*StickerSet, *http.Response, error)

Commit execute request to telegram

type StringResponse

type StringResponse struct {
	Client  *Client
	Request *gorequest.SuperAgent
}

StringResponse struct to handle request and response telegram api

func (*StringResponse) Commit

func (void *StringResponse) Commit() (string, *http.Response, error)

Commit execute request to telegram

type SuccessfulPayment

type SuccessfulPayment struct {
	Currency                string     `json:"currency"`
	TotalAmount             int64      `json:"total_amount"`
	InvoicePayload          string     `json:"invoice_payload"`
	ShippingOptionID        string     `json:"shipping_option_id,omitempty"`
	OrderInfo               *OrderInfo `json:"order_info,omitempty"`
	TelegramPaymentChargeID string     `json:"telegram_payment_charge_id"`
	ProviderPaymentChargeID string     `json:"provider_payment_charge_id"`
}

SuccessfulPayment This object contains basic information about a successful payment.

type Update

type Update struct {
	UpdateID           int64               `json:"update_id"`
	Message            *Message            `json:"message,omitempty"`
	EditedMessage      *Message            `json:"edited_message,omitempty"`
	ChannelPost        *Message            `json:"channel_post,omitempty"`
	EditedChannelPost  *Message            `json:"edited_channel_post,omitempty"`
	InlineQuery        *InlineQuery        `json:"inline_query,omitempty"`
	ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"`
	CallbackQuery      *CallbackQuery      `json:"callback_query,omitempty"`
	ShippingQuery      *ShippingQuery      `json:"shipping_query,omitempty"`
	PreCheckoutQuery   *PreCheckoutQuery   `json:"pre_checkout_query,omitempty"`
}

Update This object represents an incoming update. At most one of the optional parameters can be present in any given update.

func WebHookParseRequest

func WebHookParseRequest(r []byte) (*Update, error)

WebHookParseRequest function for parse request from telegram web hook, return struct Update if success

type User

type User struct {
	ID           int64  `json:"id"`
	IsBot        bool   `json:"is_bot"`
	FirstName    string `json:"first_name"`
	LastName     string `json:"last_name,omitempty"`
	Username     string `json:"username,omitempty"`
	LanguageCode string `json:"language_code,omitempty"`
}

User This object represents a Telegram user or bot.

type UserProfilePhotos

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

UserProfilePhotos This object represent a user's profile pictures.

type UserProfilePhotosResponse

type UserProfilePhotosResponse struct {
	Client  *Client
	Request *gorequest.SuperAgent
}

UserProfilePhotosResponse struct to handle request and response telegram api

func (*UserProfilePhotosResponse) Commit

Commit execute request to telegram

func (*UserProfilePhotosResponse) SetLimit

SetLimit Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100.

func (*UserProfilePhotosResponse) SetOffset

func (user *UserProfilePhotosResponse) SetOffset(offset int) *UserProfilePhotosResponse

SetOffset Sequential number of the first photo to be returned. By default, all photos are returned.

type UserResponse

type UserResponse struct {
	Client  *Client
	Request *gorequest.SuperAgent
}

UserResponse struct to handle request and response telegram api

func (*UserResponse) Commit

func (user *UserResponse) Commit() (*User, *http.Response, error)

Commit execute request to telegram

type Venue

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

Venue This object represents a venue.

type Video

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

Video This object represents a sticker.

type VideoNote

type VideoNote struct {
	FileID   string     `json:"file_id"`
	Length   int        `json:"length"`
	Duration int        `json:"duration"`
	Thumb    *PhotoSize `json:"thumb,omitempty"`
	FileSize int        `json:"file_size,omitempty"`
}

VideoNote This object represents a video message (available in Telegram apps as of v.4.0).

type Voice

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

Voice This object represents a voice note.

type VoidResponse

type VoidResponse struct {
	Client  *Client
	Request *gorequest.SuperAgent
}

VoidResponse struct to handle request and response telegram api

func (*VoidResponse) Commit

func (void *VoidResponse) Commit() ([]byte, *http.Response, error)

Commit execute request to telegram

func (*VoidResponse) SetAllowedUpdates

func (void *VoidResponse) SetAllowedUpdates(allowed ...string) *VoidResponse

SetAllowedUpdates List the types of updates you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used.

func (*VoidResponse) SetCacheTime

func (void *VoidResponse) SetCacheTime(time int64) *VoidResponse

SetCacheTime The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0.

The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.

func (*VoidResponse) SetCanAddWebPagePreview

func (void *VoidResponse) SetCanAddWebPagePreview(can bool) *VoidResponse

SetCanAddWebPagePreview Pass True, if the user may add web page previews to their messages, implies can_send_media_messages

func (*VoidResponse) SetCanChangeInfo

func (void *VoidResponse) SetCanChangeInfo(can bool) *VoidResponse

SetCanChangeInfo Pass True, if the administrator can change chat title, photo and other settings

func (*VoidResponse) SetCanDeleteMessage

func (void *VoidResponse) SetCanDeleteMessage(can bool) *VoidResponse

SetCanDeleteMessage Pass True, if the administrator can delete messages of other users

func (*VoidResponse) SetCanEditMessage

func (void *VoidResponse) SetCanEditMessage(can bool) *VoidResponse

SetCanEditMessage Pass True, if the administrator can edit messages of other users and can pin messages, channels only

func (*VoidResponse) SetCanInviteUser

func (void *VoidResponse) SetCanInviteUser(can bool) *VoidResponse

SetCanInviteUser Pass True, if the administrator can invite new users to the chat

func (*VoidResponse) SetCanPinMessage

func (void *VoidResponse) SetCanPinMessage(can bool) *VoidResponse

SetCanPinMessage Pass True, if the administrator can pin messages, supergroups only

func (*VoidResponse) SetCanPostMessage

func (void *VoidResponse) SetCanPostMessage(can bool) *VoidResponse

SetCanPostMessage Pass True, if the administrator can create channel posts, channels only

func (*VoidResponse) SetCanPromoteMember

func (void *VoidResponse) SetCanPromoteMember(can bool) *VoidResponse

SetCanPromoteMember Pass True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him)

func (*VoidResponse) SetCanRestrictMember

func (void *VoidResponse) SetCanRestrictMember(can bool) *VoidResponse

SetCanRestrictMember Pass True, if the administrator can restrict, ban or unban chat members

func (*VoidResponse) SetCanSendMediaMessage

func (void *VoidResponse) SetCanSendMediaMessage(can bool) *VoidResponse

SetCanSendMediaMessage Pass True, if the user can send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages

func (*VoidResponse) SetCanSendMessage

func (void *VoidResponse) SetCanSendMessage(can bool) *VoidResponse

SetCanSendMessage Pass True, if the user can send text messages, contacts, locations and venues

func (*VoidResponse) SetCanSendOtherMessage

func (void *VoidResponse) SetCanSendOtherMessage(can bool) *VoidResponse

SetCanSendOtherMessage Pass True, if the user can send animations, games, stickers and use inline bots, implies can_send_media_messages

func (*VoidResponse) SetCertificate

func (void *VoidResponse) SetCertificate(path string) *VoidResponse

SetCertificate Upload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details.

func (*VoidResponse) SetChatID

func (void *VoidResponse) SetChatID(chatId interface{}) *VoidResponse

SetChatID Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*VoidResponse) SetContainsMask

func (void *VoidResponse) SetContainsMask(mask bool) *VoidResponse

SetContainsMask Pass True, if a set of mask stickers should be created

func (*VoidResponse) SetDisableNotification

func (void *VoidResponse) SetDisableNotification(disable bool) *VoidResponse

SetDisableNotification Pass True, if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels.

func (*VoidResponse) SetDisableWebPagePreview

func (void *VoidResponse) SetDisableWebPagePreview(disable bool) *VoidResponse

SetDisableWebPagePreview Disables link previews for links in this message

func (*VoidResponse) SetInlineMessageID

func (void *VoidResponse) SetInlineMessageID(inlineMessage string) *VoidResponse

SetInlineMessageID Required if chat_id and message_id are not specified. Identifier of the inline message

func (*VoidResponse) SetIsPersonal

func (void *VoidResponse) SetIsPersonal(personal bool) *VoidResponse

SetIsPersonal Pass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query

func (*VoidResponse) SetMaskPosition

func (void *VoidResponse) SetMaskPosition(mask MaskPosition) *VoidResponse

SetMaskPosition A JSON-serialized object for position where the mask should be placed on faces

func (*VoidResponse) SetMaxConnection

func (void *VoidResponse) SetMaxConnection(conn int) *VoidResponse

SetMaxConnection Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot‘s server, and higher values to increase your bot’s throughput.

func (*VoidResponse) SetMessageID

func (void *VoidResponse) SetMessageID(messageId int) *VoidResponse

SetMessageID Required if inline_message_id is not specified. Identifier of the sent message

func (*VoidResponse) SetNextOffset

func (void *VoidResponse) SetNextOffset(offset string) *VoidResponse

SetNextOffset Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can’t exceed 64 bytes.

func (*VoidResponse) SetParseMode

func (void *VoidResponse) SetParseMode(mode string) *VoidResponse

SetParseMode Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.

func (*VoidResponse) SetReplyMarkup

func (void *VoidResponse) SetReplyMarkup(inline [][]InlineKeyboardButton) *VoidResponse

SetReplyMarkup A JSON-serialized object for a new inline keyboard.

func (*VoidResponse) SetShowAlert

func (void *VoidResponse) SetShowAlert(show bool) *VoidResponse

SetShowAlert If true, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false.

func (*VoidResponse) SetSwitchPMParameter

func (void *VoidResponse) SetSwitchPMParameter(param string) *VoidResponse

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

func (*VoidResponse) SetSwitchPMText

func (void *VoidResponse) SetSwitchPMText(text string) *VoidResponse

SetSwitchPMText If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter

func (*VoidResponse) SetText

func (void *VoidResponse) SetText(text string) *VoidResponse

SetText Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters

func (*VoidResponse) SetURL

func (void *VoidResponse) SetURL(url string) *VoidResponse

SetURL URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @Botfather, specify the URL that opens your game – note that this will only work if the query comes from a callback_game button.

func (*VoidResponse) SetUntilDate

func (void *VoidResponse) SetUntilDate(date int64) *VoidResponse

SetUntilDate Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever

type WebHookInfoResponse

type WebHookInfoResponse struct {
	Client  *Client
	Request *gorequest.SuperAgent
}

WebHookInfoResponse struct to handle request and response telegram api

func (*WebHookInfoResponse) Commit

func (info *WebHookInfoResponse) Commit() (*WebhookInfo, *http.Response, error)

Commit execute request to telegram

type WebhookInfo

type WebhookInfo struct {
	URL                  string   `json:"url"`
	HasCustomCertificate bool     `json:"has_custom_certificate"`
	PendingUpdateCount   int      `json:"pending_update_count"`
	LastErrorDate        int64    `json:"last_error_date,omitempty"`
	LastErrorMessage     string   `json:"last_error_message,omitempty"`
	MaxConnections       int      `json:"max_connections,omitempty"`
	AllowedUpdates       []string `json:"allowed_updates,omitempty"`
}

WebhookInfo Contains information about the current status of a webhook.

Jump to

Keyboard shortcuts

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