From 9651934c1632cff92dbe98e88397542f242d38f6 Mon Sep 17 00:00:00 2001 From: rigormorrtiss Date: Tue, 27 Jul 2021 21:51:21 +0400 Subject: [PATCH] Modify UserAgent & Identify properties for user accounts --- discordo.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/discordo.go b/discordo.go index ba45594..54d157b 100644 --- a/discordo.go +++ b/discordo.go @@ -71,6 +71,11 @@ func onLoginModalDone(buttonIndex int, buttonLabel string) { } func newSession(email string, password string, token string) *discordgo.Session { + userAgent := "" + + "Mozilla/5.0 (X11; Linux x86_64) " + + "AppleWebKit/537.36 (KHTML, like Gecko) " + + "Chrome/91.0.4472.164 Safari/537.36" + var sess *discordgo.Session var err error if email != "" && password != "" { @@ -79,6 +84,10 @@ func newSession(email string, password string, token string) *discordgo.Session panic(err) } + sess.UserAgent = userAgent + sess.Identify.Properties.Browser = "Chrome" + sess.Identify.Properties.OS = "Linux" + sess.AddHandler(onReady) } else if token != "" { sess, err = discordgo.New(token) @@ -87,14 +96,16 @@ func newSession(email string, password string, token string) *discordgo.Session } if !strings.HasPrefix(token, "Bot ") { + sess.UserAgent = userAgent + sess.Identify.Properties.Browser = "Chrome" + sess.Identify.Properties.OS = "Linux" + sess.AddHandler(onReady) } } sess.AddHandler(onGuildCreate) sess.AddHandler(onMessageCreate) - - sess.Identify.Intents = discordgo.IntentsAllWithoutPrivileged if err = sess.Open(); err != nil { panic(err) }