|
@@ -21,7 +21,6 @@ type (
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Identify struct {
|
|
Identify struct {
|
|
|
- Status discord.Status `toml:"status"`
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Notifications struct {
|
|
Notifications struct {
|
|
@@ -39,6 +38,8 @@ type (
|
|
|
Mouse bool `toml:"mouse"`
|
|
Mouse bool `toml:"mouse"`
|
|
|
Editor string `toml:"editor"`
|
|
Editor string `toml:"editor"`
|
|
|
|
|
|
|
|
|
|
+ Status discord.Status `toml:"status"`
|
|
|
|
|
+
|
|
|
Markdown bool `toml:"markdown"`
|
|
Markdown bool `toml:"markdown"`
|
|
|
HideBlockedUsers bool `toml:"hide_blocked_users"`
|
|
HideBlockedUsers bool `toml:"hide_blocked_users"`
|
|
|
ShowAttachmentLinks bool `toml:"show_attachment_links"`
|
|
ShowAttachmentLinks bool `toml:"show_attachment_links"`
|
|
@@ -87,21 +88,25 @@ func Load(path string) (*Config, error) {
|
|
|
"err",
|
|
"err",
|
|
|
err,
|
|
err,
|
|
|
)
|
|
)
|
|
|
- return &cfg, nil
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- return nil, fmt.Errorf("failed to open config file: %w", err)
|
|
|
|
|
- }
|
|
|
|
|
- defer file.Close()
|
|
|
|
|
-
|
|
|
|
|
- if _, err := toml.NewDecoder(file).Decode(&cfg); err != nil {
|
|
|
|
|
- return nil, fmt.Errorf("failed to decode config: %w", err)
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return nil, fmt.Errorf("failed to open config file: %w", err)
|
|
|
|
|
+ }
|
|
|
|
|
+ defer file.Close()
|
|
|
|
|
+
|
|
|
|
|
+ if _, err := toml.NewDecoder(file).Decode(&cfg); err != nil {
|
|
|
|
|
+ return nil, fmt.Errorf("failed to decode config: %w", err)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // set defaults
|
|
|
if cfg.Editor == "default" {
|
|
if cfg.Editor == "default" {
|
|
|
cfg.Editor = os.Getenv("EDITOR")
|
|
cfg.Editor = os.Getenv("EDITOR")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if cfg.Status == "default" {
|
|
|
|
|
+ cfg.Status = ""
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return &cfg, nil
|
|
return &cfg, nil
|
|
|
}
|
|
}
|