summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/go-telegram-bot-api/telegram-bot-api
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-03-25 20:45:10 +0100
committerWim <wim@42.be>2017-03-25 20:45:10 +0100
commit07fd825349e8b7e86f8afb3843cb8e2c2afc7c74 (patch)
treeea4b33872a5b925fa0ecd2b421f8f073ba22b2cc /vendor/github.com/go-telegram-bot-api/telegram-bot-api
parentbe15cc8a36ed3c207251f9b92815781f2fa8618d (diff)
downloadmatterbridge-msglm-07fd825349e8b7e86f8afb3843cb8e2c2afc7c74.tar.gz
matterbridge-msglm-07fd825349e8b7e86f8afb3843cb8e2c2afc7c74.tar.bz2
matterbridge-msglm-07fd825349e8b7e86f8afb3843cb8e2c2afc7c74.zip
Update vendor
Diffstat (limited to 'vendor/github.com/go-telegram-bot-api/telegram-bot-api')
-rw-r--r--vendor/github.com/go-telegram-bot-api/telegram-bot-api/bot.go17
-rw-r--r--vendor/github.com/go-telegram-bot-api/telegram-bot-api/configs.go4
-rw-r--r--vendor/github.com/go-telegram-bot-api/telegram-bot-api/helpers.go15
-rw-r--r--vendor/github.com/go-telegram-bot-api/telegram-bot-api/types.go2
4 files changed, 15 insertions, 23 deletions
diff --git a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/bot.go b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/bot.go
index 7ae3b472..c2b4529b 100644
--- a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/bot.go
+++ b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/bot.go
@@ -21,8 +21,10 @@ import (
// BotAPI allows you to interact with the Telegram Bot API.
type BotAPI struct {
- Token string `json:"token"`
- Debug bool `json:"debug"`
+ Token string `json:"token"`
+ Debug bool `json:"debug"`
+ Buffer int `json:"buffer"`
+
Self User `json:"-"`
Client *http.Client `json:"-"`
}
@@ -42,11 +44,12 @@ func NewBotAPIWithClient(token string, client *http.Client) (*BotAPI, error) {
bot := &BotAPI{
Token: token,
Client: client,
+ Buffer: 100,
}
self, err := bot.GetMe()
if err != nil {
- return &BotAPI{}, err
+ return nil, err
}
bot.Self = self
@@ -68,6 +71,10 @@ func (bot *BotAPI) MakeRequest(endpoint string, params url.Values) (APIResponse,
return APIResponse{}, errors.New(ErrAPIForbidden)
}
+ if resp.StatusCode != http.StatusOK {
+ return APIResponse{}, errors.New(http.StatusText(resp.StatusCode))
+ }
+
bytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
return APIResponse{}, err
@@ -457,7 +464,7 @@ func (bot *BotAPI) GetWebhookInfo() (WebhookInfo, error) {
// GetUpdatesChan starts and returns a channel for getting updates.
func (bot *BotAPI) GetUpdatesChan(config UpdateConfig) (UpdatesChannel, error) {
- ch := make(chan Update, 100)
+ ch := make(chan Update, bot.Buffer)
go func() {
for {
@@ -484,7 +491,7 @@ func (bot *BotAPI) GetUpdatesChan(config UpdateConfig) (UpdatesChannel, error) {
// ListenForWebhook registers a http handler for a webhook.
func (bot *BotAPI) ListenForWebhook(pattern string) UpdatesChannel {
- ch := make(chan Update, 100)
+ ch := make(chan Update, bot.Buffer)
http.HandleFunc(pattern, func(w http.ResponseWriter, r *http.Request) {
bytes, _ := ioutil.ReadAll(r.Body)
diff --git a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/configs.go b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/configs.go
index 68c14e92..5352933e 100644
--- a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/configs.go
+++ b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/configs.go
@@ -768,8 +768,8 @@ type UpdateConfig struct {
// WebhookConfig contains information about a SetWebhook request.
type WebhookConfig struct {
- URL *url.URL
- Certificate interface{}
+ URL *url.URL
+ Certificate interface{}
MaxConnections int
}
diff --git a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/helpers.go b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/helpers.go
index 4ca56fbf..476eeeb0 100644
--- a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/helpers.go
+++ b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/helpers.go
@@ -318,21 +318,6 @@ func NewWebhookWithCert(link string, file interface{}) WebhookConfig {
}
}
-// NewWebhookWithCert creates a new webhook with a certificate and max_connections.
-//
-// link is the url you wish to get webhooks,
-// file contains a string to a file, FileReader, or FileBytes.
-// maxConnections defines maximum number of connections from telegram to your server
-func NewWebhookWithCertAndMaxConnections(link string, file interface{}, maxConnections int) WebhookConfig {
- u, _ := url.Parse(link)
-
- return WebhookConfig{
- URL: u,
- Certificate: file,
- MaxConnections: maxConnections,
- }
-}
-
// NewInlineQueryResultArticle creates a new inline query article.
func NewInlineQueryResultArticle(id, title, messageText string) InlineQueryResultArticle {
return InlineQueryResultArticle{
diff --git a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/types.go b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/types.go
index e691028d..70960aef 100644
--- a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/types.go
+++ b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/types.go
@@ -194,7 +194,7 @@ func (m *Message) CommandArguments() string {
return ""
}
- return strings.SplitN(m.Text, " ", 2)[1]
+ return split[1]
}
// MessageEntity contains information about data in a Message.