Currently in the process of learning Javascript and venturing into discord.js, I'm fully aware that the code I am working with is not up to par and requires some serious refinements.
The main objective here is to split up the arguments of a command and display them as separate lines in an embed.
For instance, if I were to execute:
!results "Result 1" "Result 2" "Result 3"
, the desired output would be formatted like a table within an embed:
RESULTS:
Result 1
Result 2
Result 3
However, my current output ends up looking like this:
View the discord screenshot here
I've tried multiple approaches after scouring Google for solutions, but it seems like the correct solution continues to elude me.
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));
// Rest of validation checks...
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!__**`)
// Adjusted fields...
return channel.send(embed);
}
}
UPDATE: Some progress has been made, featuring the latest version of the code producing this output: