Issue with making a Dynamic Help Command

Some issue with .addFields?
11 Replies
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
UnknownPerson
UnknownPersonOPβ€’2y ago
Error:
ExpectedConstraintError > s.number.lessThanOrEqual
Invalid number value
Expected: expected <= 25
Received:
| NaN

at Object.run (/home/runner/FallenBot/node_modules/@sapphire/shapeshift/dist/index.js:702:72)
at /home/runner/FallenBot/node_modules/@sapphire/shapeshift/dist/index.js:113:66
at Array.reduce (<anonymous>)
at NumberValidator.parse (/home/runner/FallenBot/node_modules/@sapphire/shapeshift/dist/index.js:113:29)
at validateFieldLength (/home/runner/FallenBot/node_modules/@discordjs/builders/dist/index.js:133:24)
at EmbedBuilder.addFields (/home/runner/FallenBot/node_modules/@discordjs/builders/dist/index.js:243:5)
at Object.run (/home/runner/FallenBot/slashCommands/info/help.js:23:10)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
ExpectedConstraintError > s.number.lessThanOrEqual
Invalid number value
Expected: expected <= 25
Received:
| NaN

at Object.run (/home/runner/FallenBot/node_modules/@sapphire/shapeshift/dist/index.js:702:72)
at /home/runner/FallenBot/node_modules/@sapphire/shapeshift/dist/index.js:113:66
at Array.reduce (<anonymous>)
at NumberValidator.parse (/home/runner/FallenBot/node_modules/@sapphire/shapeshift/dist/index.js:113:29)
at validateFieldLength (/home/runner/FallenBot/node_modules/@discordjs/builders/dist/index.js:133:24)
at EmbedBuilder.addFields (/home/runner/FallenBot/node_modules/@discordjs/builders/dist/index.js:243:5)
at Object.run (/home/runner/FallenBot/slashCommands/info/help.js:23:10)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Code:
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ApplicationCommandType, ButtonStyle } = require('discord.js');
const _ = require('lodash');
const fs = require('fs')

module.exports = {
name: 'help',
description: "List the bot's commands",
module: 'info',
cooldown: 3000,
run: async (client, interaction) => {
await interaction.deferReply();
let client1 = await client
let commands = await client1.slashCommands
const embed = new EmbedBuilder()
.setTitle('Command List')
.setDescription(`Here is a list of our current commands:`)
.setColor('#03fcdb')
.setTimestamp()
.setThumbnail(client.user.displayAvatarURL())
.setFooter({ text: client.user.tag })
for (const command of commands) {
embed.addFields(
{ name: `${command.name}`, value: `${command.description}`, },
);
}
return interaction.editReply({ embeds: [embed] })
}
};
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ApplicationCommandType, ButtonStyle } = require('discord.js');
const _ = require('lodash');
const fs = require('fs')

module.exports = {
name: 'help',
description: "List the bot's commands",
module: 'info',
cooldown: 3000,
run: async (client, interaction) => {
await interaction.deferReply();
let client1 = await client
let commands = await client1.slashCommands
const embed = new EmbedBuilder()
.setTitle('Command List')
.setDescription(`Here is a list of our current commands:`)
.setColor('#03fcdb')
.setTimestamp()
.setThumbnail(client.user.displayAvatarURL())
.setFooter({ text: client.user.tag })
for (const command of commands) {
embed.addFields(
{ name: `${command.name}`, value: `${command.description}`, },
);
}
return interaction.editReply({ embeds: [embed] })
}
};
@Myth 🌈 Any chance that helps?
MrMythical
MrMythicalβ€’2y ago
uh could you run npm ls @discordjs/builders
UnknownPerson
UnknownPersonOPβ€’2y ago
sure can
MrMythical
MrMythicalβ€’2y ago
Send the full output
UnknownPerson
UnknownPersonOPβ€’2y ago
discordjs-v14-bot-dev-version@1.0.0 /home/runner/FallenBot
└─┬ discord.js@14.0.0-dev.1653091711-fdeac9d
└── @discordjs/builders@0.14.0-dev.1653091712-fdeac9d
discordjs-v14-bot-dev-version@1.0.0 /home/runner/FallenBot
└─┬ discord.js@14.0.0-dev.1653091711-fdeac9d
└── @discordjs/builders@0.14.0-dev.1653091712-fdeac9d
That look right?
MrMythical
MrMythicalβ€’2y ago
you have an old dev version A really old one
UnknownPerson
UnknownPersonOPβ€’2y ago
How would I update that? Sorry
Kinect3000
Kinect3000β€’2y ago
I don’t think that one supports rest param for addFields
MrMythical
MrMythicalβ€’2y ago
npm i discord.js@latest
UnknownPerson
UnknownPersonOPβ€’2y ago
I appreciate that, let me do that I have other issues now but this should help, thanks This ticket can be closed.
Want results from more Discord servers?
Add your server