mirror of
https://github.com/watn3y/steamsalty.git
synced 2025-06-07 07:11:01 +02:00
v1.0
- Fixed SLEEPTIME not working (always 0) - Refined logging - Added metadata to /info command - Bot now automatically sets own commands for autocompletion
This commit is contained in:
parent
eb0482b8e0
commit
6be403fc58
14 changed files with 116 additions and 53 deletions
|
@ -2,6 +2,7 @@ package config
|
|||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
envconfig "github.com/sethvargo/go-envconfig"
|
||||
|
@ -11,12 +12,9 @@ var BotConfig config
|
|||
|
||||
func LoadConfig() {
|
||||
if err := envconfig.Process(context.Background(), &BotConfig); err != nil {
|
||||
log.Panic().Err(err).Msg("error parsing config from env variables")
|
||||
}
|
||||
|
||||
if !BotConfig.DebugMode {
|
||||
zerolog.SetGlobalLevel(zerolog.InfoLevel)
|
||||
log.Panic().Err(err).Msg("Error parsing config from env variables")
|
||||
}
|
||||
zerolog.SetGlobalLevel(zerolog.Level(BotConfig.LogLevel))
|
||||
|
||||
log.Info().Msg("Loaded config")
|
||||
log.Debug().Interface("config", BotConfig).Msg("")
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package config
|
||||
|
||||
type config struct {
|
||||
TelegramAPIToken string `env:"TELEGRAMAPITOKEN, required"`
|
||||
SteamAPIKey string `env:"STEAMAPIKEY, required"`
|
||||
DebugMode bool `env:"DEBUGMODE, default=false"`
|
||||
ChatID int64 `env:"CHATID"`
|
||||
Watchers []uint64 `env:"WATCHERS"`
|
||||
SleepInterval int `env:"SLEEPINTERVAL"`
|
||||
LogLevel int `env:"STEAMSALTY_LOGLEVEL, default=1"`
|
||||
TelegramAPIToken string `env:"STEAMSALTY_TELEGRAMAPITOKEN, required"`
|
||||
SteamAPIKey string `env:"STEAMSALTY_STEAMAPIKEY, required"`
|
||||
ChatID int64 `env:"STEAMSALTY_CHATID, required"`
|
||||
Watchers []uint64 `env:"STEAMSALTY_WATCHERS, required"`
|
||||
SleepInterval int `env:"STEAMSALTY_SLEEPINTERVAL, default=60"`
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue