Documentation
¶
Index ¶
Constants ¶
View Source
const FileName = "config.json"
FileName is the config file inside the data home.
Variables ¶
View Source
var BotTokenRe = regexp.MustCompile(`^[0-9]{5,20}:[A-Za-z0-9_-]{30,}$`)
BotTokenRe matches a @BotFather token: numeric bot id, colon, secret.
Functions ¶
func CommandName ¶ added in v0.1.1
func CommandName() string
CommandName is the shell command this instance was registered under. The installer's wrapper exports PAPERVALET_CMD; a bare binary falls back to its own file name.
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 Default ¶ added in v0.1.1
func Default() *Config
Default returns the config initialize writes for a fresh instance.
func (*Config) GetPrefixes ¶
GetPrefixes returns all configured command prefixes.
func (*Config) GetUpdateTimeout ¶
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 TelegramConfig ¶
type TelegramConfig struct {
APIID int `json:"api_id"`
APIHash string `json:"api_hash"`
SessionFile string `json:"session_file"`
Database string `json:"database_file"`
// BotToken logs in the companion bot that hosts settings panels.
BotToken string `json:"bot_token"`
BotSessionFile string `json:"bot_session_file,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.