Fix webhook binding
This commit is contained in:
parent
593e02b10b
commit
611d2c9c57
@ -54,8 +54,8 @@ func StartBot() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if c.Config.Telegram.Webhook.Enabled {
|
if c.Config.Telegram.Webhook.Enabled {
|
||||||
var url *http.URI
|
var url http.URI
|
||||||
url.Parse(nil, []byte(c.Config.Telegram.Webhook.Domain))
|
url.Parse([]byte(c.Config.Telegram.Webhook.Domain), []byte(""))
|
||||||
if len(url.Host()) == 0 {
|
if len(url.Host()) == 0 {
|
||||||
log.Fatal().Msg("Can't parse webhook URL: got empty host")
|
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 := telegram.NewWebhook(url.String()+bot.AccessToken, nil)
|
||||||
webhook.MaxConnections = 40
|
webhook.MaxConnections = 40
|
||||||
|
|
||||||
updates = bot.NewWebhookChannel(url, webhook, "", "", c.Config.Telegram.Webhook.Listen)
|
updates = bot.NewWebhookChannel(&url, webhook, "", "", c.Config.Telegram.Webhook.Listen)
|
||||||
} else {
|
} else {
|
||||||
log.Warn().Msg("Using long-polling for updates (not recommended)")
|
log.Warn().Msg("Using long-polling for updates (not recommended)")
|
||||||
var info *telegram.WebhookInfo
|
var info *telegram.WebhookInfo
|
||||||
|
Reference in New Issue
Block a user