Add ParseMode to EditMessageCaption
parent
4c16a90966
commit
f90493fac6
|
@ -794,12 +794,14 @@ func (config EditMessageTextConfig) method() string {
|
||||||
type EditMessageCaptionConfig struct {
|
type EditMessageCaptionConfig struct {
|
||||||
BaseEdit
|
BaseEdit
|
||||||
Caption string
|
Caption string
|
||||||
|
ParseMode string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (config EditMessageCaptionConfig) values() (url.Values, error) {
|
func (config EditMessageCaptionConfig) values() (url.Values, error) {
|
||||||
v, _ := config.BaseEdit.values()
|
v, _ := config.BaseEdit.values()
|
||||||
|
|
||||||
v.Add("caption", config.Caption)
|
v.Add("caption", config.Caption)
|
||||||
|
v.Add("parse_mode", config.ParseMode)
|
||||||
|
|
||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -494,13 +494,14 @@ func NewEditMessageText(chatID int64, messageID int, text string) EditMessageTex
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEditMessageCaption allows you to edit the caption of a message.
|
// NewEditMessageCaption allows you to edit the caption of a message.
|
||||||
func NewEditMessageCaption(chatID int64, messageID int, caption string) EditMessageCaptionConfig {
|
func NewEditMessageCaption(chatID int64, messageID int, caption, parseMode string) EditMessageCaptionConfig {
|
||||||
return EditMessageCaptionConfig{
|
return EditMessageCaptionConfig{
|
||||||
BaseEdit: BaseEdit{
|
BaseEdit: BaseEdit{
|
||||||
ChatID: chatID,
|
ChatID: chatID,
|
||||||
MessageID: messageID,
|
MessageID: messageID,
|
||||||
},
|
},
|
||||||
Caption: caption,
|
Caption: caption,
|
||||||
|
ParseMode: parseMode,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,9 +148,10 @@ func TestNewEditMessageText(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNewEditMessageCaption(t *testing.T) {
|
func TestNewEditMessageCaption(t *testing.T) {
|
||||||
edit := tgbotapi.NewEditMessageCaption(ChatID, ReplyToMessageID, "new caption")
|
edit := tgbotapi.NewEditMessageCaption(ChatID, ReplyToMessageID, "new caption", tgbotapi.ModeHTML)
|
||||||
|
|
||||||
if edit.Caption != "new caption" ||
|
if edit.Caption != "new caption" ||
|
||||||
|
edit.ParseMode != tgbotapi.ModeHTML ||
|
||||||
edit.BaseEdit.ChatID != ChatID ||
|
edit.BaseEdit.ChatID != ChatID ||
|
||||||
edit.BaseEdit.MessageID != ReplyToMessageID {
|
edit.BaseEdit.MessageID != ReplyToMessageID {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
|
|
Loading…
Reference in New Issue