He estado recibiendo este error al intentar codificar un bot de discordia en discord.js. El Bot se está utilizando para comprobar el estado de un servidor de discordia.
Error:
D:\MinecraftBot\commands\mcserver.js:13 .then((res) => res.join()) ^ TypeError: res.join is not a function at D:\MinecraftBot\commands\mcserver.js:13:28
Código en cuestión:
module.exports = { name: "mcserver", description: "Get info about a Minecraft Server", usage: "mcserver <ip>", run: async (client, message, args) => { let ip = args[0]; fetch("https://api.mcsrvstat.us/2/"+args[0]) .then((res) => res.join()) // <-------- This Line Is Producing The Error .then((body) => { if(body.online === false) { let oneembed = new discord.MessageEmbed() .setColor('RANDOM') .setAuthor("MC SERVER", message.guild.iconURL ({ dynamic: true })) .addField("Status","<a:Offline:766303914654957610>") .setTimestamp(); message.channel.send(oneembed) } else { let embed = new discord.MessageEmbed() .setColor('RANDOM') .setThumbnail(`https://mc-api.net/v3/server/favicon/${args[0]}`) .setAuthor("Mc Server", message.guild.iconURL({ dynamic: true })) .addField("Status", "<a:Online:766303827850690600>") .addField("IP", body.ip) .addField("Hostname", body.hostname) .addField("Players", `${body.players.online}/${body.players.max}`) .addField("Software", body.software) .addField("Version", body.version) .addField("Motd", `${body.motd.clean[0]}\n${body.motd.clean[1]}`) .setTimestamp() .setImage(`http://status.mclive.eu/${args[0]}/${args[0]}/25565/banner.png`) message.channel.send(embed) } }) } }
Los datos que solicita están aquí: https://api.mcsrvstat.us/2/hypixel.net