mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix help command
This commit is contained in:
@@ -25,18 +25,16 @@ module.exports = class HelpCommand extends Command {
|
||||
|
||||
async run(msg, { command }) {
|
||||
if (!command) {
|
||||
const embed = new MessageEmbed()
|
||||
.setTitle('Command List')
|
||||
.setColor(0x00AE86);
|
||||
const embed2 = new MessageEmbed()
|
||||
.setTitle('Command List (2)')
|
||||
.setColor(0x00AE86);
|
||||
const embed3 = new MessageEmbed()
|
||||
.setTitle('Command List (3)')
|
||||
.setColor(0x00AE86);
|
||||
const embeds = [];
|
||||
for (let i = 0; i < Math.ceil(this.client.registry.groups.size / 10); i++) {
|
||||
const embed = new MessageEmbed()
|
||||
.setTitle(`Command List (${i + 1})`)
|
||||
.setColor(0x00AE86);
|
||||
embeds.push(embed);
|
||||
}
|
||||
let cmdCount = 0;
|
||||
let i = 0;
|
||||
const thirdGroup = Math.ceil(this.client.registry.groups.size / 3);
|
||||
let embedIndex = 0;
|
||||
for (const group of this.client.registry.groups.values()) {
|
||||
i++;
|
||||
const owner = this.client.isOwner(msg.author);
|
||||
@@ -47,33 +45,15 @@ module.exports = class HelpCommand extends Command {
|
||||
});
|
||||
if (!commands.size) continue;
|
||||
cmdCount += commands.size;
|
||||
if (i < thirdGroup) {
|
||||
embed.addField(
|
||||
`❯ ${group.name}`,
|
||||
commands.map(cmd => `\`${cmd.name}\``).join(', ')
|
||||
);
|
||||
} else if (i < thirdGroup * 2) {
|
||||
embed2.addField(
|
||||
`❯ ${group.name}`,
|
||||
commands.map(cmd => `\`${cmd.name}\``).join(', ')
|
||||
);
|
||||
} else {
|
||||
embed3.addField(
|
||||
`❯ ${group.name}`,
|
||||
commands.map(cmd => `\`${cmd.name}\``).join(', ')
|
||||
);
|
||||
}
|
||||
}
|
||||
if (cmdCount === this.client.registry.commands.size) {
|
||||
embed3.setFooter(`${this.client.registry.commands.size} Commands`);
|
||||
} else {
|
||||
embed3.setFooter(`${this.client.registry.commands.size} Commands (${cmdCount} Shown)`);
|
||||
if (i > (embedIndex * 10) + 10) embedIndex++;
|
||||
embeds[embedIndex].addField(`❯ ${group.name}`, commands.map(cmd => `\`${cmd.name}\``).join(' '));
|
||||
}
|
||||
const allShown = cmdCount === this.client.registry.commands.size;
|
||||
embeds[embeds.length - 1]
|
||||
.setFooter(`${this.client.registry.commands.size} Commands${allShown ? '' : ` (${cmdCount} Shown)`}`);
|
||||
try {
|
||||
const msgs = [];
|
||||
msgs.push(await msg.direct({ embed }));
|
||||
msgs.push(await msg.direct({ embed: embed2 }));
|
||||
msgs.push(await msg.direct({ embed: embed3 }));
|
||||
for (const embed of embeds) msgs.push(await msg.direct({ embed }));
|
||||
if (msg.channel.type !== 'dm') msgs.push(await msg.say('📬 Sent you a DM with information.'));
|
||||
return msgs;
|
||||
} catch {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "119.19.1",
|
||||
"version": "119.19.2",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user