all repos — telegram-bot-api @ 774f1e72e7647a5e78d4d3345f54581249bbf110

Golang bindings for the Telegram Bot API

Updates for Bot API 4.8.
Syfaro syfaro@huefox.com
Fri, 24 Apr 2020 13:18:26 -0500
commit

774f1e72e7647a5e78d4d3345f54581249bbf110

parent

75e27e1380817b6d09f88cb9780eaa2804927840

3 files changed, 38 insertions(+), 15 deletions(-)

jump to
M configs.goconfigs.go

@@ -510,6 +510,10 @@ IsAnonymous bool

Type string AllowsMultipleAnswers bool CorrectOptionID int64 + Explanation string + ExplanationParseMode string + OpenPeriod int + CloseDate int IsClosed bool }

@@ -526,6 +530,10 @@ params.AddNonEmpty("type", config.Type)

params["allows_multiple_answers"] = strconv.FormatBool(config.AllowsMultipleAnswers) params["correct_option_id"] = strconv.FormatInt(config.CorrectOptionID, 10) params.AddBool("is_closed", config.IsClosed) + params.AddNonEmpty("explanation", config.Explanation) + params.AddNonEmpty("explanation_parse_mode", config.ExplanationParseMode) + params.AddNonZero("open_period", config.OpenPeriod) + params.AddNonZero("close_date", config.CloseDate) return params, err }

@@ -1666,6 +1674,8 @@

// DiceConfig allows you to send a random dice roll to Telegram. type DiceConfig struct { BaseChat + + Emoji string } func (config DiceConfig) method() string {

@@ -1673,7 +1683,14 @@ return "sendDice"

} func (config DiceConfig) params() (Params, error) { - return config.BaseChat.params() + params, err := config.BaseChat.params() + if err != nil { + return params, err + } + + params.AddNonEmpty("emoji", config.Emoji) + + return params, err } // GetMyCommandsConfig gets a list of the currently registered commands.
M helpers.gohelpers.go

@@ -918,9 +918,10 @@

// NewSendDice allows you to send a random dice roll. func NewSendDice(chatID int64) DiceConfig { return DiceConfig{ - BaseChat{ + BaseChat: BaseChat{ ChatID: chatID, }, + Emoji: "", } }
M types.gotypes.go

@@ -486,19 +486,24 @@ }

// Poll contains information about a poll. type Poll struct { - ID string `json:"id"` - Question string `json:"question"` - Options []PollOption `json:"options"` - IsClosed bool `json:"is_closed"` - IsAnonymous bool `json:"is_anonymous"` - Type string `json:"type"` - AllowsMultipleAnswers bool `json:"allows_multiple_answers"` - CorrectOptionID int `json:"correct_option_id"` // optional + ID string `json:"id"` + Question string `json:"question"` + Options []PollOption `json:"options"` + IsClosed bool `json:"is_closed"` + IsAnonymous bool `json:"is_anonymous"` + Type string `json:"type"` + AllowsMultipleAnswers bool `json:"allows_multiple_answers"` + CorrectOptionID int `json:"correct_option_id"` // optional + Explanation string `json:"explanation"` // optional + ExplanationEntities []MessageEntity `json:"explanation_entities"` // optional + OpenPeriod int `json:"open_period"` // optional + CloseDate int `json:"close_date"` // optional } // Dice represents a single dice value. type Dice struct { - Value int `json:"value"` + Emoji string `json:"emoji"` + Value int `json:"value"` } // UserProfilePhotos contains a set of user profile photos.

@@ -532,10 +537,10 @@ }

// KeyboardButton is a button within a custom keyboard. type KeyboardButton struct { - Text string `json:"text"` - RequestContact bool `json:"request_contact"` - RequestLocation bool `json:"request_location"` - RequestPoll KeyboardButtonPollType `json:"request_poll"` + Text string `json:"text"` + RequestContact bool `json:"request_contact"` + RequestLocation bool `json:"request_location"` + RequestPoll *KeyboardButtonPollType `json:"request_poll,omitempty"` } // KeyboardButtonPollType represents type of a poll, which is allowed to