Add more helpers, update README for v4 release.
Syfaro syfaro@foxpaw.in
Wed, 13 Apr 2016 09:01:46 -0500
3 files changed,
47 insertions(+),
10 deletions(-)
M
README.md
→
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 @@ ```go
package main import ( - "gopkg.in/telegram-bot-api.v3" + "gopkg.in/telegram-bot-api.v4" "log" "net/http" )
M
configs.go
→
configs.go
@@ -559,7 +559,7 @@ BaseEdit
Text string ParseMode string DisableWebPagePreview bool - ReplyMarkup InlineKeyboardMarkup + ReplyMarkup *InlineKeyboardMarkup } func (config EditMessageTextConfig) values() (url.Values, error) {@@ -580,7 +580,7 @@ // EditMessageCaptionConfig allows you to modify the caption of a message.
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" }
M
helpers.go
→
helpers.go
@@ -351,3 +351,37 @@ ID: id,
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, + } +}