added player names

This commit is contained in:
2026-02-19 20:48:31 +11:00
parent d14677106c
commit 60120e9d0e
5 changed files with 43 additions and 5 deletions

View File

@@ -14,6 +14,7 @@ type Config struct {
OAuthScopes string // Authorisation scopes for OAuth
RedirectPath string // ENV DISCORD_REDIRECT_PATH: Path for the OAuth redirect handler (required)
BotToken string // ENV DISCORD_BOT_TOKEN: Token for the discord bot (required)
GuildID string // ENV DISCORD_GUILD_ID: ID for the discord server the bot should connect to (required)
}
func ConfigFromEnv() (any, error) {
@@ -23,6 +24,7 @@ func ConfigFromEnv() (any, error) {
OAuthScopes: getOAuthScopes(),
RedirectPath: env.String("DISCORD_REDIRECT_PATH", ""),
BotToken: env.String("DISCORD_BOT_TOKEN", ""),
GuildID: env.String("DISCORD_GUILD_ID", ""),
}
// Check required fields
@@ -38,6 +40,9 @@ func ConfigFromEnv() (any, error) {
if cfg.BotToken == "" {
return nil, errors.New("Envar not set: DISCORD_BOT_TOKEN")
}
if cfg.GuildID == "" {
return nil, errors.New("Envar not set: DISCORD_GUILD_ID")
}
return cfg, nil
}