Add more helpers, update README for v4 release.

bot-api-6.1
Syfaro 2016-04-13 09:01:46 -05:00
parent 1ceb22b273
commit ee1d537565
3 changed files with 47 additions and 10 deletions

View File

@ -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"
)

View File

@ -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"
}

View File

@ -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,
}
}