فهرست منبع

feat(config): add identify field

ayntgl 4 سال پیش
والد
کامیت
89b622ec0d
2فایلهای تغییر یافته به همراه17 افزوده شده و 8 حذف شده
  1. 15 5
      config/general.go
  2. 2 3
      ui/app.go

+ 15 - 5
config/general.go

@@ -1,17 +1,27 @@
 package config
 
+type IdentifyConfig struct {
+	Os      string `toml:"os"`
+	Browser string `toml:"browser"`
+}
+
 type GeneralConfig struct {
-	UserAgent          string `toml:"user_agent"`
-	FetchMessagesLimit int    `toml:"fetch_messages_limit"`
-	Mouse              bool   `toml:"mouse"`
-	Timestamps         bool   `toml:"timestamps"`
+	UserAgent          string         `toml:"user_agent"`
+	FetchMessagesLimit int            `toml:"fetch_messages_limit"`
+	Mouse              bool           `toml:"mouse"`
+	Timestamps         bool           `toml:"timestamps"`
+	Identify           IdentifyConfig `toml:"identify"`
 }
 
 func newGeneralConfig() GeneralConfig {
 	return GeneralConfig{
-		UserAgent:          "Mozilla/5.0 (X11; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0",
+		UserAgent:          "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0",
 		FetchMessagesLimit: 50,
 		Mouse:              true,
 		Timestamps:         false,
+		Identify: IdentifyConfig{
+			Os:      "Linux",
+			Browser: "Firefox",
+		},
 	}
 }

+ 2 - 3
ui/app.go

@@ -54,9 +54,8 @@ func (app *App) Connect(token string) error {
 			LargeThreshold: 0,
 			Intents:        0,
 			Properties: discordgo.IdentifyProperties{
-				OS:      "Linux",
-				Browser: "Firefox",
-				Device:  "",
+				OS:      app.Config.General.Identify.Os,
+				Browser: app.Config.General.Identify.Browser,
 			},
 		}
 		app.Session.AddHandlerOnce(app.onSessionReady)