Cleanup, add scheduler.

This will eventually be rolled up into the announcements subsystem.
This commit is contained in:
Benjamin A. Shelton 2026-10-23 23:27:24 -06:00
commit 0c132657ff
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01
2 changed files with 31 additions and 0 deletions

View file

@ -19,6 +19,7 @@ type Settings struct {
API *API `toml:"api"`
DailyScripture *DailyScripture `toml:"daily_scripture"`
Translations *Translations `toml:"translations"`
Scheduler *Scheduler `toml:"scheduler"`
System *System `toml:"system"`
Service *Service `toml:"service"`
Chat *Chat `toml:"chat"`
@ -79,6 +80,13 @@ type Logging struct {
Level string `toml:"level"`
}
type Scheduler struct {
Announcements struct {
Weekly string `toml:"weekly"`
Daily string `toml:"daily"`
} `toml:"announcements"`
}
type Service struct {
BotToken string `toml:"secret"`
Method string `toml:"method"`
@ -144,6 +152,15 @@ func LoadSettings(name string, fs vfs.VFS) (*Settings, error) {
Level: "info",
},
},
Scheduler: &Scheduler{
Announcements: struct {
Weekly string `toml:"weekly"`
Daily string `toml:"daily"`
}{
Weekly: "Sunday",
Daily: "30 7 * * *",
},
},
Service: &Service{
BotToken: "",
Method: "polling",
@ -159,6 +176,15 @@ func LoadSettings(name string, fs vfs.VFS) (*Settings, error) {
Active: []string{"bsb", "kjv"},
Default: "bsb",
},
Debug: &Debug{
Commands: struct {
Register bool `toml:"register"`
Reset bool `toml:"reset"`
}{
Register: true,
Reset: false,
},
},
}
file, err := fs.Open(name)
if err != nil {

View file

@ -15,6 +15,11 @@ active = [
]
default = "bsb"
[scheduler]
[scheduler.announcements]
weekly = "Sunday"
daily = "30 7 * * *"
[system]
timezone = "America/Denver"
dsn = "sqlite3:///data/biblebot.sqlite3?_journal_mode=WAL&_foreign_keys=true"