summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-09-11 23:11:48 +0200
committerWim <wim@42.be>2017-09-11 23:11:48 +0200
commit035297005115c65fd99b1960bd40af881964a5c3 (patch)
tree9e11a48fe96068d163e26f6c5120f040f8f863f1
parented018207226912ee57ecaae06c539aea37e7bb96 (diff)
downloadmatterbridge-msglm-035297005115c65fd99b1960bd40af881964a5c3.tar.gz
matterbridge-msglm-035297005115c65fd99b1960bd40af881964a5c3.tar.bz2
matterbridge-msglm-035297005115c65fd99b1960bd40af881964a5c3.zip
Update vendor (go-telegram-bot-api/telegram-bot-api)
-rw-r--r--vendor/github.com/go-telegram-bot-api/telegram-bot-api/bot.go197
-rw-r--r--vendor/github.com/go-telegram-bot-api/telegram-bot-api/configs.go243
-rw-r--r--vendor/github.com/go-telegram-bot-api/telegram-bot-api/helpers.go44
-rw-r--r--vendor/github.com/go-telegram-bot-api/telegram-bot-api/types.go205
-rw-r--r--vendor/manifest2
5 files changed, 629 insertions, 62 deletions
diff --git a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/bot.go b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/bot.go
index c2b4529b..2d95f9e9 100644
--- a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/bot.go
+++ b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/bot.go
@@ -191,7 +191,11 @@ func (bot *BotAPI) UploadFile(endpoint string, params map[string]string, fieldna
}
var apiResp APIResponse
- json.Unmarshal(bytes, &apiResp)
+
+ err = json.Unmarshal(bytes, &apiResp)
+ if err != nil {
+ return APIResponse{}, err
+ }
if !apiResp.Ok {
return APIResponse{}, errors.New(apiResp.Description)
@@ -438,14 +442,7 @@ func (bot *BotAPI) SetWebhook(config WebhookConfig) (APIResponse, error) {
return APIResponse{}, err
}
- var apiResp APIResponse
- json.Unmarshal(resp.Result, &apiResp)
-
- if bot.Debug {
- log.Printf("setWebhook resp: %+v\n", apiResp)
- }
-
- return apiResp, nil
+ return resp, nil
}
// GetWebhookInfo allows you to fetch information about a webhook and if
@@ -550,7 +547,7 @@ func (bot *BotAPI) AnswerCallbackQuery(config CallbackConfig) (APIResponse, erro
// KickChatMember kicks a user from a chat. Note that this only will work
// in supergroups, and requires the bot to be an admin. Also note they
// will be unable to rejoin until they are unbanned.
-func (bot *BotAPI) KickChatMember(config ChatMemberConfig) (APIResponse, error) {
+func (bot *BotAPI) KickChatMember(config KickChatMemberConfig) (APIResponse, error) {
v := url.Values{}
if config.SuperGroupUsername == "" {
@@ -560,6 +557,10 @@ func (bot *BotAPI) KickChatMember(config ChatMemberConfig) (APIResponse, error)
}
v.Add("user_id", strconv.Itoa(config.UserID))
+ if config.UntilDate != 0 {
+ v.Add("until_date", strconv.FormatInt(config.UntilDate, 10))
+ }
+
bot.debugLog("kickChatMember", v, nil)
return bot.MakeRequest("kickChatMember", v)
@@ -677,14 +678,16 @@ func (bot *BotAPI) GetChatMember(config ChatConfigWithUser) (ChatMember, error)
}
// UnbanChatMember unbans a user from a chat. Note that this only will work
-// in supergroups, and requires the bot to be an admin.
+// in supergroups and channels, and requires the bot to be an admin.
func (bot *BotAPI) UnbanChatMember(config ChatMemberConfig) (APIResponse, error) {
v := url.Values{}
- if config.SuperGroupUsername == "" {
- v.Add("chat_id", strconv.FormatInt(config.ChatID, 10))
- } else {
+ if config.SuperGroupUsername != "" {
v.Add("chat_id", config.SuperGroupUsername)
+ } else if config.ChannelUsername != "" {
+ v.Add("chat_id", config.ChannelUsername)
+ } else {
+ v.Add("chat_id", strconv.FormatInt(config.ChatID, 10))
}
v.Add("user_id", strconv.Itoa(config.UserID))
@@ -693,6 +696,82 @@ func (bot *BotAPI) UnbanChatMember(config ChatMemberConfig) (APIResponse, error)
return bot.MakeRequest("unbanChatMember", v)
}
+// RestrictChatMember 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.
+func (bot *BotAPI) RestrictChatMember(config RestrictChatMemberConfig) (APIResponse, error) {
+ v := url.Values{}
+
+ if config.SuperGroupUsername != "" {
+ v.Add("chat_id", config.SuperGroupUsername)
+ } else if config.ChannelUsername != "" {
+ v.Add("chat_id", config.ChannelUsername)
+ } else {
+ v.Add("chat_id", strconv.FormatInt(config.ChatID, 10))
+ }
+ v.Add("user_id", strconv.Itoa(config.UserID))
+
+ if &config.CanSendMessages != nil {
+ v.Add("can_send_messages", strconv.FormatBool(*config.CanSendMessages))
+ }
+ if &config.CanSendMediaMessages != nil {
+ v.Add("can_send_media_messages", strconv.FormatBool(*config.CanSendMediaMessages))
+ }
+ if &config.CanSendOtherMessages != nil {
+ v.Add("can_send_other_messages", strconv.FormatBool(*config.CanSendOtherMessages))
+ }
+ if &config.CanAddWebPagePreviews != nil {
+ v.Add("can_add_web_page_previews", strconv.FormatBool(*config.CanAddWebPagePreviews))
+ }
+
+ bot.debugLog("restrictChatMember", v, nil)
+
+ return bot.MakeRequest("restrictChatMember", v)
+}
+
+func (bot *BotAPI) PromoteChatMember(config PromoteChatMemberConfig) (APIResponse, error) {
+ v := url.Values{}
+
+ if config.SuperGroupUsername != "" {
+ v.Add("chat_id", config.SuperGroupUsername)
+ } else if config.ChannelUsername != "" {
+ v.Add("chat_id", config.ChannelUsername)
+ } else {
+ v.Add("chat_id", strconv.FormatInt(config.ChatID, 10))
+ }
+ v.Add("user_id", strconv.Itoa(config.UserID))
+
+ if &config.CanChangeInfo != nil {
+ v.Add("can_change_info", strconv.FormatBool(*config.CanChangeInfo))
+ }
+ if &config.CanPostMessages != nil {
+ v.Add("can_post_messages", strconv.FormatBool(*config.CanPostMessages))
+ }
+ if &config.CanEditMessages != nil {
+ v.Add("can_edit_messages", strconv.FormatBool(*config.CanEditMessages))
+ }
+ if &config.CanDeleteMessages != nil {
+ v.Add("can_delete_messages", strconv.FormatBool(*config.CanDeleteMessages))
+ }
+ if &config.CanInviteUsers != nil {
+ v.Add("can_invite_users", strconv.FormatBool(*config.CanInviteUsers))
+ }
+ if &config.CanRestrictMembers != nil {
+ v.Add("can_restrict_members", strconv.FormatBool(*config.CanRestrictMembers))
+ }
+ if &config.CanPinMessages != nil {
+ v.Add("can_pin_messages", strconv.FormatBool(*config.CanPinMessages))
+ }
+ if &config.CanPromoteMembers != nil {
+ v.Add("can_promote_members", strconv.FormatBool(*config.CanPromoteMembers))
+ }
+
+ bot.debugLog("promoteChatMember", v, nil)
+
+ return bot.MakeRequest("promoteChatMember", v)
+}
+
// GetGameHighScores allows you to get the high scores for a game.
func (bot *BotAPI) GetGameHighScores(config GetGameHighScoresConfig) ([]GameHighScore, error) {
v, _ := config.values()
@@ -707,3 +786,93 @@ func (bot *BotAPI) GetGameHighScores(config GetGameHighScoresConfig) ([]GameHigh
return highScores, err
}
+
+// AnswerShippingQuery allows you to reply to Update with shipping_query parameter.
+func (bot *BotAPI) AnswerShippingQuery(config ShippingConfig) (APIResponse, error) {
+ v := url.Values{}
+
+ v.Add("shipping_query_id", config.ShippingQueryID)
+ v.Add("ok", strconv.FormatBool(config.OK))
+ if config.OK == true {
+ data, err := json.Marshal(config.ShippingOptions)
+ if err != nil {
+ return APIResponse{}, err
+ }
+ v.Add("shipping_options", string(data))
+ } else {
+ v.Add("error_message", config.ErrorMessage)
+ }
+
+ bot.debugLog("answerShippingQuery", v, nil)
+
+ return bot.MakeRequest("answerShippingQuery", v)
+}
+
+// AnswerPreCheckoutQuery allows you to reply to Update with pre_checkout_query.
+func (bot *BotAPI) AnswerPreCheckoutQuery(config PreCheckoutConfig) (APIResponse, error) {
+ v := url.Values{}
+
+ v.Add("pre_checkout_query_id", config.PreCheckoutQueryID)
+ v.Add("ok", strconv.FormatBool(config.OK))
+ if config.OK != true {
+ v.Add("error", config.ErrorMessage)
+ }
+
+ bot.debugLog("answerPreCheckoutQuery", v, nil)
+
+ return bot.MakeRequest("answerPreCheckoutQuery", v)
+}
+
+// DeleteMessage deletes a message in a chat
+func (bot *BotAPI) DeleteMessage(config DeleteMessageConfig) (APIResponse, error) {
+ v, err := config.values()
+ if err != nil {
+ return APIResponse{}, err
+ }
+
+ bot.debugLog(config.method(), v, nil)
+
+ return bot.MakeRequest(config.method(), v)
+}
+
+// GetInviteLink get InviteLink for a chat
+func (bot *BotAPI) GetInviteLink(config ChatConfig) (string, error) {
+ v := url.Values{}
+
+ if config.SuperGroupUsername == "" {
+ v.Add("chat_id", strconv.FormatInt(config.ChatID, 10))
+ } else {
+ v.Add("chat_id", config.SuperGroupUsername)
+ }
+
+ resp, err := bot.MakeRequest("exportChatInviteLink", v)
+
+ var inviteLink string
+ err = json.Unmarshal(resp.Result, &inviteLink)
+
+ return inviteLink, err
+}
+
+// Pin message in supergroup
+func (bot *BotAPI) PinChatMessage(config PinChatMessageConfig) (APIResponse, error) {
+ v, err := config.values()
+ if err != nil {
+ return APIResponse{}, err
+ }
+
+ bot.debugLog(config.method(), v, nil)
+
+ return bot.MakeRequest(config.method(), v)
+}
+
+// Unpin message in supergroup
+func (bot *BotAPI) UnpinChatMessage(config UnpinChatMessageConfig) (APIResponse, error) {
+ v, err := config.values()
+ if err != nil {
+ return APIResponse{}, err
+ }
+
+ bot.debugLog(config.method(), v, nil)
+
+ return bot.MakeRequest(config.method(), v)
+} \ No newline at end of file
diff --git a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/configs.go b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/configs.go
index 5352933e..c0293ce2 100644
--- a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/configs.go
+++ b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/configs.go
@@ -349,6 +349,7 @@ func (config AudioConfig) method() string {
// DocumentConfig contains information about a SendDocument request.
type DocumentConfig struct {
BaseFile
+ Caption string
}
// values returns a url.Values representation of DocumentConfig.
@@ -359,6 +360,9 @@ func (config DocumentConfig) values() (url.Values, error) {
}
v.Add(config.name(), config.FileID)
+ if config.Caption != "" {
+ v.Add("caption", config.Caption)
+ }
return v, nil
}
@@ -367,6 +371,10 @@ func (config DocumentConfig) values() (url.Values, error) {
func (config DocumentConfig) params() (map[string]string, error) {
params, _ := config.BaseFile.params()
+ if config.Caption != "" {
+ params["caption"] = config.Caption
+ }
+
return params, nil
}
@@ -443,6 +451,10 @@ func (config VideoConfig) values() (url.Values, error) {
func (config VideoConfig) params() (map[string]string, error) {
params, _ := config.BaseFile.params()
+ if config.Caption != "" {
+ params["caption"] = config.Caption
+ }
+
return params, nil
}
@@ -456,6 +468,57 @@ func (config VideoConfig) method() string {
return "sendVideo"
}
+// VideoNoteConfig contains information about a SendVideoNote request.
+type VideoNoteConfig struct {
+ BaseFile
+ Duration int
+ Length int
+}
+
+// values returns a url.Values representation of VideoNoteConfig.
+func (config VideoNoteConfig) values() (url.Values, error) {
+ v, err := config.BaseChat.values()
+ if err != nil {
+ return v, err
+ }
+
+ v.Add(config.name(), config.FileID)
+ if config.Duration != 0 {
+ v.Add("duration", strconv.Itoa(config.Duration))
+ }
+
+ // Telegram API seems to have a bug, if no length is provided or it is 0, it will send an error response
+ if config.Length != 0 {
+ v.Add("length", strconv.Itoa(config.Length))
+ }
+
+ return v, nil
+}
+
+// params returns a map[string]string representation of VideoNoteConfig.
+func (config VideoNoteConfig) params() (map[string]string, error) {
+ params, _ := config.BaseFile.params()
+
+ if config.Length != 0 {
+ params["length"] = strconv.Itoa(config.Length)
+ }
+ if config.Duration != 0 {
+ params["duration"] = strconv.Itoa(config.Duration)
+ }
+
+ return params, nil
+}
+
+// name returns the field name for the VideoNote.
+func (config VideoNoteConfig) name() string {
+ return "video_note"
+}
+
+// method returns Telegram API method name for sending VideoNote.
+func (config VideoNoteConfig) method() string {
+ return "sendVideoNote"
+}
+
// VoiceConfig contains information about a SendVoice request.
type VoiceConfig struct {
BaseFile
@@ -474,6 +537,9 @@ func (config VoiceConfig) values() (url.Values, error) {
if config.Duration != 0 {
v.Add("duration", strconv.Itoa(config.Duration))
}
+ if config.Caption != "" {
+ v.Add("caption", config.Caption)
+ }
return v, nil
}
@@ -485,6 +551,9 @@ func (config VoiceConfig) params() (map[string]string, error) {
if config.Duration != 0 {
params["duration"] = strconv.Itoa(config.Duration)
}
+ if config.Caption != "" {
+ params["caption"] = config.Caption
+ }
return params, nil
}
@@ -814,9 +883,39 @@ type CallbackConfig struct {
type ChatMemberConfig struct {
ChatID int64
SuperGroupUsername string
+ ChannelUsername string
UserID int
}
+// KickChatMemberConfig contains extra fields to kick user
+type KickChatMemberConfig struct {
+ ChatMemberConfig
+ UntilDate int64
+}
+
+// RestrictChatMemberConfig contains fields to restrict members of chat
+type RestrictChatMemberConfig struct {
+ ChatMemberConfig
+ UntilDate int64
+ CanSendMessages *bool
+ CanSendMediaMessages *bool
+ CanSendOtherMessages *bool
+ CanAddWebPagePreviews *bool
+}
+
+// PromoteChatMemberConfig contains fields to promote members of chat
+type PromoteChatMemberConfig struct {
+ ChatMemberConfig
+ CanChangeInfo *bool
+ CanPostMessages *bool
+ CanEditMessages *bool
+ CanDeleteMessages *bool
+ CanInviteUsers *bool
+ CanRestrictMembers *bool
+ CanPinMessages *bool
+ CanPromoteMembers *bool
+}
+
// ChatConfig contains information about getting information on a chat.
type ChatConfig struct {
ChatID int64
@@ -830,3 +929,147 @@ type ChatConfigWithUser struct {
SuperGroupUsername string
UserID int
}
+
+// InvoiceConfig contains information for sendInvoice request.
+type InvoiceConfig struct {
+ BaseChat
+ Title string // required
+ Description string // required
+ Payload string // required
+ ProviderToken string // required
+ StartParameter string // required
+ Currency string // required
+ Prices *[]LabeledPrice // required
+ PhotoURL string
+ PhotoSize int
+ PhotoWidth int
+ PhotoHeight int
+ NeedName bool
+ NeedPhoneNumber bool
+ NeedEmail bool
+ NeedShippingAddress bool
+ IsFlexible bool
+}
+
+func (config InvoiceConfig) values() (url.Values, error) {
+ v, err := config.BaseChat.values()
+ if err != nil {
+ return v, err
+ }
+ v.Add("title", config.Title)
+ v.Add("description", config.Description)
+ v.Add("payload", config.Payload)
+ v.Add("provider_token", config.ProviderToken)
+ v.Add("start_parameter", config.StartParameter)
+ v.Add("currency", config.Currency)
+ data, err := json.Marshal(config.Prices)
+ if err != nil {
+ return v, err
+ }
+ v.Add("prices", string(data))
+ if config.PhotoURL != "" {
+ v.Add("photo_url", config.PhotoURL)
+ }
+ if config.PhotoSize != 0 {
+ v.Add("photo_size", strconv.Itoa(config.PhotoSize))
+ }
+ if config.PhotoWidth != 0 {
+ v.Add("photo_width", strconv.Itoa(config.PhotoWidth))
+ }
+ if config.PhotoHeight != 0 {
+ v.Add("photo_height", strconv.Itoa(config.PhotoHeight))
+ }
+ if config.NeedName != false {
+ v.Add("need_name", strconv.FormatBool(config.NeedName))
+ }
+ if config.NeedPhoneNumber != false {
+ v.Add("need_phone_number", strconv.FormatBool(config.NeedPhoneNumber))
+ }
+ if config.NeedEmail != false {
+ v.Add("need_email", strconv.FormatBool(config.NeedEmail))
+ }
+ if config.NeedShippingAddress != false {
+ v.Add("need_shipping_address", strconv.FormatBool(config.NeedShippingAddress))
+ }
+ if config.IsFlexible != false {
+ v.Add("is_flexible", strconv.FormatBool(config.IsFlexible))
+ }
+
+ return v, nil
+}
+
+func (config InvoiceConfig) method() string {
+ return "sendInvoice"
+}
+
+// ShippingConfig contains information for answerShippingQuery request.
+type ShippingConfig struct {
+ ShippingQueryID string // required
+ OK bool // required
+ ShippingOptions *[]ShippingOption
+ ErrorMessage string
+}
+
+// PreCheckoutConfig conatins information for answerPreCheckoutQuery request.
+type PreCheckoutConfig struct {
+ PreCheckoutQueryID string // required
+ OK bool // required
+ ErrorMessage string
+}
+
+// DeleteMessageConfig contains information of a message in a chat to delete.
+type DeleteMessageConfig struct {
+ ChatID int64
+ MessageID int
+}
+
+func (config DeleteMessageConfig) method() string {
+ return "deleteMessage"
+}
+
+func (config DeleteMessageConfig) values() (url.Values, error) {
+ v := url.Values{}
+
+ v.Add("chat_id", strconv.FormatInt(config.ChatID, 10))
+ v.Add("message_id", strconv.Itoa(config.MessageID))
+
+ return v, nil
+}
+
+// PinChatMessageConfig contains information of a message in a chat to pin.
+type PinChatMessageConfig struct {
+ ChatID int64
+ MessageID int
+ DisableNotification bool
+}
+
+func (config PinChatMessageConfig) method() string {
+ return "pinChatMessage"
+}
+
+func (config PinChatMessageConfig) values() (url.Values, error) {
+ v := url.Values{}
+
+ v.Add("chat_id", strconv.FormatInt(config.ChatID, 10))
+ v.Add("message_id", strconv.Itoa(config.MessageID))
+ v.Add("disable_notification", strconv.FormatBool(config.DisableNotification))
+
+ return v, nil
+}
+
+// UnpinChatMessageConfig contains information of chat to unpin.
+type UnpinChatMessageConfig struct {
+ ChatID int64
+}
+
+func (config UnpinChatMessageConfig) method() string {
+ return "unpinChatMessage"
+}
+
+func (config UnpinChatMessageConfig) values() (url.Values, error) {
+ v := url.Values{}
+
+ v.Add("chat_id", strconv.FormatInt(config.ChatID, 10))
+
+ return v, nil
+} \ No newline at end of file
diff --git a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/helpers.go b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/helpers.go
index 476eeeb0..132d957e 100644
--- a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/helpers.go
+++ b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/helpers.go
@@ -194,6 +194,37 @@ func NewVideoShare(chatID int64, fileID string) VideoConfig {
}
}
+// NewVideoNoteUpload creates a new video note uploader.
+//
+// chatID is where to send it, file is a string path to the file,
+// FileReader, or FileBytes.
+func NewVideoNoteUpload(chatID int64, length int, file interface{}) VideoNoteConfig {
+ return VideoNoteConfig{
+ BaseFile: BaseFile{
+ BaseChat: BaseChat{ChatID: chatID},
+ File: file,
+ UseExisting: false,
+ },
+ Length: length,
+ }
+}
+
+// NewVideoNoteShare shares an existing video.
+// You may use this to reshare an existing video without reuploading it.
+//
+// chatID is where to send it, fileID is the ID of the video
+// already uploaded.
+func NewVideoNoteShare(chatID int64, length int, fileID string) VideoNoteConfig {
+ return VideoNoteConfig{
+ BaseFile: BaseFile{
+ BaseChat: BaseChat{ChatID: chatID},
+ FileID: fileID,
+ UseExisting: true,
+ },
+ Length: length,
+ }
+}
+
// NewVoiceUpload creates a new voice uploader.
//
// chatID is where to send it, file is a string path to the file,
@@ -609,3 +640,16 @@ func NewCallbackWithAlert(id, text string) CallbackConfig {
ShowAlert: true,
}
}
+
+// NewInvoice created a new Invoice request to the user.
+func NewInvoice(chatID int64, title, description, payload, providerToken, startParameter, currency string, prices *[]LabeledPrice) InvoiceConfig {
+ return InvoiceConfig{
+ BaseChat: BaseChat{ChatID: chatID},
+ Title: title,
+ Description: description,
+ Payload: payload,
+ ProviderToken: providerToken,
+ StartParameter: startParameter,
+ Currency: currency,
+ Prices: prices}
+}
diff --git a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/types.go b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/types.go
index 70960aef..95231e4c 100644
--- a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/types.go
+++ b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/types.go
@@ -35,6 +35,8 @@ type Update struct {
InlineQuery *InlineQuery `json:"inline_query"`
ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result"`
CallbackQuery *CallbackQuery `json:"callback_query"`
+ ShippingQuery *ShippingQuery `json:"shipping_query"`
+ PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query"`
}
// UpdatesChannel is the channel for getting updates.
@@ -49,10 +51,11 @@ func (ch UpdatesChannel) Clear() {
// User is a user on Telegram.
type User struct {
- ID int `json:"id"`
- FirstName string `json:"first_name"`
- LastName string `json:"last_name"` // optional
- UserName string `json:"username"` // optional
+ ID int `json:"id"`
+ FirstName string `json:"first_name"`
+ LastName string `json:"last_name"` // optional
+ UserName string `json:"username"` // optional
+ LanguageCode string `json:"language_code"` // optional
}
// String displays a simple text version of a user.
@@ -78,15 +81,24 @@ type GroupChat struct {
Title string `json:"title"`
}
+// ChatPhoto represents a chat photo.
+type ChatPhoto struct {
+ SmallFileID string `json:"small_file_id"`
+ BigFileID string `json:"big_file_id"`
+}
+
// Chat contains information about the place a message was sent.
type Chat struct {
- ID int64 `json:"id"`
- Type string `json:"type"`
- Title string `json:"title"` // optional
- UserName string `json:"username"` // optional
- FirstName string `json:"first_name"` // optional
- LastName string `json:"last_name"` // optional
- AllMembersAreAdmins bool `json:"all_members_are_administrators"` // optional
+ ID int64 `json:"id"`
+ Type string `json:"type"`
+ Title string `json:"title"` // optional
+ UserName string `json:"username"` // optional
+ FirstName string `json:"first_name"` // optional
+ LastName string `json:"last_name"` // optional
+ AllMembersAreAdmins bool `json:"all_members_are_administrators"` // optional
+ Photo *ChatPhoto `json:"photo"`
+ Description string `json:"description,omitempty"` // optional
+ InviteLink string `json:"invite_link,omitempty"` // optional
}
// IsPrivate returns if the Chat is a private conversation.
@@ -117,40 +129,43 @@ func (c Chat) ChatConfig() ChatConfig {
// Message is returned by almost every request, and contains data about
// almost anything.
type Message struct {
- MessageID int `json:"message_id"`
- From *User `json:"from"` // optional
- Date int `json:"date"`
- Chat *Chat `json:"chat"`
- ForwardFrom *User `json:"forward_from"` // optional
- ForwardFromChat *Chat `json:"forward_from_chat"` // optional
- ForwardFromMessageID int `json:"forward_from_message_id"` // optional
- ForwardDate int `json:"forward_date"` // optional
- ReplyToMessage *Message `json:"reply_to_message"` // optional
- EditDate int `json:"edit_date"` // optional
- Text string `json:"text"` // optional
- Entities *[]MessageEntity `json:"entities"` // optional
- Audio *Audio `json:"audio"` // optional
- Document *Document `json:"document"` // optional
- Game *Game `json:"game"` // optional
- Photo *[]PhotoSize `json:"photo"` // optional
- Sticker *Sticker `json:"sticker"` // optional
- Video *Video `json:"video"` // optional
- Voice *Voice `json:"voice"` // optional
- Caption string `json:"caption"` // optional
- Contact *Contact `json:"contact"` // optional
- Location *Location `json:"location"` // optional
- Venue *Venue `json:"venue"` // optional
- NewChatMember *User `json:"new_chat_member"` // optional
- LeftChatMember *User `json:"left_chat_member"` // optional
- NewChatTitle string `json:"new_chat_title"` // optional
- NewChatPhoto *[]PhotoSize `json:"new_chat_photo"` // optional
- DeleteChatPhoto bool `json:"delete_chat_photo"` // optional
- GroupChatCreated bool `json:"group_chat_created"` // optional
- SuperGroupChatCreated bool `json:"supergroup_chat_created"` // optional
- ChannelChatCreated bool `json:"channel_chat_created"` // optional
- MigrateToChatID int64 `json:"migrate_to_chat_id"` // optional
- MigrateFromChatID int64 `json:"migrate_from_chat_id"` // optional
- PinnedMessage *Message `json:"pinned_message"` // optional
+ MessageID int `json:"message_id"`
+ From *User `json:"from"` // optional
+ Date int `json:"date"`
+ Chat *Chat `json:"chat"`
+ ForwardFrom *User `json:"forward_from"` // optional
+ ForwardFromChat *Chat `json:"forward_from_chat"` // optional
+ ForwardFromMessageID int `json:"forward_from_message_id"` // optional
+ ForwardDate int `json:"forward_date"` // optional
+ ReplyToMessage *Message `json:"reply_to_message"` // optional
+ EditDate int `json:"edit_date"` // optional
+ Text string `json:"text"` // optional
+ Entities *[]MessageEntity `json:"entities"` // optional
+ Audio *Audio `json:"audio"` // optional
+ Document *Document `json:"document"` // optional
+ Game *Game `json:"game"` // optional
+ Photo *[]PhotoSize `json:"photo"` // optional
+ Sticker *Sticker `json:"sticker"` // optional
+ Video *Video `json:"video"` // optional
+ VideoNote *VideoNote `json:"video_note"` // optional
+ Voice *Voice `json:"voice"` // optional
+ Caption string `json:"caption"` // optional
+ Contact *Contact `json:"contact"` // optional
+ Location *Location `json:"location"` // optional
+ Venue *Venue `json:"venue"` // optional
+ NewChatMembers *[]User `json:"new_chat_members"` // optional
+ LeftChatMember *User `json:"left_chat_member"` // optional
+ NewChatTitle string `json:"new_chat_title"` // optional
+ NewChatPhoto *[]PhotoSize `json:"new_chat_photo"` // optional
+ DeleteChatPhoto bool `json:"delete_chat_photo"` // optional
+ GroupChatCreated bool `json:"group_chat_created"` // optional
+ SuperGroupChatCreated bool `json:"supergroup_chat_created"` // optional
+ ChannelChatCreated bool `json:"channel_chat_created"` // optional
+ MigrateToChatID int64 `json:"migrate_to_chat_id"` // optional
+ MigrateFromChatID int64 `json:"migrate_from_chat_id"` // optional
+ PinnedMessage *Message `json:"pinned_message"` // optional
+ Invoice *Invoice `json:"invoice"` // optional
+ SuccessfulPayment *SuccessfulPayment `json:"successful_payment"` // optional
}
// Time converts the message timestamp into a Time.
@@ -263,6 +278,15 @@ type Video struct {
FileSize int `json:"file_size"` // optional
}
+// VideoNote contains information about a video.
+type VideoNote struct {
+ FileID string `json:"file_id"`
+ Length int `json:"length"`
+ Duration int `json:"duration"`
+ Thumbnail *PhotoSize `json:"thumb"` // optional
+ FileSize int `json:"file_size"` // optional
+}
+
// Voice contains information about a voice.
type Voice struct {
FileID string `json:"file_id"`
@@ -361,6 +385,7 @@ type InlineKeyboardButton struct {
SwitchInlineQuery *string `json:"switch_inline_query,omitempty"` // optional
SwitchInlineQueryCurrentChat *string `json:"switch_inline_query_current_chat,omitempty"` // optional
CallbackGame *CallbackGame `json:"callback_game,omitempty"` // optional
+ Pay bool `json:"pay,omitempty"` // optional
}
// CallbackQuery is data sent when a keyboard button with callback data
@@ -384,8 +409,22 @@ type ForceReply struct {
// ChatMember is information about a member in a chat.
type ChatMember struct {
- User *User `json:"user"`
- Status string `json:"status"`
+ User *User `json:"user"`
+ Status string `json:"status"`
+ UntilDate int64 `json:"until_date,omitempty"` // optional
+ CanBeEdited bool `json:"can_be_edited,omitempty"` // optional
+ CanChangeInfo bool `json:"can_change_info,omitempty"` // optional
+ CanPostMessages bool `json:"can_post_messages,omitempty"` // optional
+ CanEditMessages bool `json:"can_edit_messages,omitempty"` // optional
+ CanDeleteMessages bool `json:"can_delete_messages,omitempty"` // optional
+ CanInviteUsers bool `json:"can_invite_users,omitempty"` // optional
+ CanRestrictMembers bool `json:"can_restrict_members,omitempty"` // optional
+ CanPinMessages bool `json:"can_pin_messages,omitempty"` // optional
+ CanPromoteMembers bool `json:"can_promote_members,omitempty"` // optional
+ CanSendMessages bool `json:"can_send_messages,omitempty"` // optional
+ CanSendMediaMessages bool `json:"can_send_media_messages,omitempty"` // optional
+ CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"` // optional
+ CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"` // optional
}
// IsCreator returns if the ChatMember was the creator of the chat.
@@ -493,6 +532,7 @@ type InlineQueryResultGIF struct {
URL string `json:"gif_url"` // required
Width int `json:"gif_width"`
Height int `json:"gif_height"`
+ Duration int `json:"gif_duration"`
ThumbURL string `json:"thumb_url"`
Title string `json:"title"`
Caption string `json:"caption"`
@@ -507,6 +547,7 @@ type InlineQueryResultMPEG4GIF struct {
URL string `json:"mpeg4_url"` // required
Width int `json:"mpeg4_width"`
Height int `json:"mpeg4_height"`
+ Duration int `json:"mpeg4_duration"`
ThumbURL string `json:"thumb_url"`
Title string `json:"title"`
Caption string `json:"caption"`
@@ -635,3 +676,73 @@ type InputContactMessageContent struct {
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
}
+
+// Invoice contains basic information about an invoice.
+type Invoice struct {
+ Title string `json:"title"`
+ Description string `json:"description"`
+ StartParameter string `json:"start_parameter"`
+ Currency string `json:"currency"`
+ TotalAmount int `json:"total_amount"`
+}
+
+// LabeledPrice represents a portion of the price for goods or services.
+type LabeledPrice struct {
+ Label string `json:"label"`
+ Amount int `json:"amount"`
+}
+
+// ShippingAddress represents a shipping address.
+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"`
+}
+
+// OrderInfo represents information about an order.
+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"`
+}
+
+// ShippingOption represents one shipping option.
+type ShippingOption struct {
+ ID string `json:"id"`
+ Title string `json:"title"`
+ Prices *[]LabeledPrice `json:"prices"`
+}
+
+// SuccessfulPayment contains basic information about a successful payment.
+type SuccessfulPayment struct {
+ Currency string `json:"currency"`
+ TotalAmount int `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"`
+}
+
+// ShippingQuery contains information about an incoming shipping query.
+type ShippingQuery struct {
+ ID string `json:"id"`
+ From *User `json:"from"`
+ InvoicePayload string `json:"invoice_payload"`
+ ShippingAddress *ShippingAddress `json:"shipping_address"`
+}
+
+// PreCheckoutQuery contains information about an incoming pre-checkout query.
+type PreCheckoutQuery struct {
+ ID string `json:"id"`
+ From *User `json:"from"`
+ Currency string `json:"currency"`
+ TotalAmount int `json:"total_amount"`
+ InvoicePayload string `json:"invoice_payload"`
+ ShippingOptionID string `json:"shipping_option_id,omitempty"`
+ OrderInfo *OrderInfo `json:"order_info,omitempty"`
+}
diff --git a/vendor/manifest b/vendor/manifest
index 2bf08c2b..d10ffa30 100644
--- a/vendor/manifest
+++ b/vendor/manifest
@@ -136,7 +136,7 @@
"importpath": "github.com/go-telegram-bot-api/telegram-bot-api",
"repository": "https://github.com/go-telegram-bot-api/telegram-bot-api",
"vcs": "git",
- "revision": "89bbb1edff353a7c6d10ef10cfd2675056ad8a58",
+ "revision": "9dda67c714e5e2cba837b28a0172cca2ed54f078",
"branch": "master",
"notests": true
},