Update src/commands/public/help.js
This commit is contained in:
parent
891c2435b8
commit
c0cbbd61d1
1 changed files with 110 additions and 112 deletions
|
@ -1,27 +1,26 @@
|
|||
const CommandError = require('../../util/command_error');
|
||||
const sleep = require('../../util/sleep.js');
|
||||
const fixansi = require('../../util/ansi');
|
||||
const CommandError = require('../util/command_error');
|
||||
const sleep = require('../util/sleep.js');
|
||||
const fixansi = require('../util/ansi');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'help',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"heko",
|
||||
"?",
|
||||
"cmds",
|
||||
"hell",
|
||||
"hello",
|
||||
"helo",
|
||||
"commands",
|
||||
"commandshelp",
|
||||
],
|
||||
description: 'a list of the bots commands',
|
||||
usages: [
|
||||
"",
|
||||
"<command>",
|
||||
],
|
||||
},
|
||||
name: 'help',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"heko",
|
||||
"?",
|
||||
"cmds",
|
||||
"hell",
|
||||
"hello",
|
||||
"helo",
|
||||
"commands",
|
||||
"commandshelp",
|
||||
|
||||
],
|
||||
description: 'a list of the bots commands',
|
||||
usages: [
|
||||
"",
|
||||
"<command>",
|
||||
],
|
||||
execute (context) {
|
||||
const commandList = [];
|
||||
const bot = context.bot;
|
||||
|
@ -32,13 +31,13 @@ module.exports = {
|
|||
bold: false,
|
||||
color: 'gray',
|
||||
with: [
|
||||
{ color: "aqua", text: 'Public'},
|
||||
{ color: "#f5c9ce", text: 'Public'},
|
||||
{ color: "gray", text: ' | '},
|
||||
{ color: "dark_aqua", text: 'Trusted'},
|
||||
{ color: "#e25c6c", text: 'Trusted'},
|
||||
{ color: 'gray', text: ' | '},
|
||||
{ color: "blue", text: "Admin" },
|
||||
{ color: "#a31d2c", text: "Admin" },
|
||||
{ color: "gray", text: " | " },
|
||||
{ color: "dark_blue", text: 'Owner'},
|
||||
{ color: "#360a0f", text: 'Owner'},
|
||||
]
|
||||
}
|
||||
let public = [];
|
||||
|
@ -48,41 +47,41 @@ module.exports = {
|
|||
for (const command of bot.commandManager.commandlist) {
|
||||
let usagesComponent = [];
|
||||
let commandComponent = [];
|
||||
for (const usages of command.data.usages) {
|
||||
if (command?.data?.trustLevel === 1) {
|
||||
for (const usages of command.usages) {
|
||||
if (command?.trustLevel === 1) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.data.name} <trusted/admin/owner hashes>`, color: "blue" },
|
||||
{ text: `${command.name} <trusted/admin/owner hashes>`, color: "blue" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.data.trustLevel === 2) {
|
||||
} else if (command?.trustLevel === 2) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.data.name} <admin/owner hashes>`, color: "blue" },
|
||||
{ text: `${command.name} <admin/owner hashes>`, color: "blue" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.data.trustLevel === 3) {
|
||||
} else if (command?.trustLevel === 3) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.data.name} <owner hash>`, color: "blue" },
|
||||
{ text: `${command.name} <owner hash>`, color: "blue" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.data.trustLevel === 0 || command.data.trustLevel === 4) {
|
||||
} else if (command?.trustLevel === 0 || command.trustLevel === 4) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.data.name}`, color: "blue" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
{ text: `${command.name}`, color: "blue" },
|
||||
{ text: `${usages.toString().replaceAll(',','')}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
}
|
||||
|
@ -95,16 +94,16 @@ module.exports = {
|
|||
with: [
|
||||
{ text: "Command Name", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.data.name}`, color: "blue" },
|
||||
{ text: `${command.name}`, color: "blue" },
|
||||
{ text: "Aliases", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.data.aliases.toString().replaceAll(',',' ')}`, color: "blue" },
|
||||
{ text: `${command.aliases.toString().replaceAll(',',' ')}`, color: "blue" },
|
||||
{ text: "Description", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.data.description}`, color: "blue" },
|
||||
{ text: `${command.description}`, color: "blue" },
|
||||
{ text: "Trust Level", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.data.trustLevel}`, color: "gold" },
|
||||
{ text: `${command.trustLevel}`, color: "gold" },
|
||||
{ text: "Usages", color: "dark_blue" },
|
||||
{ text: "\u203a" }
|
||||
]
|
||||
|
@ -112,7 +111,7 @@ module.exports = {
|
|||
commandComponent.push("\n");
|
||||
commandComponent.push(usagesComponent);
|
||||
// for (const aliases of command.aliases) {
|
||||
if (args[0]?.toLowerCase() === command.data.name) {
|
||||
if (args[0]?.toLowerCase() === command.name) {
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`);
|
||||
} else {
|
||||
|
@ -130,174 +129,173 @@ module.exports = {
|
|||
}
|
||||
console.log(aliases)*/
|
||||
// }
|
||||
// tellraw @p {"text":"this","clickEvent":{"action":"suggest_command","value":"this"}}
|
||||
if (command.data.trustLevel === 0) {
|
||||
if (command.trustLevel === 0) {
|
||||
public.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "aqua",
|
||||
text: command.name + ' ',
|
||||
color: "#f5c9ce",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
text: `Command:${command.name}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'blue'
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
text: `${command.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
text: `${command.description}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
text: `Command Aliases: ${command.aliases}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'dark_blue',
|
||||
color: 'gray',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
action: 'run_command',
|
||||
value: `${config.prefixes[0]}${command?.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
} else if (command.data.trustLevel === 1) {
|
||||
} else if (command.trustLevel === 1) {
|
||||
trusted.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "dark_aqua",
|
||||
text: command.name + ' ',
|
||||
color: "#e25c6c",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
text: `Command:${command.name}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'blue'
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
text: `${command.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
text: `${command.description}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
text: `Command Aliases: ${command.aliases}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'dark_blue',
|
||||
color: 'gray',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
action: 'run_command',
|
||||
value: `${config.prefixes[0]}${command?.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
} else if (command.data.trustLevel === 2) {
|
||||
} else if (command.trustLevel === 2) {
|
||||
admin.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "blue",
|
||||
text: command.name + ' ',
|
||||
color: "#a31d2c",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action:"show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
text: `Command:${command.name}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'blue'
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
text: `${command.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
text: `${command.description}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
text: `Command Aliases: ${command.aliases}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'dark_blue',
|
||||
color: 'gray',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
action: 'run_command',
|
||||
value: `${config.prefixes[0]}${command?.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
} else if (command.data.trustLevel === 3) {
|
||||
} else if (command.trustLevel === 3) {
|
||||
owner.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "dark_blue",
|
||||
text: command.name + ' ',
|
||||
color: "#360a0f",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
text: `Command:${command.name}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'blue'
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
text: `${command.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
text: `${command.description}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
text: `Command Aliases: ${command.aliases}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'dark_blue',
|
||||
color: 'gray',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
action: 'run_command',
|
||||
value: `${config.prefixes[0]}${command?.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
const length = bot.commandManager.commandlist.filter(c => c.data.trustLevel != 4).length
|
||||
const length = bot.commandManager.commandlist.filter(c => c.trustLevel != 4).length
|
||||
if (bot.options.useChat) {
|
||||
bot.chat.message(bot.getMessageAsPrismarine([
|
||||
{
|
||||
|
@ -401,52 +399,52 @@ module.exports = {
|
|||
let admin = [];
|
||||
let owner = [];
|
||||
for (const command of bot.commandManager.commandlist) {
|
||||
if (args[0] === command.data.name) {
|
||||
const ansi = bot.getMessageAsPrismarine([ { text: `CommandName \u203a ${command.data.name}\n`, color: 'gray', }, { text: `Aliases \u203a ${command.data.aliases}\n`, color: 'gray', }, { text: `Description \u203a ${command.data.description}\n`, color: 'gray', }, { text: `trustLevel \u203a ${command.data.trustLevel}\n`, color: 'gray' }, { text: `Usages \u203a ${command?.data.usages}`, color: "dark_gray" }, ])?.toAnsi().replaceAll('```\u001b[9```' + '```\u001b[3```')
|
||||
if (args[0] === command.name) {
|
||||
const ansi = bot.getMessageAsPrismarine([ { text: `CommandName \u203a ${command.name}\n`, color: 'gray', }, { text: `Aliases \u203a ${command.aliases}\n`, color: 'gray', }, { text: `Description \u203a ${command.description}\n`, color: 'gray', }, { text: `trustLevel \u203a ${command.trustLevel}\n`, color: 'gray' }, { text: `Usages \u203a ${command?.usages}`, color: "dark_gray" }, ])?.toAnsi().replaceAll('```\u001b[9```' + '```\u001b[3```')
|
||||
const fix = fixansi(ansi.replaceAll('`', '`\u200b'))
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
return
|
||||
}
|
||||
if (command?.data.trustLevel === 0 && command.discordExecute) {
|
||||
if (command?.trustLevel === 0 && command.discordExecute) {
|
||||
public.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
text: command.name + ' ',
|
||||
color: "aqua",
|
||||
}
|
||||
])
|
||||
} else if (command?.data.trustLevel === 1 && command.discordExecute) {
|
||||
} else if (command?.trustLevel === 1 && command.discordExecute) {
|
||||
trusted.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
text: command.name + ' ',
|
||||
color: "dark_aqua"
|
||||
}
|
||||
])
|
||||
} else if (command?.data.trustLevel === 2 && command.discordExecute) {
|
||||
} else if (command?.trustLevel === 2 && command.discordExecute) {
|
||||
admin.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
text: command.name + ' ',
|
||||
color: 'blue'
|
||||
}
|
||||
])
|
||||
} else if (command?.data.trustLevel === 3 && command.discordExecute) {
|
||||
} else if (command?.trustLevel === 3 && command.discordExecute) {
|
||||
owner.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
text: command.name + ' ',
|
||||
color: "dark_blue",
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
const length = bot.commandManager.commandlist.filter(c => c.data.trustLevel !== 4 && c.discordExecute).length
|
||||
const length = bot.commandManager.commandlist.filter(c => c.trustLevel !== 3 && c.discordExecute).length
|
||||
const ansi1 = bot.getMessageAsPrismarine([ { text: 'Commands (', color: 'gray' }, { text: JSON.stringify(length), color: 'gold' }, { text: ') ', color: 'gray' }, category, '\n', public, trusted, owner ])?.toAnsi();
|
||||
const fix1 = fixansi(ansi1.replaceAll('`', '`\u200b'))
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix1}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
bot?.discord?.message.react('♋')
|
||||
|
|
Loading…
Reference in a new issue