You can split your the message into an array of words:
const args = message.content.slice(config.prefix.length).split(/ +/).slice(1)
// example: `.boosting hello people of the world`
// returns: ['hello', 'people', 'of', 'the', 'world']
So, if you’d like to get the first argument (word), you can use args[0]
. For the second, args[1]
, and so on.
You updated code:
client.on("message", (msg) => {
if (msg.content.startsWith(config.prefix + "boosting" + " " + Variable)) {
const args = message.content.slice(config.prefix.length).split(/ +/).slice(1)
const embed = new Discord.MessageEmbed()
.setColor("0xd08d11")
.setTitle("**Random Title**")
.setDescription(args[0])
.addFields(
{ name: '\u200B', value: '\u200B' }, //spacer
{ name: "Person 0", value: 'Personvalue', inline: true },
{ name: '\u200B', value: '\u200B' }, //spacer
{ name: 'Price', value: 'Pricevalue', inline: true },
{ name: '\u200B', value: '\u200B' }, //spacer
{ name: 'Person 1', value: '40k', inline: true },
{ name: 'Person 2', value: '40k', inline: true },
{ name: 'Person 3', value: '40k', inline: true },
{ name: 'Person 4', value: '40k', inline: true },
)
.setThumbnail(logo)
.setTimestamp()
.setFooter('created by me or something like that');
client.channels.cache.get(`here_is_my_channel_id`).send(embed);
}
});
client.login(config.token)