Archived
1

Fix webhook binding

This commit is contained in:
Vladimir Hodakov 2018-11-29 23:39:22 +04:00
parent 593e02b10b
commit 611d2c9c57
Signed by: Vladimir Hodakov
GPG Key ID: 673980B6882F82C6

View File

@ -54,8 +54,8 @@ func StartBot() {
}
if c.Config.Telegram.Webhook.Enabled {
var url *http.URI
url.Parse(nil, []byte(c.Config.Telegram.Webhook.Domain))
var url http.URI
url.Parse([]byte(c.Config.Telegram.Webhook.Domain), []byte(""))
if len(url.Host()) == 0 {
log.Fatal().Msg("Can't parse webhook URL: got empty host")
}
@ -64,7 +64,7 @@ func StartBot() {
webhook := telegram.NewWebhook(url.String()+bot.AccessToken, nil)
webhook.MaxConnections = 40
updates = bot.NewWebhookChannel(url, webhook, "", "", c.Config.Telegram.Webhook.Listen)
updates = bot.NewWebhookChannel(&url, webhook, "", "", c.Config.Telegram.Webhook.Listen)
} else {
log.Warn().Msg("Using long-polling for updates (not recommended)")
var info *telegram.WebhookInfo