2023-12-17 14:55:27 -05:00
const CommandError = require ( '../CommandModules/command_error' )
module . exports = {
name : 'help' ,
aliases : [ 'heko' , 'cmd' , '?' , 'commands' , 'cmds' ] ,
description : [ 'shows the command list' ] ,
2023-12-20 11:54:03 -05:00
trustLevel : 0 ,
2023-12-17 14:55:27 -05:00
async execute ( context ) {
const bot = context . bot
const commandList = [ ]
const source = context . source
const args = context . arguments
const cmd = {
translate : '[%s] ' ,
bold : false ,
color : 'white' ,
with : [
{ color : 'blue' , text : 'Help Cmd' } ,
]
}
const category = {
translate : ' (%s%s%s%s%s) ' ,
bold : false ,
color : 'white' ,
with : [
{ color : 'green' , text : 'Public' } ,
{ color : 'white' , text : ' | ' } ,
{ color : 'red' , text : 'Trusted' } ,
{ color : 'white' , text : ' | ' } ,
{ color : 'dark_red' , text : 'Owner' } ,
]
}
if ( args [ 0 ] ) {
let valid
for ( const fard in bot . commandManager . amogus ) { // i broke a key woops
const command = bot . commandManager . amogus [ fard ]
if ( args [ 0 ] . toLowerCase ( ) === command . name )
// if (args[0].toLowerCase() === command.aliases)
2023-12-20 11:54:03 -05:00
{ //text:`Trust Level: `,color:'white'},
//{text:`${command.trustLevel}\n`,color:'red'},
2023-12-17 14:55:27 -05:00
valid = true
source . sendFeedback ( [ cmd , ` Description: ${ command . description } ` ] )
2023-12-20 11:54:03 -05:00
source . sendFeedback ( [ cmd , { text : ` Trust Level: ${ command . trustLevel } ` } ] )
2023-12-17 14:55:27 -05:00
source . sendFeedback ( [ cmd , ` aliases: ${ command . aliases } ` ] )
break
} else valid = false
}
//source is defined btw
//source.sendFeedback([cmd, 'This command is ' + valid + ' to this for loop'])
if ( valid ) {
} else {
const args = context . arguments
2023-12-24 12:11:42 -05:00
source . sendFeedback ( [ cmd , { translate : ` Unknown command %s. Type " ${ bot . options . commands . MainPrefix } help" for help or click on this for the command ` , color : 'red' , with : [ args [ 0 ] ] , clickEvent : bot . options . Core . customName ? { action : 'suggest_command' , value : ` ${ bot . options . commands . MainPrefix } help ` } : undefined } ] )
2023-12-17 14:55:27 -05:00
// bot.tellraw([cmd, {translate: `Unknown command %s. Type "${bot.options.commands.prefix}help" for help or click on this for the command`, with: [args[0]], clickEvent: bot.options.Core.customName ? { action: 'suggest_command', value: `${bot.options.commands.prefix}help`, color:'red' } : undefined}])
} //i will add the descriptions reading as tests and action add the descriptions for the commands after
const length = context . bot . commandManager . amogus . length // ok
//i guess i did delete smh woops
//context.source.sendFeedback([cmd, 'Commands (', length, ') ', category, ...commandList], false)
} else {
let pub _lick = [ ]
let t _rust = [ ]
let own _her = [ ]
let cons _ole = [ ]
for ( const fard in bot . commandManager . amogus ) {
const command = bot . commandManager . amogus [ fard ]
// if (command.consoleOnly == true) return console.log(command);
2023-12-20 11:54:03 -05:00
if ( command . trustLevel === 3 ) {
2023-12-17 14:55:27 -05:00
cons _ole . push (
{
text : command . name + ' ' ,
color : 'blue' ,
translate : "" ,
hoverEvent : {
action : "show_text" ,
value : [
{
text : ` Command: ${ command . name } \n ` ,
color : 'white'
} , {
text : "HashOnly:" ,
color : 'white' } ,
{ text : ` ${ command . hashOnly } \n ` , color : 'red' } ,
{ text : 'consoleOnly:' , color : 'white' } ,
{ text : ` ${ command . consoleOnly && ! context . console } \n ` , color : 'red' } ,
{ text : ` ${ command . description } \n ` , color : 'white' } ,
{ text : ` Command Aliases: ${ command . aliases } \n ` , color : 'white' } ,
{ text : 'click on me to use me :)' } ,
]
}
}
) // copypasted from below, and removed stuff that wont work in the console
}
else
2023-12-20 11:54:03 -05:00
if ( command . trustLevel === 2 ) {
2023-12-17 14:55:27 -05:00
own _her . push (
{
text : command . name + ' ' ,
color : 'dark_red' ,
translate : "" ,
hoverEvent : {
action : "show_text" ,
value : [
{
text : ` Command: ${ command . name } \n ` ,
color : 'white'
2023-12-20 11:54:03 -05:00
} , { text : ` Trust Level: ` , color : 'white' } ,
{ text : ` ${ command . trustLevel } \n ` , color : 'dark_red' } ,
{ text : ` ${ command . description } \n ` , color : 'white' } ,
2023-12-17 14:55:27 -05:00
{ text : ` Command Aliases: ${ command . aliases } \n ` , color : 'white' } ,
{ text : 'click on me to use me :)' } ,
]
} , clickEvent : {
2023-12-24 12:11:42 -05:00
action : "run_command" , value : ` ${ bot . options . commands . MainPrefix } ${ command . name } `
2023-12-17 14:55:27 -05:00
} ,
// ${command.name}\nhashOnly:§c${command.hashOnly}§r\nconsoleOnly:§c${command.consoleOnly && !context.console}§r\n${command.description}
///tellraw @a {"translate":"","hoverEvent":{"action":"show_text","value":[{"text":""},{"text":""}]},"clickEvent":{"action":"run_command","value":"a"}}
clickEvent : command . name ? { action : 'suggest_command' , value : ` ~ ${ command . name } ` } : undefined ,
}
) //my w
}
// let valid
2023-12-20 11:54:03 -05:00
else if ( command . trustLevel === 1 ) {
2023-12-17 14:55:27 -05:00
t _rust . push (
{
text : command . name + ' ' ,
color : 'red' ,
translate : "" ,
hoverEvent : {
action : "show_text" ,
value : [
{
text : ` Command: ${ command . name } \n ` ,
color : 'white'
2023-12-20 11:54:03 -05:00
} , { text : ` Trust Level: ` , color : 'white' } ,
{ text : ` ${ command . trustLevel } \n ` , color : 'red' } , { text : ` ${ command . description } \n ` , color : 'white' } ,
2023-12-17 14:55:27 -05:00
{ text : ` Command Aliases: ${ command . aliases } \n ` , color : 'white' } ,
{ text : 'click on me to use me :)' } ,
]
} , clickEvent : {
2023-12-24 12:11:42 -05:00
action : "run_command" , value : ` ${ bot . options . commands . MainPrefix } ${ command . name } `
2023-12-17 14:55:27 -05:00
} ,
// ${command.name}\nhashOnly:§c${command.hashOnly}§r\nconsoleOnly:§c${command.consoleOnly && !context.console}§r\n${command.description}
///tellraw @a {"translate":"","hoverEvent":{"action":"show_text","value":[{"text":""},{"text":""}]},"clickEvent":{"action":"run_command","value":"a"}}
// clickEvent: command.name ? { action: 'suggest_command', value: `~${command.name}` },
}
)
//my w
}
2023-12-20 11:54:03 -05:00
else if ( command . trustLevel === 0 ) {
2023-12-17 14:55:27 -05:00
pub _lick . push (
{
text : command . name + ' ' ,
color : 'green' ,
translate : "" ,
hoverEvent : {
action : "show_text" , // Welcome to Kaboom!\n > Free OP - Anarchy - Creative (frfr)
value : [
{
text : ` Command: ${ command . name } \n ` ,
color : 'white'
} , {
2023-12-24 12:11:42 -05:00
text : ` Trust Level: ` , color : 'white' } ,
2023-12-20 11:54:03 -05:00
{ text : ` ${ command . trustLevel } \n ` , color : 'red' } ,
2023-12-17 14:55:27 -05:00
{ text : ` ${ command . description } \n ` , color : 'white' } ,
{ text : ` Command Aliases: ${ command . aliases } \n ` , color : 'white' } ,
{ text : 'click on me to use me :)' } ,
]
} , clickEvent : {
2023-12-24 12:11:42 -05:00
action : "suggest_command" , value : ` ${ bot . options . commands . MainPrefix } ${ command . name } ` }
2023-12-17 14:55:27 -05:00
} )
// copypasted from below, and removed stuff that wont work in the console
}
//{command.consoleOnly && !source.sources.console
//${command.description}
// for (const command of context.bot.commandManager.getCommands()) {
// if (command.consoleOnly && !context.console) continue
}
// console.log(pub_lick)
// console.log(t_rust)
// i could do context.source.sources.console
// but i want to do it like this
// if its buggy change to that
const isConsole = context . source . player ? false : true
if ( isConsole ) {
// mabe idk
const length = context . bot . commandManager . amogus . length
context . source . sendFeedback ( [ cmd , 'Commands (' , length , ') ' , category , ... pub _lick , t _rust , own _her , cons _ole ] , false )
} else {
2023-12-20 11:54:03 -05:00
const length = context . bot . commandManager . amogus . filter ( c => c . trustLevel != 3 ) . length
//trustlevel
2023-12-17 14:55:27 -05:00
context . source . sendFeedback ( [ cmd , 'Commands (' , length , ') ' , category , ... pub _lick , t _rust , own _her ] , false )
// bot.tellraw([own_her])
//console.log(t_rust)
} //
}
}
}