Hice un bot con algo de ayuda, soy un nuevo desarrollador, así que no sé mucho. Pero cuando hago $redeemkey 12345678 parece funcionar (el bot responde y la consola dice "verdadero") Pero una parte no funciona. La parte donde elimina el argumento del archivo txt. Cualquier ayuda es apreciada aquí está mi script:
if (command === '$redeemkey') { const fs = require('fs') const haspath = `whitelisted/${message.author.id}.txt`; if (fs.existsSync(haspath)) return message.reply({ embeds: [ new MessageEmbed() .setColor('RED') .setDescription(`You're already whitelisted!`) ] }); fs.readFile('notredeemed.txt', function (err, data) { if (data.toString().match(new RegExp(`^${args[0]}$`, "m"))) { const match = new RegExp(`(\n|^)${args[0]}(\r|$)`) const newFile = data.toString().replace(match, '') fs.writeFile('notredeemed.txt', newFile, "utf8", function (err) { if (err) return console.log(err) console.log("true") }) } }) }¡Gracias!