feat(config): add identify field

This commit is contained in:
ayntgl 2022-03-06 13:27:53 +04:00
parent b2d67eeacc
commit 89b622ec0d
2 changed files with 17 additions and 8 deletions

View file

@ -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",
},
}
}

View file

@ -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)