Selaa lähdekoodia

feat(config): add status field (#506)

Co-authored-by: ayn2op <ayn2op@mac.local>
Ayyan 1 vuosi sitten
vanhempi
sitoutus
2b151ca029
2 muutettua tiedostoa jossa 13 lisäystä ja 6 poistoa
  1. 4 0
      cmd/state.go
  2. 9 6
      internal/config/config.go

+ 4 - 0
cmd/state.go

@@ -33,6 +33,10 @@ func openState(token string, app *tview.Application, cfg *config.Config) error {
 		BrowserUserAgent: cfg.UserAgent,
 	}
 
+	gateway.DefaultPresence = &gateway.UpdatePresenceCommand{
+		Status: cfg.Status,
+	}
+
 	discordState = &State{
 		State: ningen.New(token),
 		cfg:   cfg,

+ 9 - 6
internal/config/config.go

@@ -8,15 +8,17 @@ import (
 
 	"github.com/BurntSushi/toml"
 	"github.com/ayn2op/discordo/internal/consts"
+	"github.com/diamondburned/arikawa/v3/discord"
 )
 
 type Config struct {
-	Mouse               bool   `toml:"mouse"`
-	HideBlockedUsers    bool   `toml:"hide_blocked_users"`
-	Timestamps          bool   `toml:"timestamps"`
-	ShowAttachmentLinks bool   `toml:"show_attachment_links"`
-	MessagesLimit       uint8  `toml:"messages_limit"`
-	Editor              string `toml:"editor"`
+	Mouse               bool           `toml:"mouse"`
+	HideBlockedUsers    bool           `toml:"hide_blocked_users"`
+	Timestamps          bool           `toml:"timestamps"`
+	ShowAttachmentLinks bool           `toml:"show_attachment_links"`
+	MessagesLimit       uint8          `toml:"messages_limit"`
+	Editor              string         `toml:"editor"`
+	Status              discord.Status `toml:"status"`
 
 	Browser        string `toml:"browser"`
 	BrowserVersion string `toml:"browser_version"`
@@ -36,6 +38,7 @@ func defaultConfig() *Config {
 		MessagesLimit:       50,
 		Editor:              "default",
 		TimestampsFormat:    time.Kitchen,
+		Status:              discord.OnlineStatus,
 
 		Browser:        consts.Browser,
 		BrowserVersion: consts.BrowserVersion,