Only add intents for bot accounts

This commit is contained in:
rigormorrtiss 2021-07-20 15:51:44 +04:00
parent 760b29fa29
commit 5bf51ebf67

View file

@ -103,11 +103,15 @@ func newSession(email string, password string, token string) *session.Session {
panic(err)
}
sess.AddHandler(onGuildCreate)
if strings.HasPrefix(token, "Bot ") {
sess.Gateway.AddIntents(gateway.IntentGuilds)
sess.Gateway.AddIntents(gateway.IntentGuildMessages)
} else {
sess.AddHandler(onReady)
}
}
sess.AddHandler(onGuildCreate)
sess.AddHandler(onMessageCreate)
if err = sess.Open(); err != nil {
panic(err)