You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm totally new to github and have near-zero programming experience in developer role so I'm posting here.
A recent change in the Discord API breaks the swg-discord-bot. It causes server.members.get(message.author.id).displayName to return "undefined". When I debugged, I found that the bot could only see itself when it pulled a list of members from the server/guild. I learned that the discord bot now needs to define its Intent in order to access members information.
Step 1: Go to the Discord Developer Portal, Select your swg-discord-bot App, Go to the Bot tab, turn on the switch for "Server Members Intent", and save the setting.
Step 2: Update the discord.js package using npm update discord.js
Step 3: Modify the discordbot.js source to declare the Intent
Define a const "Intents" right after "Discord" const Discord = require('discord.js'); const Intents = require('discord.js');
Change the construct line to declare the Intent of the bot (I used Intents.ALL just to make it easy) //client = new Discord.Client(); client = new Discord.Client({ws:{intents:Intents.ALL}});
Hi,
I'm totally new to github and have near-zero programming experience in developer role so I'm posting here.
A recent change in the Discord API breaks the swg-discord-bot. It causes server.members.get(message.author.id).displayName to return "undefined". When I debugged, I found that the bot could only see itself when it pulled a list of members from the server/guild. I learned that the discord bot now needs to define its Intent in order to access members information.
Step 1: Go to the Discord Developer Portal, Select your swg-discord-bot App, Go to the Bot tab, turn on the switch for "Server Members Intent", and save the setting.
Step 2: Update the discord.js package using npm update discord.js
Step 3: Modify the discordbot.js source to declare the Intent
Define a const "Intents" right after "Discord"
const Discord = require('discord.js');
const Intents = require('discord.js');
Change the construct line to declare the Intent of the bot (I used Intents.ALL just to make it easy)
//client = new Discord.Client();
client = new Discord.Client({ws:{intents:Intents.ALL}});
I got the information about the Intents at the Discord.js Guide: https://discordjs.guide/popular-topics/intents.html#enabling-intents
The text was updated successfully, but these errors were encountered: