I'm still learning Javascript and such, getting into discord.js so I'm pretty sure the code I'm inputting is absolutely wrong and definitely in need of work.
Essentially what I'm looking to do is split up a command's arguments and separate them into new lines of an embed.
For example, if I was to do: !results Result 1 Result 2 Result 3
it would output into an embed like table:
RESULTS:
Result 1
Result 2
Result 3
Instead, my output keeps coming out as:
Image of what happens in discord
I have tried various different things from searching on google, but I can't seem to find the thing that I need.
const { RichEmbed } = require(discord.js);
module.exports = {
name: results,
category: info,
description: posts results in embed,
usage: <mention, id>,
run: async (client, message, args) => {
if (message.deletable) message.delete();
let [result1, result2, result3, result4, result5, result6, result7] = args;
if (!args[0])
return message.channel.send(Please provide Result 1.).then(m => m.delete(5000));
if (!args[1])
return message.channel.send(Please provide Result 2.).then(m => m.delete(5000));
if (!args[2])
return message.channel.send(Please provide Result 3.).then(m => m.delete(5000));
if (!args[3])
return message.channel.send(Please provide Result 4.).then(m => m.delete(5000));
if (!args[4])
return message.channel.send(Please provide Result 5.).then(m => m.delete(5000));
if (!args[5])
return message.channel.send(Please provide Result 6.).then(m => m.delete(5000));
if (!args[6])
return message.channel.send(Please provide Result 7.).then(m => m.delete(5000));
const channel = message.guild.channels.find(c => c.name === cards)
if (!channel)
return message.channel.send(Couldn't find a `#cards` channel).then(m => m.delete(5000));
const embed = new RichEmbed()
.setColor(RANDOM)
.setTimestamp()
.setAuthor(Posted by GM:, (message.author.username, message.author.displayAvatarURL))
.setTitle(**TestTitle**)
.setFooter(message.guild.name, message.guild.iconURL)
.setDescription(`**__Results!__**`)
.addField(`**> Result 1:** ${result1}`)
.addField(`**> Result 2:** ${result2}`)
.addField(`**> Result 3:** ${result3}`)
.addField(`**> Result 4:** ${result4}`)
.addField(`**> Result 5:** ${result5}`)
.addField(`**> Result 6:** ${result6}`)
.addField(`**> Result 7:** ${result7}`);
return channel.send(embed);
}
}
EDIT: I have made some progress, this is the most recent code and this is the output: