1
0
Fork 0

👽 Updated code to v5.2

This commit is contained in:
Maxim Lebedev 2021-08-01 20:15:51 +05:00
parent aab898e7c0
commit a0e22b7608
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
5 changed files with 101 additions and 5 deletions

View File

@ -1,16 +1,16 @@
package telegram
// Version represents current version of Telegram API supported by this package
const Version string = "5.1.0"
const Version string = "5.2.0"
// Action represents available and supported status actions of bot
const (
ActionFindLocation string = "find_location"
ActionRecordAudio string = "record_audio"
ActionRecordVoice string = "record_voice"
ActionRecordVideo string = "record_video"
ActionRecordVideoNote string = "record_video_note"
ActionTyping string = "typing"
ActionUploadAudio string = "upload_audio"
ActionUploadVoice string = "upload_voice"
ActionUploadDocument string = "upload_document"
ActionUploadPhoto string = "upload_photo"
ActionUploadVideo string = "upload_video"

View File

@ -16,6 +16,12 @@ type (
// Sender
From *User `json:"from"`
// Type of the chat, from which the inline query was sent. Can be either “sender” for a private chat
// with the inline query sender, “private”, “group”, “supergroup”, or “channel”. The chat type should
// be always known for requests sent from official clients and most third-party clients, unless the
// request was sent from a secret chat
ChatType string `json:"chat_type,omitempty"`
// Sender location, only for bots that request user location
Location *Location `json:"location,omitempty"`
}
@ -882,6 +888,78 @@ type (
VCard string `json:"vcard,omitempty"`
}
// InputInvoiceMessageContent represents the content of an invoice message to be sent as the result of an inline query.
InputInvoiceMessageContent struct {
// Product name, 1-32 characters
Title string `json:"title"`
// Product description, 1-255 characters
Description string `json:"description"`
// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your
// internal processes.
Payload string `json:"payload"`
// Payment provider token, obtained via Botfather
ProviderToken string `json:"provider_token"`
// Three-letter ISO 4217 currency code
Currency string `json:"currency"`
// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery
// cost, delivery tax, bonus, etc.)
Prices []*LabeledPrice `json:"prices,omitempty"`
// The maximum accepted amount for tips in the smallest units of the currency (integer, not
// float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp
// parameter in currencies.json, it shows the number of digits past the decimal point for each currency
// (2 for the majority of currencies). Defaults to 0
MaxTipAmount int `json:"max_tip_amount,omitempty"`
// A JSON-serialized array of suggested amounts of tip in the smallest units of the currency (integer,
// not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must
// be positive, passed in a strictly increased order and must not exceed max_tip_amount.
SuggestedTipAmounts []int `json:"suggested_tip_amounts,omitempty"`
// A JSON-serialized object for data about the invoice, which will be shared with the payment provider.
// A detailed description of the required fields should be provided by the payment provider.
ProviderData string `json:"provider_data,omitempty"`
// URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a
// service. People like it better when they see what they are paying for.
PhotoURL string `json:"photo_url,omitempty"`
// Photo size
PhotoSize int `json:"photo_size,omitempty"`
// Photo width
PhotoWidth int `json:"photo_width,omitempty"`
// Photo height
PhotoHeight int `json:"photo_height,omitempty"`
// Pass True, if you require the user's full name to complete the order
NeedName bool `json:"need_name,omitempty"`
// Pass True, if you require the user's phone number to complete the order
NeedPhoneNumber bool `json:"need_phone_number,omitempty"`
// Pass True, if you require the user's email address to complete the order
NeedEmail bool `json:"need_email,omitempty"`
// Pass True, if you require the user's shipping address to complete the order
NeedShippingAddress bool `json:"need_shipping_address,omitempty"`
// Pass True, if user's phone number should be sent to provider
SendPhoneNumberToProvider bool `json:"send_phone_number_to_provider,omitempty"`
// Pass True, if user's email address should be sent to provider
SendEmailToProvider bool `json:"send_email_to_provider,omitempty"`
// Pass True, if the final price depends on the shipping method
IsFlexible bool `json:"is_flexible,omitempty"`
}
// ChosenInlineResult represents a result of an inline query that was chosen by the user and sent to their
// chat partner.
ChosenInlineResult struct {

View File

@ -587,7 +587,7 @@ type (
ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}
// SendChatAction represents data for SendChat method.
// SendChatAction represents data for SendChatAction method.
SendChatAction struct {
ChatID ChatID `json:"chat_id"`

View File

@ -158,7 +158,7 @@ type (
ProviderToken string `json:"provider_token"`
// Unique deep-linking parameter that can be used to generate this invoice when used as a start parameter
StartParameter string `json:"start_parameter"`
StartParameter string `json:"start_parameter,omitempty"`
// Three-letter ISO 4217 currency code, see more on currencies
Currency string `json:"currency"`
@ -172,6 +172,15 @@ type (
// Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
Prices []*LabeledPrice `json:"prices"`
// The maximum accepted amount for tips in the smallest units of the currency (integer, not
// float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp
// parameter in currencies.json, it shows the number of digits past the decimal point for each currency
// (2 for the majority of currencies). Defaults to 0
MaxTipAmount int `json:"max_tip_amount,omitempty"`
// A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount.
SuggestedTipAmounts []int `json:"suggested_tip_amounts,omitempty"`
// Photo size
PhotoSize int `json:"photo_size,omitempty"`

View File

@ -263,6 +263,9 @@ type (
// Location.
ProximityAlertTriggered *ProximityAlertTriggered `json:"proximity_alert_triggered,omitempty"`
// Service message: voice chat scheduled
VoiceChatScheduled *VoiceChatScheduled `json:"voice_chat_scheduled,omitempty"`
// Service message: voice chat started
VoiceChatStarted *VoiceChatStarted `json:"voice_chat_started,omitempty"`
@ -630,6 +633,12 @@ type (
MessageAutoDeleteTime int `json:"message_auto_delete_time"`
}
// VoiceChatScheduled represents a service message about a voice chat scheduled in the chat.
VoiceChatScheduled struct {
// Point in time (Unix timestamp) when the voice chat is supposed to be started by a chat administrator
StartDate int64 `json:"start_date"`
}
// VoiceChatStarted represents a service message about a voice chat started in the chat. Currently holds no
// information.
VoiceChatStarted struct{}