First Commit

This commit is contained in:
ast-ak47
2026-05-18 00:27:27 +09:00
parent a8bf6ffbca
commit d4b55a17a0
9 changed files with 548 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
package config
import (
"log"
"os"
"github.com/goccy/go-yaml"
)
type Config struct {
Discord struct {
Token string
Status string
Channel string
}
}
const configFile = "./config.yaml"
var CurrentConfig Config
func init() {
file, err := os.ReadFile(configFile)
if err != nil {
log.Fatal("Config load failed: ", err)
}
err = yaml.Unmarshal(file, &CurrentConfig)
if err != nil {
log.Fatal("Config parse failed: ", err)
}
//verify
if CurrentConfig.Discord.Token == "" {
log.Fatal("Token is empty")
}
}