Add bot command settings.
This commit is contained in:
parent
03886013cb
commit
7ccf2b2073
2 changed files with 29 additions and 5 deletions
|
|
@ -22,6 +22,7 @@ type Settings struct {
|
||||||
System *System `toml:"system"`
|
System *System `toml:"system"`
|
||||||
Service *Service `toml:"service"`
|
Service *Service `toml:"service"`
|
||||||
Chat *Chat `toml:"chat"`
|
Chat *Chat `toml:"chat"`
|
||||||
|
Debug *Debug `toml:"debug"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reload previously loaded configuration.
|
// Reload previously loaded configuration.
|
||||||
|
|
@ -69,13 +70,19 @@ type DailyScripture struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type System struct {
|
type System struct {
|
||||||
TimeZone string `toml:"timezone"`
|
TimeZone string `toml:"timezone"`
|
||||||
DSN string `toml:"dsn"`
|
DSN string `toml:"dsn"`
|
||||||
|
Logging *Logging `toml:"logging"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Logging struct {
|
||||||
|
Level string `toml:"level"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Service struct {
|
type Service struct {
|
||||||
Method string `toml:"method"`
|
BotToken string `toml:"secret"`
|
||||||
Webhook *Webhook `toml:"webhook"`
|
Method string `toml:"method"`
|
||||||
|
Webhook *Webhook `toml:"webhook"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Webhook struct {
|
type Webhook struct {
|
||||||
|
|
@ -94,6 +101,15 @@ type Translations struct {
|
||||||
Active []string `toml:"active"`
|
Active []string `toml:"active"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Debug struct {
|
||||||
|
Commands struct {
|
||||||
|
// Resets the command list by deleting all existing commands.
|
||||||
|
Reset bool `toml:"reset"`
|
||||||
|
// Clears the bot's commands and doesn't re-add them.
|
||||||
|
Clear bool `toml:"clear"`
|
||||||
|
} `toml:"commands"`
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Settings) Marshal() ([]byte, error) {
|
func (c *Settings) Marshal() ([]byte, error) {
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,11 @@ active = [
|
||||||
[system]
|
[system]
|
||||||
timezone = "America/Denver"
|
timezone = "America/Denver"
|
||||||
dsn = "sqlite3:///data/biblebot.sqlite3?_journal_mode=WAL&_foreign_keys=true"
|
dsn = "sqlite3:///data/biblebot.sqlite3?_journal_mode=WAL&_foreign_keys=true"
|
||||||
|
[system.logging]
|
||||||
|
level = "info"
|
||||||
|
|
||||||
[service]
|
[service]
|
||||||
|
secret = ""
|
||||||
method = "polling" # or "webhook"
|
method = "polling" # or "webhook"
|
||||||
[service.webhook]
|
[service.webhook]
|
||||||
uri = "https://example.com/bot"
|
uri = "https://example.com/bot"
|
||||||
|
|
@ -25,4 +28,9 @@ method = "polling" # or "webhook"
|
||||||
host = "::"
|
host = "::"
|
||||||
|
|
||||||
[chat]
|
[chat]
|
||||||
channels = []
|
channels = []
|
||||||
|
|
||||||
|
[debug]
|
||||||
|
[debug.commands]
|
||||||
|
reset = true
|
||||||
|
clear = true
|
||||||
Loading…
Reference in a new issue