diff --git a/README.md b/README.md index de63d9e..82bd106 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,10 @@ something with plugins and command handlers without having to design all that yourself. Use `github.com/go-telegram-bot-api/telegram-bot-api` for the latest -version, or use `gopkg.in/telegram-bot-api.v3` for the stable build. +version, or use `gopkg.in/telegram-bot-api.v4` for the stable build. + +Join [the development group](https://telegram.me/go_telegram_bot_api) if +you want to ask questions or discuss development. ## Example @@ -29,7 +32,7 @@ package main import ( "log" - "gopkg.in/telegram-bot-api.v3" + "gopkg.in/telegram-bot-api.v4" ) func main() { @@ -65,7 +68,7 @@ you may use a slightly different method. package main import ( - "gopkg.in/telegram-bot-api.v3" + "gopkg.in/telegram-bot-api.v4" "log" "net/http" ) diff --git a/configs.go b/configs.go index 76234fc..d80815c 100644 --- a/configs.go +++ b/configs.go @@ -559,7 +559,7 @@ type EditMessageTextConfig struct { Text string ParseMode string DisableWebPagePreview bool - ReplyMarkup InlineKeyboardMarkup + ReplyMarkup *InlineKeyboardMarkup } func (config EditMessageTextConfig) values() (url.Values, error) { @@ -580,7 +580,7 @@ func (config EditMessageTextConfig) method() string { type EditMessageCaptionConfig struct { BaseEdit Caption string - ReplyMarkup InlineKeyboardMarkup + ReplyMarkup *InlineKeyboardMarkup } func (config EditMessageCaptionConfig) values() (url.Values, error) { @@ -595,18 +595,18 @@ func (config EditMessageCaptionConfig) method() string { return "editMessageCaption" } -// EditMessageReplyMarkup allows you to modify the reply markup +// EditMessageReplyMarkupConfig allows you to modify the reply markup // of a message. -type EditMessageReplyMarkup struct { +type EditMessageReplyMarkupConfig struct { BaseEdit - ReplyMarkup InlineKeyboardMarkup + ReplyMarkup *InlineKeyboardMarkup } -func (config EditMessageReplyMarkup) values() (url.Values, error) { +func (config EditMessageReplyMarkupConfig) values() (url.Values, error) { return config.BaseEdit.values() } -func (config EditMessageReplyMarkup) method() string { +func (config EditMessageReplyMarkupConfig) method() string { return "editMessageReplyMarkup" } diff --git a/helpers.go b/helpers.go index 14e7b10..e1c5f54 100644 --- a/helpers.go +++ b/helpers.go @@ -351,3 +351,37 @@ func NewInlineQueryResultVideo(id, url string) InlineQueryResultVideo { URL: url, } } + +// NewEditMessageText allows you to edit the text of a message. +func NewEditMessageText(chatID int64, messageID int, text string) EditMessageTextConfig { + return EditMessageTextConfig{ + BaseEdit: BaseEdit{ + ChatID: chatID, + MessageID: messageID, + }, + Text: text, + } +} + +// NewEditMessageCaption allows you to edit the caption of a message. +func NewEditMessageCaption(chatID int64, messageID int, caption string) EditMessageCaptionConfig { + return EditMessageCaptionConfig{ + BaseEdit: BaseEdit{ + ChatID: chatID, + MessageID: messageID, + }, + Caption: caption, + } +} + +// NewEditMessageReplyMarkup allows you to edit the inline +// keyboard markup. +func NewEditMessageReplyMarkup(chatID int64, messageID int, replyMarkup InlineKeyboardMarkup) EditMessageReplyMarkupConfig { + return EditMessageReplyMarkupConfig{ + BaseEdit: BaseEdit{ + ChatID: chatID, + MessageID: messageID, + }, + ReplyMarkup: &replyMarkup, + } +}