client.on('guildMemberAdd', async member => {
const guild = member.guild;
// Find the verification category by name (case-insensitive)
const verificationCategory = guild.channels.cache.find(channel => channel.type === 'GUILD_CATEGORY' && channel.name.toLowerCase() === 'verification');
if (!verificationCategory) {
console.error('Verification category not found.');
return;
}
const everyoneRole = guild.roles.everyone;
try {
// Create a private channel for the user under the verification category
const channel = await guild.channels.create({
name: `verification-${member.user.username}`,
type: 'text', // Text channel
parent: verificationCategory, // Set the verification category as the parent
//More code after this but I've tested it and it works. The error only happens when trying to set the parent:
client.on('guildMemberAdd', async member => {
const guild = member.guild;
// Find the verification category by name (case-insensitive)
const verificationCategory = guild.channels.cache.find(channel => channel.type === 'GUILD_CATEGORY' && channel.name.toLowerCase() === 'verification');
if (!verificationCategory) {
console.error('Verification category not found.');
return;
}
const everyoneRole = guild.roles.everyone;
try {
// Create a private channel for the user under the verification category
const channel = await guild.channels.create({
name: `verification-${member.user.username}`,
type: 'text', // Text channel
parent: verificationCategory, // Set the verification category as the parent
//More code after this but I've tested it and it works. The error only happens when trying to set the parent: