🐛 fix: config file loading error

This commit is contained in:
Martial BE
2024-04-18 23:10:47 +08:00
parent 303fe3360b
commit 0c5ad810a9
11 changed files with 25 additions and 36 deletions

View File

@@ -28,7 +28,7 @@ func InitTelegramBot() {
return
}
botKey := viper.GetString("TG_BOT_API_KEY")
botKey := viper.GetString("tg.bot_api_key")
if botKey == "" {
common.SysLog("Telegram bot is not enabled")
return
@@ -48,7 +48,7 @@ func InitTelegramBot() {
}
func StartTelegramBot() {
botWebhook := viper.GetString("TG_WEBHOOK_SECRET")
botWebhook := viper.GetString("tg.webhook_secret")
if botWebhook != "" {
if common.ServerAddress == "" {
common.SysLog("Telegram bot is not enabled: Server address is not set")
@@ -57,7 +57,7 @@ func StartTelegramBot() {
}
TGWebHookSecret = botWebhook
serverAddress := strings.TrimSuffix(common.ServerAddress, "/")
urlPath := fmt.Sprintf("/api/telegram/%s", viper.GetString("TG_BOT_API_KEY"))
urlPath := fmt.Sprintf("/api/telegram/%s", viper.GetString("tg.bot_api_key"))
webHookOpts := &ext.AddWebhookOpts{
SecretToken: TGWebHookSecret,