diff options
Diffstat (limited to 'telegram_bot.go')
| -rw-r--r-- | telegram_bot.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/telegram_bot.go b/telegram_bot.go index e88b123..71adb94 100644 --- a/telegram_bot.go +++ b/telegram_bot.go @@ -8,6 +8,7 @@ import ( "bytes" "fmt" "log" + "os" "strings" "github.com/shuLhan/share/api/telegram/bot" @@ -47,12 +48,18 @@ func NewTelegramBot(token, webhookURL string) (tgbot *TelegramBot, err error) { Handler: tgbot.handleCommandStart, }} + address := defAddress + port := os.Getenv(envPort) + if len(port) > 0 { + address = ":" + port + } + opts := bot.Options{ Token: token, HandleUpdate: tgbot.handleUpdate, Webhook: &bot.Webhook{ URL: webhookURL, - ListenAddress: defAddress, + ListenAddress: address, }, } |
