Add use of intents to examples

This commit is contained in:
Carson Hoffman 2020-07-18 11:57:24 -04:00
parent eb3514551b
commit 0d776e61a1
No known key found for this signature in database
GPG key ID: 05B660CB452C657F
2 changed files with 7 additions and 0 deletions

View file

@ -53,6 +53,10 @@ func main() {
// Register guildCreate as a callback for the guildCreate events.
dg.AddHandler(guildCreate)
// We need information about guilds (which includes their channels),
// messages and voice states.
dg.Identify.Intents = discordgo.MakeIntent(discordgo.IntentsGuilds | discordgo.IntentsGuildMessages | discordgo.IntentsGuildVoiceStates)
// Open the websocket and begin listening.
err = dg.Open()
if err != nil {

View file

@ -33,6 +33,9 @@ func main() {
// Register the messageCreate func as a callback for MessageCreate events.
dg.AddHandler(messageCreate)
// In this example, we only care about receiving message events.
dg.Identify.Intents = discordgo.MakeIntent(discordgo.IntentsGuildMessages)
// Open a websocket connection to Discord and begin listening.
err = dg.Open()
if err != nil {