forked from pothtonswer/discordmuffin
Add use of intents to examples
This commit is contained in:
parent
eb3514551b
commit
0d776e61a1
2 changed files with 7 additions and 0 deletions
|
@ -53,6 +53,10 @@ func main() {
|
||||||
// Register guildCreate as a callback for the guildCreate events.
|
// Register guildCreate as a callback for the guildCreate events.
|
||||||
dg.AddHandler(guildCreate)
|
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.
|
// Open the websocket and begin listening.
|
||||||
err = dg.Open()
|
err = dg.Open()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -33,6 +33,9 @@ func main() {
|
||||||
// Register the messageCreate func as a callback for MessageCreate events.
|
// Register the messageCreate func as a callback for MessageCreate events.
|
||||||
dg.AddHandler(messageCreate)
|
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.
|
// Open a websocket connection to Discord and begin listening.
|
||||||
err = dg.Open()
|
err = dg.Open()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue