config

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() string

DefaultPath returns the default config file path.

func Save

func Save(path string, cfg *Config) error

Save writes the config to the given path in TOML format. Parent directories are created if they don't exist.

Types

type AgendaloConfig

type AgendaloConfig struct {
	// Command is the external command (with optional args) that reads text
	// from stdin and returns JSON events.
	Command string `toml:"command"`
	// RateLimit is the max number of add interactions per sender per hour.
	RateLimit int `toml:"rate_limit"`
}

AgendaloConfig holds settings for the agendalo handler.

type Allow

type Allow struct {
	Groups []AllowEntry `toml:"groups"`
	Users  []AllowEntry `toml:"users"`
}

Allow defines the allow lists for groups and users. Empty lists mean deny all.

func (*Allow) GroupJIDs

func (a *Allow) GroupJIDs() []string

GroupJIDs returns the JID strings from the groups allow list.

func (*Allow) UserJIDs

func (a *Allow) UserJIDs() []string

UserJIDs returns the JID strings from the users allow list.

type AllowEntry

type AllowEntry struct {
	JID  string `toml:"jid"`
	Name string `toml:"name,omitempty"`
}

AllowEntry represents an allowed JID with an optional display name.

type Config

type Config struct {
	Trigger  string         `toml:"trigger"`
	LogLevel string         `toml:"log_level"`
	Allow    Allow          `toml:"allow"`
	Agendalo AgendaloConfig `toml:"agendalo"`
	Plugins  PluginsConfig  `toml:"plugins"`
}

Config represents the bot configuration.

func Load

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

Load reads and parses a TOML config file. Returns a default Config if the file does not exist.

type PluginsConfig

type PluginsConfig struct {
	// AllowedCommands is a whitelist of commands that WASM plugins can execute.
	AllowedCommands []string `toml:"allowed_commands"`
}

PluginsConfig holds settings for the WASM plugin system.

Jump to

Keyboard shortcuts

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