const Discord = require('discord.js') const { EmbedBuilder } = require('discord.js') const client = new Discord.Client({ intents: ['DirectMessages', 'DirectMessageTyping', 'DirectMessageReactions', 'AutoModerationConfiguration', 'AutoModerationExecution', 'GuildBans', 'GuildEmojisAndStickers', 'GuildIntegrations', 'GuildInvites', 'GuildMembers', 'GuildMessageReactions', 'GuildMessageTyping', 'GuildMessages', 'GuildMessages', 'GuildModeration', 'GuildPresences', 'GuildScheduledEvents', 'GuildVoiceStates', 'GuildWebhooks', 'Guilds', 'MessageContent'] }); const CONFIG = require('./config.json'); client.commands = new Discord.Collection(); client.commandArray = []; const fs = require("fs"); const functionFolders = fs.readdirSync(`./functions`); for (const folder of functionFolders) { const functionFiles = fs .readdirSync(`./functions/${folder}`) .filter((file) => file.endsWith(".js")) for (const file of functionFiles) require(`./functions/${folder}/${file}`)(client); } client.handleEvents(); client.handleCommands(); client.on('ready', () => { const embedReady = new EmbedBuilder() .setTitle('Estado Bot') .setDescription('Buenas!!! PerúBot se ha encendido.') .setColor('b4ff1f') .setImage(client.user.displayAvatarURL()) .setTimestamp(Date.now()) .setFooter({ text: 'El Hall de la Mena' }) client.channels.cache.get('1110588163216379925').send({embeds: [ embedReady ]}); client.user.setActivity({ name: "a el Hall de la Mena", type: Discord.ActivityType.Watching, }); }); client.on('messageCreate', async message => { if (message.member.roles.cache.has('934153864758841435') === false) { if (message.content == 'Hola') { if (message.author == 896277563171831858) { //Dhymbot message.reply({ content: "Hola mi creador <3", }) } if (message.author == 506556925329145876) { //Xaviniu message.reply({ content: "OH DIOS MÍO <@506556925329145876> HOLAAA, FOLLAMOS???", }) } if (message.author == 434788221189095425) { //Stoikas message.reply({ content: "Hey!!! <@434788221189095425>, mi Peruano Favorito!!!", }) } } else if (message.content.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").includes('perubot')) { CONFIG.perubot_count = CONFIG.perubot_count + 1; fs.writeFile('./config.json', JSON.stringify(CONFIG), (err) => { if (err) throw err;}); message.reply({ content: `PerúBot Es Real. x${CONFIG.perubot_count}`, }) } else if (message.content.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").includes('youtube')) { //Código } } }); client.on('messageDelete', (message) => { if (message.member.roles.cache.has('934153864758841435') === false) { let channel = client.channels.cache.get('1000660671043731536') const embedDelete = new EmbedBuilder() .setTitle('Mensaje Eliminado') .setAuthor({ name: `${message.author.username}`, iconURL: `${message.author.displayAvatarURL()}` }) .setDescription(`Mensaje editado en ${message.channel}\n**ID Usuario:** ${message.author.id}`) .setColor('CC0000') .setTimestamp(Date.now()) .setFooter({ text: 'El Hall de la Mena' }) .addFields( { name: 'Mensaje:', value: `${message}` } ) channel.send({embeds: [ embedDelete ]}) } }); client.login(CONFIG.token).then(() => console.log(`${client.user.username} se ha conectado`));