'v11 TypeError: Cannot read properties of undefined (reading 'members') discord.js v11
I want to connect to discord voice channel with discord.js as a user, and it works on some accounts but there is one account that shows this error:
TypeError: Cannot read properties of undefined (reading 'members')
While using discord.js v11.
Here is my code:
const Discord = require('discord.js');
const client = new Discord.Client();
const channelId = process.env.id
client.on("ready", () => {
let channel = client.channels.cache.get(channelId);
if(!channel) return console.log("Invalid channel id");
channel.join().then(connection => {
console.log("Successfully connected");
});
});
client.login(process.env.token);
(this is the code) i am using discord.js v11.3.2
Solution 1:[1]
For one, member doesn't show up anywhere in this code snippet, and you will need to add some more code. I also noticed that at the 2nd line, channelId is spelt wrong, so that will cause an error. If you extend your code, I might be able to help. I am assuming that members is supposed to be member. So, try replacing members with member.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | FatPancake52 |
