const Discord = require('discord.js'); const { Client, Intents } = require('discord.js'); const myIntents = new Intents(); myIntents.add(Intents.FLAGS.GUILD_PRESENCES, Intents.FLAGS.GUILD_MEMBERS); // const client = new Client({ intents: myIntents }); const client = new Client({ intents:[ Discord.Intents.FLAGS.GUILDS, Discord.Intents.FLAGS.GUILD_MEMBERS, Discord.Intents.FLAGS.GUILD_BANS, // Discord.Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS, Discord.Intents.FLAGS.GUILD_INTEGRATIONS, Discord.Intents.FLAGS.GUILD_WEBHOOKS, Discord.Intents.FLAGS.GUILD_INVITES, Discord.Intents.FLAGS.GUILD_VOICE_STATES, Discord.Intents.FLAGS.GUILD_PRESENCES, Discord.Intents.FLAGS.GUILD_MESSAGES, Discord.Intents.FLAGS.GUILD_MESSAGE_REACTIONS, Discord.Intents.FLAGS.GUILD_MESSAGE_TYPING, Discord.Intents.FLAGS.DIRECT_MESSAGES, Discord.Intents.FLAGS.DIRECT_MESSAGE_REACTIONS, Discord.Intents.FLAGS.DIRECT_MESSAGE_TYPING ] }); const prefix = '!o '; const fs = require('fs'); client.commands = new Discord.Collection(); const commandFiles = fs.readdirSync('./commands/').filter((file) => file.endsWith('.js')); for (const file of commandFiles) { const command = require(`./commands/${file}`); client.commands.set(command.name, command); } client.once('ready', () => { console.log('Omex Initiated'); let serverIn = client.guilds.cache.size; client.user.setActivity(`${serverIn} servers`, { type: 'WATCHING' }); client.user.setStatus('dnd'); }); const escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); client.on('messageCreate', (message) => { const prefixRegex = new RegExp(`^(<@!?${client.user.id}>|${escapeRegex(prefix)})\\s*`); if (!prefixRegex.test(message.content)) return; const [ , matchedPrefix ] = message.content.match(prefixRegex); const args = message.content.slice(matchedPrefix.length).trim().split(/ +/); const command = args.shift().toLowerCase(); if (!command) { client.commands.get('message').execute(message, args, Discord); } else if (command === 'admin') { client.commands.get('admin').execute(message, args, Discord); } else if (command === 'clear') { client.commands.get('clear').execute(message, args, Discord); } else if (command === 'kick') { client.commands.get('kick').execute(message, args, Discord); } else if (command === 'ban') { client.commands.get('ban').execute(message, args, Discord); } else if (command === 'avatar') { client.commands.get('avatar').execute(message, args, Discord); } else if (command === 'av') { client.commands.get('avatar').execute(message, args, Discord); } else if (command === 'unban') { client.commands.get('unban').execute(message, args, Discord); } else if (command === '8ball') { client.commands.get('8ball').execute(message, args, Discord); } else if (command === 'ping') { client.commands.get('ping').execute(message, args, Discord, client); } else if (command === 'play') { client.commands.get('play').execute(message, args, Discord); } else if (command === 'leave') { client.commands.get('leave').execute(message, args, Discord); }else if (command === 'dice') { client.commands.get('dice').execute(message, args, Discord); } // else if (command === 'test'){ // client.commands.get('test').execute(message, args, Discord); // } }); client.login(process.env.token);