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

.
21 Replies
b1nzee
b1nzee•10mo ago
code and error
nachota
nachota•10mo 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•10mo ago
Then I can't help you
nachota
nachota•10mo 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] });

nachota
nachota•10mo ago
but i have this error
No description
Favna
Favna•10mo ago
change addFields to addField or pass an array into addFields
b1nzee
b1nzee•10mo ago
They removed addField, but you can always extend the EmbedBuilder class (I can send the code later when on PC if needed)
nachota
nachota•10mo ago
what is the solution ? addField now dont exist discord.js remove that
Favna
Favna•10mo 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] });
nachota
nachota•10mo ago
ohh well, thats not the error i have same error
Favna
Favna•10mo 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
nachota
nachota•10mo ago
required input of what ?
nachota
nachota•10mo ago
this is all code
No description
Favna
Favna•10mo 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•10mo 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•10mo ago
No description
No description
nachota
nachota•10mo ago
the code before work with that ts-ignore
Favna
Favna•10mo ago
Doesn't mean anything, it's still wrong
nachota
nachota•10mo ago
well that right english grammar because its for a school project and im not know english
Favna
Favna•10mo 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.
nachota
nachota•10mo ago
🫡 thank u