config

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BotConfig

type BotConfig struct {
	CommandPrefix   string   `json:"command_prefix"`
	CommandPrefixes []string `json:"command_prefixes,omitempty"`
	PluginsDir      string   `json:"plugins_dir"`
	PluginRepo      string   `json:"plugin_repo,omitempty"`
	OwnerID         int64    `json:"owner_id,omitempty"`
	MaxMessageLen   int      `json:"max_message_len,omitempty"`
	RateLimit       int      `json:"rate_limit,omitempty"`
}

type Config

type Config struct {
	Telegram TelegramConfig `json:"telegram"`
	Bot      BotConfig      `json:"bot"`
	Logger   LoggerConfig   `json:"logger"`
	I18n     I18nConfig     `json:"i18n"`
}

func Example

func Example() *Config

func Load

func Load(path string) (*Config, error)

func (*Config) GetPrefixes

func (c *Config) GetPrefixes() []string

GetPrefixes returns all configured command prefixes.

func (*Config) GetUpdateTimeout

func (c *Config) GetUpdateTimeout() time.Duration

func (*Config) Save

func (c *Config) Save(path string) error

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if the config has required fields.

type ConfigError

type ConfigError struct {
	Errors []string
}

func (*ConfigError) Error

func (e *ConfigError) Error() string

type I18nConfig

type I18nConfig struct {
	DefaultLanguage string `json:"default_language"`
}

I18nConfig controls language behavior.

type LoggerConfig

type LoggerConfig struct {
	Level  string `json:"level"`
	Format string `json:"format"`
}

type TelegramConfig

type TelegramConfig struct {
	APIID       int    `json:"api_id"`
	APIHash     string `json:"api_hash"`
	SessionFile string `json:"session_file"`
	Database    string `json:"database_file"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL