im trying to do a simple command help but Command dont have a propertie with permissions of handler

.
21 Replies
b1nzee
b1nzee•16mo ago
code and error
nacho
nachoOP•16mo ago
read title, "Command dont have a propertie with permissions of handler" i dont have code because i dont know how i can do
b1nzee
b1nzee•16mo ago
Then I can't help you
nacho
nachoOP•16mo ago
now i have this
const arg = await args.pick('string');
const command = this.container.stores.get('commands').get(arg) as PyraCommandExtends;

if (!command) {
return message.channel.send(`The specified command \`${arg}\` does not exist.`);
}

const embed = new EmbedBuilder()
.setTitle(`Command ${command.name}`)
.setDescription(command.description)
.setColor('#2B2D31')
.setTimestamp()
.setFooter({ text: 'type ;help <command> to extend help of a command specific.' })
.addFields({ name: 'Category', value: `${command.category}` })
.addFields({ name: 'Aliases', value: command.aliases.join(', ') })
.addFields({ name: 'Usages', value: `${command.usage ? command.usage : 'No Usage Provided.'}` })
.addFields({ name: 'Examples', value: `${command.examples ? command.examples.map((example: string) => `\`${example}\``).join('\n') : 'No Examples Provided.'}` });

return message.channel.send({ embeds: [embed] });

const arg = await args.pick('string');
const command = this.container.stores.get('commands').get(arg) as PyraCommandExtends;

if (!command) {
return message.channel.send(`The specified command \`${arg}\` does not exist.`);
}

const embed = new EmbedBuilder()
.setTitle(`Command ${command.name}`)
.setDescription(command.description)
.setColor('#2B2D31')
.setTimestamp()
.setFooter({ text: 'type ;help <command> to extend help of a command specific.' })
.addFields({ name: 'Category', value: `${command.category}` })
.addFields({ name: 'Aliases', value: command.aliases.join(', ') })
.addFields({ name: 'Usages', value: `${command.usage ? command.usage : 'No Usage Provided.'}` })
.addFields({ name: 'Examples', value: `${command.examples ? command.examples.map((example: string) => `\`${example}\``).join('\n') : 'No Examples Provided.'}` });

return message.channel.send({ embeds: [embed] });

nacho
nachoOP•16mo ago
but i have this error
No description
Favna
Favna•16mo ago
change addFields to addField or pass an array into addFields
b1nzee
b1nzee•16mo ago
They removed addField, but you can always extend the EmbedBuilder class (I can send the code later when on PC if needed)
nacho
nachoOP•16mo ago
what is the solution ? addField now dont exist discord.js remove that
Favna
Favna•16mo ago
then use addFields properly
const arg = await args.pick('string');
const command = this.container.stores.get('commands').get(arg) as PyraCommandExtends;

if (!command) {
return message.channel.send(`The specified command \`${arg}\` does not exist.`);
}

const embed = new EmbedBuilder()
.setTitle(`Command ${command.name}`)
.setDescription(command.description)
.setColor('#2B2D31')
.setTimestamp()
.setFooter({ text: 'type ;help <command> to extend help of a command specific.' })
.addFields(
{ name: 'Category', value: `${command.category}` },
{ name: 'Aliases', value: command.aliases.join(', ') },
{ name: 'Examples', value: `${command.examples ? command.examples.map((example: string) => `\`${example}\``).join('\n') : 'No Examples Provided.'}` }
);

return message.channel.send({ embeds: [embed] });
const arg = await args.pick('string');
const command = this.container.stores.get('commands').get(arg) as PyraCommandExtends;

if (!command) {
return message.channel.send(`The specified command \`${arg}\` does not exist.`);
}

const embed = new EmbedBuilder()
.setTitle(`Command ${command.name}`)
.setDescription(command.description)
.setColor('#2B2D31')
.setTimestamp()
.setFooter({ text: 'type ;help <command> to extend help of a command specific.' })
.addFields(
{ name: 'Category', value: `${command.category}` },
{ name: 'Aliases', value: command.aliases.join(', ') },
{ name: 'Examples', value: `${command.examples ? command.examples.map((example: string) => `\`${example}\``).join('\n') : 'No Examples Provided.'}` }
);

return message.channel.send({ embeds: [embed] });
nacho
nachoOP•16mo ago
ohh well, thats not the error i have same error
Favna
Favna•16mo ago
well then there is no way to tell from the code provided but somewhere the code you're writing is invalid and doesn't match the required input
nacho
nachoOP•16mo ago
required input of what ?
nacho
nachoOP•16mo ago
this is all code
No description
Favna
Favna•16mo ago
required input of a function you're calling also you should really remove that ts-ignore. Sapphire is perfectly TS compatible. If you get a TS error then you need to fix your own code. Regarding the above, the problem is that the type is MessageCommand.RunContext, not MessageCommand.Context as for the issue of the array validator, the problem is that you're assuming that comand.aliases always has values, which it doesnt if you do not give the command aliases. I rewrote the code in my own test bot (fixing various other bugs as well as English grammar and spelling mistakes, and stylistic improvements along the way) and then I stumbled on that issue
Favna
Favna•16mo ago
This way the command works just fine. You should also note that you do not need PyraCommandExtends at all, you do not need a custom command class just to add usage and examples properties. You can just chuck them in detailedDescription as you see here, and add that bit of lines 5-9 somewhere in your setup / module augmentation files.
Favna
Favna•16mo ago
No description
No description
nacho
nachoOP•16mo ago
the code before work with that ts-ignore
Favna
Favna•16mo ago
Doesn't mean anything, it's still wrong
nacho
nachoOP•16mo ago
well that right english grammar because its for a school project and im not know english
Favna
Favna•16mo ago
Even more reason to show off your skill and write proper English. The internet is vast beyond believe, there is hardly a reason anymore to not use some proof reading service. And with chatgpt these days that's even easier.
nacho
nachoOP•16mo ago
🫡 thank u
Want results from more Discord servers?
Add your server