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