I am using discord.js 14.11.0 and I am having trouble to understand how to fix the error.
index.js:
const Discord = require('discord.js');
const { Client, MessageEmbed, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.FLAGS.GUILDS, GatewayIntentBits.FLAGS.GUILD_MESSAGES, GatewayIntentBits.FLAGS.GUILD_MEMBERS] });
require('dotenv').config();
client.on('ready', () => {
console.log(`${client.user.tag} olarak giriş yaptiniz!`);
});
client.on('messageCreate', async (message) => {
if(message.content == '!massiveunban') {
const guild = client.guilds.cache.get('Cencored');
try {
guild.bans.fetch().then(async (i) => {
const ids = i.map((u) => u.user.id);
ids.forEach(async (id) => {
await guild.members.unban(id, 'Temizlik').then(async (u) => {
console.log(`Engeli acildi: ${u.tag}`);
});
})
})
} catch (error) {
console.error(error);
}
}});
client.login(process.env.TOKEN);
const client = new Client({ intents: [GatewayIntentBits.FLAGS.GUILDS, GatewayIntentBits.FLAGS.GUILD_MESSAGES, GatewayIntentBits.FLAGS.GUILD_MEMBERS] }); ^
TypeError: Cannot read properties of undefined (reading 'GUILDS')
I guess its around here but I couldn't find the problem. Could you please help me to understand where is the problem?