Implement Bot API 6.0 changes.
This commit is contained in:
parent
f399a2424c
commit
10a9f2650f
4 changed files with 228 additions and 30 deletions
34
bot.go
34
bot.go
|
@ -681,12 +681,7 @@ func (bot *BotAPI) GetMyCommandsWithConfig(config GetMyCommandsConfig) ([]BotCom
|
|||
// forwardMessage, but the copied message doesn't have a link to the original
|
||||
// message. Returns the MessageID of the sent message on success.
|
||||
func (bot *BotAPI) CopyMessage(config CopyMessageConfig) (MessageID, error) {
|
||||
params, err := config.params()
|
||||
if err != nil {
|
||||
return MessageID{}, err
|
||||
}
|
||||
|
||||
resp, err := bot.MakeRequest(config.method(), params)
|
||||
resp, err := bot.Request(config)
|
||||
if err != nil {
|
||||
return MessageID{}, err
|
||||
}
|
||||
|
@ -697,6 +692,33 @@ func (bot *BotAPI) CopyMessage(config CopyMessageConfig) (MessageID, error) {
|
|||
return messageID, err
|
||||
}
|
||||
|
||||
// AnswerWebAppQuery sets the result of an interaction with a Web App and send a
|
||||
// corresponding message on behalf of the user to the chat from which the query originated.
|
||||
func (bot *BotAPI) AnswerWebAppQuery(config AnswerWebAppQueryConfig) (SentWebAppMessage, error) {
|
||||
var sentWebAppMessage SentWebAppMessage
|
||||
|
||||
resp, err := bot.Request(config)
|
||||
if err != nil {
|
||||
return sentWebAppMessage, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(resp.Result, &sentWebAppMessage)
|
||||
return sentWebAppMessage, err
|
||||
}
|
||||
|
||||
// GetMyDefaultAdministratorRights gets the current default administrator rights of the bot.
|
||||
func (bot *BotAPI) GetMyDefaultAdministratorRights(config GetMyDefaultAdministratorRightsConfig) (ChatAdministratorRights, error) {
|
||||
var rights ChatAdministratorRights
|
||||
|
||||
resp, err := bot.Request(config)
|
||||
if err != nil {
|
||||
return rights, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(resp.Result, &rights)
|
||||
return rights, err
|
||||
}
|
||||
|
||||
// EscapeText takes an input text and escape Telegram markup symbols.
|
||||
// In this way we can send a text without being afraid of having to escape the characters manually.
|
||||
// Note that you don't have to include the formatting style in the input text, or it will be escaped too.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue