Recientemente hice un bot de filtro de palabras de discordia y me preguntaba cómo podría configurarlo por servidor. Quiero poder hacer un comando que agregue palabras para filtrar al código y quiero que las personas puedan agregar un prefijo personalizado por servidor. También quiero que las personas puedan configurar su canal de registro por servidor. ¿Alguien puede ayudarme con esto por favor? Pasé mucho tiempo en este bot y no quiero seguir haciendo más del mismo bot para diferentes servidores. Estoy usando discord.js 12.5.3. Adjuntaré mi código a continuación.
const Discord = require('discord.js'); const client = new Discord.Client(); client.once('ready', async () => { console.log('yay, the bot is online') client.user.setActivity('im real', {type: 'PLAYING'}) }) client.on('message', async message => { if(message.channel.type === 'dm' || message.author.bot) return; const logChannel = client.channels.cache.find(channel => channel.id === '921730444498726924') let words = [“bad”, “words”, “here”] let foundInText = false; for (var i in words) { if (message.content.toLowerCase().includes(words[i].toLowerCase())) foundInText = true; } if (foundInText) { let logEmbed = new Discord.MessageEmbed() .setDescription(<@${message.author.id}> Said a bad word) .addField('The Message', message.content) .setColor('RANDOM') .setTimestamp() logChannel.send(logEmbed) let embed = new Discord.MessageEmbed() .setDescription('That word is not allowed here') .setColor('RANDOM') .setTimestamp() let msg = await message.channel.send(embed); message.delete() msg.delete({timeout: '3500'}) } })Intenté seguir un tutorial pero no funcionó porque necesito uno específico para mi caso. Si alguien pudiera ayudar, sería genial.