mirror of
https://github.com/Neur0toxine/bash.im-telegram-bot.git
synced 2024-11-21 12:46:10 +03:00
Changed WEBHOOK_PORT to PORT
This commit is contained in:
parent
04e287ee17
commit
0c9a399451
@ -1,7 +1,7 @@
|
||||
TG_BOT_TOKEN=token # Telegram Bot API Token
|
||||
POLL_TIMEOUT=30 # Poll timeout (in seconds). Default: 30
|
||||
WEBHOOK="https://www.google.com:{PORT}/{TOKEN}" # Webhook URL (don't provide if you want to use polling). {PORT} and {TOKEN} will be replaced automatically.
|
||||
WEBHOOK_PORT=8000 # Webhook port. Ignored if webhook URL is not provided. Default: 8000
|
||||
PORT=8000 # Webhook port. Ignored if webhook URL is not provided. Default: 8000
|
||||
CERT="cert.pem" # Certificate file name. Provide if you want to use SSL
|
||||
CERT_KEY="key.pem" # Certificate key. Should be provided with CERT
|
||||
DEBUG=false # Debug mode. This value will be passed to API library, which will log all requests in debug mode.
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"go.formatTool": "goimports"
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"fmt"
|
||||
"log"
|
||||
"math/rand"
|
||||
@ -219,7 +220,7 @@ func initWithWebhook(
|
||||
log.Printf("Telegram callback failed: %s", info.LastErrorMessage)
|
||||
}
|
||||
|
||||
updates := bot.ListenForWebhook("/" + bot.Token)
|
||||
updates := bot.ListenForWebhook(webhookUrl[strings.LastIndex(webhookUrl, "/"):])
|
||||
|
||||
if certFile != "" && certKey != "" {
|
||||
go http.ListenAndServeTLS(listenAddr, certFile, certKey, nil)
|
||||
|
@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -14,7 +15,7 @@ const envToken = "TG_BOT_TOKEN"
|
||||
const envPollTimeout = "POLL_TIMEOUT"
|
||||
const envListen = "LISTEN_IP"
|
||||
const envWebhook = "WEBHOOK"
|
||||
const envWebhookPort = "WEBHOOK_PORT"
|
||||
const envWebhookPort = "PORT"
|
||||
const envCert = "CERT"
|
||||
const envKey = "CERT_KEY"
|
||||
const envDebug = "DEBUG"
|
||||
@ -90,7 +91,7 @@ func LoadConfig() (BotConfig, error) {
|
||||
Debug: debug,
|
||||
PollingTimeout: pollTimeout,
|
||||
WebhookURL: webhookLink,
|
||||
ListenAddr: listenAddr,
|
||||
ListenAddr: fmt.Sprintf("%s:%d", listenAddr, webhookPort),
|
||||
CertificateFile: certFile,
|
||||
CertificateKey: certKey,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user