make v5.0.7 #4

Closed
opened 2024-03-19 17:00:31 -04:00 by aaa · 12 comments
Collaborator

add stuff yay

add stuff yay
Owner

restore it possible

restore it possible
Owner

v5.0.7's help commands


const CommandError = require('../CommandModules/command_error')

module.exports = {
  name: 'help',
  aliases:['heko', 'cmd', '?', 'commands', 'cmds' ],
  description:['shows the command list or the usage of a command'],
        trustLevel: 0,
usage:'[COMMAND]',
 async execute (context) {
   const bot = context.bot
    const commandList = []
  const source = context.source
  const args = context.arguments
const {EmbedBuilder } = require('discord.js')
//  const amogus = bot.prefix
       const ChatMessage = require('prismarine-chat')(bot.options.version)
const CommandManager = bot.commandManager
        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: `${bot.options.commands.help.pub_lickColor}`, text: 'Public'},
           { color: 'white', text: ' | '},
        { color: `${bot.options.commands.help.t_rustedColor}`, text: 'Trusted'},
           { color: 'white', text: ' | '},   
        { color: `${bot.options.commands.help.own_herColor}`, text: 'Owner'},
              ]
    }
   
      if (args[0]) {
        let valid
        for (const commands in bot.commandManager.commandlist) { // i broke a key woops
          const command = bot.commandManager.commandlist[commands]
          
          if (args[0].toLowerCase() === command.name)


         
           {
                    function sleep(ms) {
  return new Promise((resolve) => setTimeout(resolve, ms));
}//bot.getMessageAsPrismarine([cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole])?.toAnsi()
                  
            valid = true
            if(source.sources.console){
                    bot.console.info(bot.getMessageAsPrismarine([cmd, {text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'#00ffff'},{text:`${command.aliases}${command.description}`,color:'dark_purple'}])?.toAnsi())
     
bot.console.info(bot.getMessageAsPrismarine([cmd,{text:`Trust Level: `,color:'#00ffff'},{text:`${command.trustLevel}`,color:'dark_purple'}])?.toAnsi())
                   
                    bot.console.info(bot.getMessageAsPrismarine([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])?.toAnsi())
            }else if(!bot.options.Core.enabled && !source.sources.console){
               bot.chat(ChatMessage.fromNotch([cmd, `Description: ${command.description}`]).toMotd().replaceAll('§', '&'))
            await sleep(1000)
                    bot.chat(ChatMessage.fromNotch([cmd, {text:`Trust Level: ${command.trustLevel}`}]).toMotd().replaceAll('§', '&'))//[cmd, {text:`Trust Level: ${command.trustLevel}`}]
                    await sleep(1000)
                    bot.chat(ChatMessage.fromNotch([cmd, `aliases: ${command.aliases}`]).toMotd().replaceAll('§', '&'))
            }else{

source.sendFeedback([cmd, {text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'#00ffff'},{text:`(${command.aliases}) › ${command.description}`,color:'dark_purple'}])        
source.sendFeedback([cmd,{text:`Trust Level: `,color:'#00ffff'},{text:`${command.trustLevel}`,color:'dark_purple'}])
source.sendFeedback([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])  
  
break
            }
            } else valid = false
        }
      
             
        if (valid) {
          
        } else {
           const args = context.arguments
        
        
                source.sendFeedback([cmd, {translate: `Unknown command %s. Type "${bot.options.commands.prefixes[0]}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.prefixes[0]}help` } : undefined}])
         
           
        }
  } else {
        let pub_lick = []
        let t_rust = []
        let own_her = []
        let cons_ole = []
      for (const commands in CommandManager.commandlist) {
          const command = CommandManager.commandlist[commands]
         
          
            if(command.trustLevel === 3) {
              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 
                   
                    if (command.trustLevel === 2) {
                            if(!bot.options.Core.enabled && !source.sources.console && !source.sources.discord){
       own_her.push(`&4${command.name + ' '}`)                             
                            }else{
                                    
                            
                  own_her.push(
                {
                  text: command.name + ' ',
                  color: `${bot.options.commands.help.own_herColor}`,
                        
                        
                      translate:"",
                        hoverEvent:{
                                action:"show_text",
                                value:[
                                        {
                                                text:`Command:${command.name}\n`,
                                                color:'white'
                                        },                        {text:`Trust Level: `,color:'white'},
                                        {text:`${command.trustLevel}\n`,color:'dark_red'},                 
 {text:`${command.description}\n`, color:'white'},
                                                               {text:`Command Aliases: ${command.aliases}\n`,color:'white'},
                                        {text:'click on me to use me :)'},
                                ]
                        },clickEvent:{
                                action:"run_command",value:`${bot.options.commands.prefixes[0]}${command.name}`
                        },
                       
         
                }
              )
            }   
                    }
      
            else if (command.trustLevel === 1){
                    if(!bot.options.Core.enabled && !source.sources.console && !source.sources.discord){
                            t_rust.push(`&5${command.name + ' '}`)
                    }else {
              t_rust.push(
                {
                  text: command.name + ' ',
                  color: `${bot.options.commands.help.t_rustedColor}`,
                        
                        
                      translate:"",
                        hoverEvent:{
                                action:"show_text",
                                value:[
                                        {
                                                text:`Command:${command.name}\n`,
                                                color:'white'
                                        },                                        {text:`Trust Level: `,color:'white'},
                                        {text:`${command.trustLevel}\n`,color:'red'},                  {text:`${command.description}\n`, color:'white'},
                                                               {text:`Command Aliases: ${command.aliases}\n`,color:'white'},
                                        {text:'click on me to use me :)'},
                                ]
                        },clickEvent:{
                                action:"run_command",value:`${bot.options.commands.prefixes[0]}${command.name}`
                        },
                                    
                }
              )
                    }
           
            }   
         else if (command.trustLevel === 0){
                 if (!bot.options.Core.enabled && !source.sources.console && !source.sources.discord){
                         pub_lick.push(`&b${command.name + ' '}`)
                 } else{
                 pub_lick.push(
              {
                text: command.name + ' ',
                 color: `${bot.options.commands.help.pub_lickColor}`,
                     translate:"",
                      hoverEvent:{
                              action:"show_text", // Welcome to Kaboom!\n > Free OP - Anarchy - Creative (frfr)
                              value:[
                                      {
                                              text:`Command:${command.name}\n`,
                                              color:'white'
                                      },{
                                              text:`Trust Level: `,color:'white'},
                                        {text:`${command.trustLevel}\n`,color:'red'},                 
                                      {text:`${command.description}\n`, color:'white'},
                                       {text:`Command Aliases: ${command.aliases}\n`,color:'white'},
                                      {text:'click on me to use me :)'},
                              ]
                      },clickEvent:{
                              action:"suggest_command",value:`${bot.options.commands.prefixes[0]}${command.name}`}
               
                        })
                
              
          }
        }
      }
          function sleep(ms) {
  return new Promise((resolve) => setTimeout(resolve, ms)) 
}
        const isConsole = context.source.player ? false : true

        if(source.sources.console && !source.sources.discord) {
       
bot.console.info(bot.getMessageAsPrismarine([cmd, 'Commands (', CommandManager.commandlist.length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole])?.toAnsi(), false)//[cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole]
        } else if(source.sources.discord&& !source.sources.console){

const Embed = new EmbedBuilder()
          .setColor('#00FFFF')
          .setTitle('help Command')
  .setDescription(bot.getMessageAsPrismarine(['Commands (',JSON.stringify(CommandManager.commandlist.filter(c => c.trustLevel != 3).length),')'])?.toString())
.addFields(
		{ name: 'Public Commands', value:`${bot.getMessageAsPrismarine(pub_lick)?.toString()}`},
		{ name: 'Trusted Commands', value: `${bot.getMessageAsPrismarine(t_rust)?.toString()}`, inline: true },
		{ name: 'Owner Commands', value: `${bot.getMessageAsPrismarine(own_her)?.toString()}`, inline: true },
	)
    bot.discord.message.reply({ embeds: [Embed] })

     }else if (!bot.options.Core.enabled) {
                
                 const length = context.bot.commandManager.commandlist.filter(c => c.trustLevel != 3).length

        
                bot.chat('Commands (' + JSON.stringify(length) + ') (&bPublic &f| &5Trusted &f| &4Owner&f)') 
                await sleep(1000)
                bot.chat(`${pub_lick}`)
                await sleep(1000)
                bot.chat(`${t_rust}`)
                 await sleep(1000)
                bot.chat(`${own_her}`)


        }else {
          const length = context.bot.commandManager.commandlist.filter(c => c.trustLevel != 3).length
         source.sendFeedback([cmd, 'Commands (', JSON.stringify(CommandManager.commandlist.filter(c => c.trustLevel != 3).length), ') ', category, ...pub_lick, t_rust ,own_her], false)
        }
        
  }
}
 }
v5.0.7's help commands ```javascript const CommandError = require('../CommandModules/command_error') module.exports = { name: 'help', aliases:['heko', 'cmd', '?', 'commands', 'cmds' ], description:['shows the command list or the usage of a command'], trustLevel: 0, usage:'[COMMAND]', async execute (context) { const bot = context.bot const commandList = [] const source = context.source const args = context.arguments const {EmbedBuilder } = require('discord.js') // const amogus = bot.prefix const ChatMessage = require('prismarine-chat')(bot.options.version) const CommandManager = bot.commandManager 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: `${bot.options.commands.help.pub_lickColor}`, text: 'Public'}, { color: 'white', text: ' | '}, { color: `${bot.options.commands.help.t_rustedColor}`, text: 'Trusted'}, { color: 'white', text: ' | '}, { color: `${bot.options.commands.help.own_herColor}`, text: 'Owner'}, ] } if (args[0]) { let valid for (const commands in bot.commandManager.commandlist) { // i broke a key woops const command = bot.commandManager.commandlist[commands] if (args[0].toLowerCase() === command.name) { function sleep(ms) { return new Promise((resolve) => setTimeout(resolve, ms)); }//bot.getMessageAsPrismarine([cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole])?.toAnsi() valid = true if(source.sources.console){ bot.console.info(bot.getMessageAsPrismarine([cmd, {text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'#00ffff'},{text:`${command.aliases} › ${command.description}`,color:'dark_purple'}])?.toAnsi()) bot.console.info(bot.getMessageAsPrismarine([cmd,{text:`Trust Level: `,color:'#00ffff'},{text:`${command.trustLevel}`,color:'dark_purple'}])?.toAnsi()) bot.console.info(bot.getMessageAsPrismarine([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])?.toAnsi()) }else if(!bot.options.Core.enabled && !source.sources.console){ bot.chat(ChatMessage.fromNotch([cmd, `Description: ${command.description}`]).toMotd().replaceAll('§', '&')) await sleep(1000) bot.chat(ChatMessage.fromNotch([cmd, {text:`Trust Level: ${command.trustLevel}`}]).toMotd().replaceAll('§', '&'))//[cmd, {text:`Trust Level: ${command.trustLevel}`}] await sleep(1000) bot.chat(ChatMessage.fromNotch([cmd, `aliases: ${command.aliases}`]).toMotd().replaceAll('§', '&')) }else{ source.sendFeedback([cmd, {text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'#00ffff'},{text:`(${command.aliases}) › ${command.description}`,color:'dark_purple'}]) source.sendFeedback([cmd,{text:`Trust Level: `,color:'#00ffff'},{text:`${command.trustLevel}`,color:'dark_purple'}]) source.sendFeedback([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}]) break } } else valid = false } if (valid) { } else { const args = context.arguments source.sendFeedback([cmd, {translate: `Unknown command %s. Type "${bot.options.commands.prefixes[0]}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.prefixes[0]}help` } : undefined}]) } } else { let pub_lick = [] let t_rust = [] let own_her = [] let cons_ole = [] for (const commands in CommandManager.commandlist) { const command = CommandManager.commandlist[commands] if(command.trustLevel === 3) { 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 if (command.trustLevel === 2) { if(!bot.options.Core.enabled && !source.sources.console && !source.sources.discord){ own_her.push(`&4${command.name + ' '}`) }else{ own_her.push( { text: command.name + ' ', color: `${bot.options.commands.help.own_herColor}`, translate:"", hoverEvent:{ action:"show_text", value:[ { text:`Command:${command.name}\n`, color:'white' }, {text:`Trust Level: `,color:'white'}, {text:`${command.trustLevel}\n`,color:'dark_red'}, {text:`${command.description}\n`, color:'white'}, {text:`Command Aliases: ${command.aliases}\n`,color:'white'}, {text:'click on me to use me :)'}, ] },clickEvent:{ action:"run_command",value:`${bot.options.commands.prefixes[0]}${command.name}` }, } ) } } else if (command.trustLevel === 1){ if(!bot.options.Core.enabled && !source.sources.console && !source.sources.discord){ t_rust.push(`&5${command.name + ' '}`) }else { t_rust.push( { text: command.name + ' ', color: `${bot.options.commands.help.t_rustedColor}`, translate:"", hoverEvent:{ action:"show_text", value:[ { text:`Command:${command.name}\n`, color:'white' }, {text:`Trust Level: `,color:'white'}, {text:`${command.trustLevel}\n`,color:'red'}, {text:`${command.description}\n`, color:'white'}, {text:`Command Aliases: ${command.aliases}\n`,color:'white'}, {text:'click on me to use me :)'}, ] },clickEvent:{ action:"run_command",value:`${bot.options.commands.prefixes[0]}${command.name}` }, } ) } } else if (command.trustLevel === 0){ if (!bot.options.Core.enabled && !source.sources.console && !source.sources.discord){ pub_lick.push(`&b${command.name + ' '}`) } else{ pub_lick.push( { text: command.name + ' ', color: `${bot.options.commands.help.pub_lickColor}`, translate:"", hoverEvent:{ action:"show_text", // Welcome to Kaboom!\n > Free OP - Anarchy - Creative (frfr) value:[ { text:`Command:${command.name}\n`, color:'white' },{ text:`Trust Level: `,color:'white'}, {text:`${command.trustLevel}\n`,color:'red'}, {text:`${command.description}\n`, color:'white'}, {text:`Command Aliases: ${command.aliases}\n`,color:'white'}, {text:'click on me to use me :)'}, ] },clickEvent:{ action:"suggest_command",value:`${bot.options.commands.prefixes[0]}${command.name}`} }) } } } function sleep(ms) { return new Promise((resolve) => setTimeout(resolve, ms)) } const isConsole = context.source.player ? false : true if(source.sources.console && !source.sources.discord) { bot.console.info(bot.getMessageAsPrismarine([cmd, 'Commands (', CommandManager.commandlist.length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole])?.toAnsi(), false)//[cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole] } else if(source.sources.discord&& !source.sources.console){ const Embed = new EmbedBuilder() .setColor('#00FFFF') .setTitle('help Command') .setDescription(bot.getMessageAsPrismarine(['Commands (',JSON.stringify(CommandManager.commandlist.filter(c => c.trustLevel != 3).length),')'])?.toString()) .addFields( { name: 'Public Commands', value:`${bot.getMessageAsPrismarine(pub_lick)?.toString()}`}, { name: 'Trusted Commands', value: `${bot.getMessageAsPrismarine(t_rust)?.toString()}`, inline: true }, { name: 'Owner Commands', value: `${bot.getMessageAsPrismarine(own_her)?.toString()}`, inline: true }, ) bot.discord.message.reply({ embeds: [Embed] }) }else if (!bot.options.Core.enabled) { const length = context.bot.commandManager.commandlist.filter(c => c.trustLevel != 3).length bot.chat('Commands (' + JSON.stringify(length) + ') (&bPublic &f| &5Trusted &f| &4Owner&f)') await sleep(1000) bot.chat(`${pub_lick}`) await sleep(1000) bot.chat(`${t_rust}`) await sleep(1000) bot.chat(`${own_her}`) }else { const length = context.bot.commandManager.commandlist.filter(c => c.trustLevel != 3).length source.sendFeedback([cmd, 'Commands (', JSON.stringify(CommandManager.commandlist.filter(c => c.trustLevel != 3).length), ') ', category, ...pub_lick, t_rust ,own_her], false) } } } } ```
Author
Collaborator
[Eval (files.chipmunk.land)](https://files.chipmunk.land/mnbb64gw.js) [Console (files.chipmunk.land)](https://files.chipmunk.land/selif/5gwf9gvu.png)
Owner

v5.0.7's command manager


const fs = require("fs");
const path = require("path");
const CommandError = require("../CommandModules/command_error.js");
const time = new Date().toLocaleTimeString("en-US", {timeZone: "America/CHICAGO",});
const date = new Date().toLocaleDateString("en-US", {timeZone: "America/CHICAGO",});
const {EmbedBuilder } = require('discord.js')
/*async*/ function command_manager(bot, options) {
  bot.commandManager = {
    commands: {},
    commandlist: [],
    execute(source, commandName, args, message) {
      const command = this.getCommand(commandName.toLowerCase());
  const player = source?.player?.profile?.name;
          const uuid = source?.player?.uuid;
      try {
if(source.sources.console && !source.sources.discord){
 if (!command || !command.execute) {
bot.console.warn({text:`Unknown Command ${commandName}. type "${bot.options.Console.prefix}help" for help`,color:'dark_red'})
}
}else if(source.sources.discord && !source.sources.console) {
  if (!command || !command.execute) {
 const Embed = new EmbedBuilder()
          .setColor('#FF0000')
          .setTitle('Unknown Command')
          .setDescription(`Unknown Command ${commandName}. type "${bot.options.discord.commandPrefix}help" for help`)
        bot.discord.channel.send({ embeds: [Embed] })
     }
}else if(!source.sources.discord && !source.sources.console) {
    if (!bot.options.Core.enabled){
         if (!command || !command.execute) {
                throw new CommandError(`Unknown command ${commandName}. Type "${bot.options.commands.prefixes[0]}help" for help`)
}
}else{
        if (!command || !command.execute) { // bot.options.command.prefixes[0]
          throw new CommandError({ // sus
            translate: `Unknown command %s. Type "${bot.options.commands.prefixes[0]}help" for help or click on this for the command`,
/*
with: [commandName],
            clickEvent: 'https://discord.gg'
       
              ? {/
*/
            with: [commandName],
clickEvent:'https://discord.gg'
               ? {
                  action: "suggest_command",
                  value: `${bot.options.commands.prefixes[0]}help`,
                }
              : undefined,
          }); //ohio
              }
}
}         
const event = source.discordMessageEvent

          const roles = event?.member?.roles?.cache
        if (command?.trustLevel > 0) {
         

if(command?.trustLevel === 1 && !source?.sources?.discord && !source?.sources?.console){
const hash = `${args[0]}`

if(args.length === 0 && bot.hash && bot.owner && bot.hashing.hash) throw new CommandError([{text:'Please provide an ',color:'gray'},{text:'Trusted ',color:'dark_purple'},{text:'hash or an ',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}])
if (hash !== bot.hash && hash !== bot.owner && hash !== bot.hashing.hash) throw new CommandError([{text:'Invalid ',color:'gray'},{text:'Trusted ',color:'dark_purple'},{text:'hash or Invalid ',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}])

} else if (command.trustLevel === 1 && source.sources.discord && !source.sources.console) {
  

          const hasRole = roles?.some(role => role.name === 'trusted' /*|| role.name === 'FNFBoyfriendBot Owner'*/)

          if (!hasRole) throw new CommandError({ translate: 'You are not trusted!' })
        }
          bot.hashing.updateHash();
        
          bot.console.hash = function (error, source) {
            console.log(
              `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` +
                `[\x1b[0m\x1b[92mHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[92mHash\x1b[0m:${
                  bot.hash || bot.hashing.hash
                }\x1b[0m]`,
            );
          };
          bot.console.discordHash = function (error, source) {
            console.log(
              `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` +
                `[\x1b[0m\x1b[92mHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[92mHash\x1b[0m:${bot.hashing.hash}\x1b[0m]`,
            );
          };
          bot.console.ownerHash = function (error, source) {
            console.log(
              `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` +
                `[\x1b[0m\x1b[31mOwnerHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[31mOwnerHash\x1b[0m:${bot.owner}\x1b[0m]`,
            );
          };
          if (args[0] === bot.hash) {
            bot.console.hash();
          } else if (args[0] === bot.owner) {
            bot.console.ownerHash();
         }
if(command?.trustLevel === 2 && !source?.sources?.discord && !source?.sources?.console){
const owner = `${args[0]}`

if(args.length === 0 && bot.owner) throw new CommandError([{text:'Please provide a ',color:'red',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}])
if(owner === bot.hash && owner === bot.hashing.hash) throw new CommandError([{text:"THATS A ",color:'gray'},{text:'TRUSTED ',color:'dark_purple'},{text:'HASH AFAIK',color:'gray'}])
if (owner !== bot.owner) throw new CommandError([{text:"Invalid ",color:'gray'},{text:'Owner ',color:'dark_red'},{text:'Hash',color:'gray'}])

} else if (command.trustLevel === 2 && source.sources.discord && !source.sources.console) {
  //        const events = source.discordMessageEvent

//          const roless = events?.member?.roles?.cache

          const hasRole = roles?.some(role => role.name === 'FNFBoyfriendBot Owner')

          if (!hasRole) throw new CommandError({ translate: 'You are the Owner!' })
        } 
          if (command.trustLevel === 3 && !source?.sources?.console)
     
            throw new CommandError({translate: "This command can only be executed via console",color: "blue",});
        }
        
        return command?.execute({ bot, source, arguments: args });
      } catch (error) {
        const now = new Date().toLocaleString("en-US", {
          timeZone: "America/CHICAGO",
        });
        bot.console.warn(error.stack); 
        
              if (!bot.options.Core.enabled){
                if (error instanceof CommandError) 
                      bot.chat(bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&'))
else bot.chat(bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&'))
                }  else if(!source.sources.discord && !source.sources.console) {
        if (error instanceof CommandError) 
       source.sendError(error._message)
        else source.sendError({
            translate: "An Error has occured because the bot shot itself 🔫",
            color: "red",
            hoverEvent: { action: "show_text", contents: String(error.stack) },
          });
                }
                        //
         
      
       
else if (source.sources.discord && !source.sources.console) {

        const Embed = new EmbedBuilder()
          .setColor('#FF0000')
          .setTitle('Uh oh i went to get the 🥛 give me :cancer: years to come back with it')
          .setDescription(`\`\`\`${error}\`\`\``)
        bot.discord.channel.send({ embeds: [Embed] })
      }
      }
  },
      

    executeString(source, command) {
      const [commandName, ...args] = command.split(" ");

return this.execute(source, commandName, args)

    },


    register(command) {
      this.commands[command.name] = command;

      if (command.aliases) {
        command.aliases.map((a) => (this.commands[a] = command));
      }
    },
    getCommand(name) {
      return this.commands[name];
    },

    getCommands() {
      return Object.values(this.commands);
    },  
};
  //

  commandlist = [];

  for (const filename of fs.readdirSync(path.join(__dirname, "../commands"))) {
    try {
      const command = require(path.join(__dirname, "../commands", filename));
      bot.commandManager.register(command);
      bot.commandManager.commandlist.push(command);
    } catch (error) {
      console.error("Failed to load command", filename, ":", error);
    }

    if (process.env["anti-skid"] !== "amogus is sus") {
      process.exit(0);
    }
  }
}
module.exports = command_manager;

v5.0.7's command manager ```javascript const fs = require("fs"); const path = require("path"); const CommandError = require("../CommandModules/command_error.js"); const time = new Date().toLocaleTimeString("en-US", {timeZone: "America/CHICAGO",}); const date = new Date().toLocaleDateString("en-US", {timeZone: "America/CHICAGO",}); const {EmbedBuilder } = require('discord.js') /*async*/ function command_manager(bot, options) { bot.commandManager = { commands: {}, commandlist: [], execute(source, commandName, args, message) { const command = this.getCommand(commandName.toLowerCase()); const player = source?.player?.profile?.name; const uuid = source?.player?.uuid; try { if(source.sources.console && !source.sources.discord){ if (!command || !command.execute) { bot.console.warn({text:`Unknown Command ${commandName}. type "${bot.options.Console.prefix}help" for help`,color:'dark_red'}) } }else if(source.sources.discord && !source.sources.console) { if (!command || !command.execute) { const Embed = new EmbedBuilder() .setColor('#FF0000') .setTitle('Unknown Command') .setDescription(`Unknown Command ${commandName}. type "${bot.options.discord.commandPrefix}help" for help`) bot.discord.channel.send({ embeds: [Embed] }) } }else if(!source.sources.discord && !source.sources.console) { if (!bot.options.Core.enabled){ if (!command || !command.execute) { throw new CommandError(`Unknown command ${commandName}. Type "${bot.options.commands.prefixes[0]}help" for help`) } }else{ if (!command || !command.execute) { // bot.options.command.prefixes[0] throw new CommandError({ // sus translate: `Unknown command %s. Type "${bot.options.commands.prefixes[0]}help" for help or click on this for the command`, /* with: [commandName], clickEvent: 'https://discord.gg' ? {/ */ with: [commandName], clickEvent:'https://discord.gg' ? { action: "suggest_command", value: `${bot.options.commands.prefixes[0]}help`, } : undefined, }); //ohio } } } const event = source.discordMessageEvent const roles = event?.member?.roles?.cache if (command?.trustLevel > 0) { if(command?.trustLevel === 1 && !source?.sources?.discord && !source?.sources?.console){ const hash = `${args[0]}` if(args.length === 0 && bot.hash && bot.owner && bot.hashing.hash) throw new CommandError([{text:'Please provide an ',color:'gray'},{text:'Trusted ',color:'dark_purple'},{text:'hash or an ',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}]) if (hash !== bot.hash && hash !== bot.owner && hash !== bot.hashing.hash) throw new CommandError([{text:'Invalid ',color:'gray'},{text:'Trusted ',color:'dark_purple'},{text:'hash or Invalid ',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}]) } else if (command.trustLevel === 1 && source.sources.discord && !source.sources.console) { const hasRole = roles?.some(role => role.name === 'trusted' /*|| role.name === 'FNFBoyfriendBot Owner'*/) if (!hasRole) throw new CommandError({ translate: 'You are not trusted!' }) } bot.hashing.updateHash(); bot.console.hash = function (error, source) { console.log( `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` + `[\x1b[0m\x1b[92mHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[92mHash\x1b[0m:${ bot.hash || bot.hashing.hash }\x1b[0m]`, ); }; bot.console.discordHash = function (error, source) { console.log( `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` + `[\x1b[0m\x1b[92mHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[92mHash\x1b[0m:${bot.hashing.hash}\x1b[0m]`, ); }; bot.console.ownerHash = function (error, source) { console.log( `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` + `[\x1b[0m\x1b[31mOwnerHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[31mOwnerHash\x1b[0m:${bot.owner}\x1b[0m]`, ); }; if (args[0] === bot.hash) { bot.console.hash(); } else if (args[0] === bot.owner) { bot.console.ownerHash(); } if(command?.trustLevel === 2 && !source?.sources?.discord && !source?.sources?.console){ const owner = `${args[0]}` if(args.length === 0 && bot.owner) throw new CommandError([{text:'Please provide a ',color:'red',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}]) if(owner === bot.hash && owner === bot.hashing.hash) throw new CommandError([{text:"THATS A ",color:'gray'},{text:'TRUSTED ',color:'dark_purple'},{text:'HASH AFAIK',color:'gray'}]) if (owner !== bot.owner) throw new CommandError([{text:"Invalid ",color:'gray'},{text:'Owner ',color:'dark_red'},{text:'Hash',color:'gray'}]) } else if (command.trustLevel === 2 && source.sources.discord && !source.sources.console) { // const events = source.discordMessageEvent // const roless = events?.member?.roles?.cache const hasRole = roles?.some(role => role.name === 'FNFBoyfriendBot Owner') if (!hasRole) throw new CommandError({ translate: 'You are the Owner!' }) } if (command.trustLevel === 3 && !source?.sources?.console) throw new CommandError({translate: "This command can only be executed via console",color: "blue",}); } return command?.execute({ bot, source, arguments: args }); } catch (error) { const now = new Date().toLocaleString("en-US", { timeZone: "America/CHICAGO", }); bot.console.warn(error.stack); if (!bot.options.Core.enabled){ if (error instanceof CommandError) bot.chat(bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&')) else bot.chat(bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&')) } else if(!source.sources.discord && !source.sources.console) { if (error instanceof CommandError) source.sendError(error._message) else source.sendError({ translate: "An Error has occured because the bot shot itself 🔫", color: "red", hoverEvent: { action: "show_text", contents: String(error.stack) }, }); } // else if (source.sources.discord && !source.sources.console) { const Embed = new EmbedBuilder() .setColor('#FF0000') .setTitle('Uh oh i went to get the 🥛 give me :cancer: years to come back with it') .setDescription(`\`\`\`${error}\`\`\``) bot.discord.channel.send({ embeds: [Embed] }) } } }, executeString(source, command) { const [commandName, ...args] = command.split(" "); return this.execute(source, commandName, args) }, register(command) { this.commands[command.name] = command; if (command.aliases) { command.aliases.map((a) => (this.commands[a] = command)); } }, getCommand(name) { return this.commands[name]; }, getCommands() { return Object.values(this.commands); }, }; // commandlist = []; for (const filename of fs.readdirSync(path.join(__dirname, "../commands"))) { try { const command = require(path.join(__dirname, "../commands", filename)); bot.commandManager.register(command); bot.commandManager.commandlist.push(command); } catch (error) { console.error("Failed to load command", filename, ":", error); } if (process.env["anti-skid"] !== "amogus is sus") { process.exit(0); } } } module.exports = command_manager; ```
Owner

restoring a lot of shit ????

restoring a lot of shit ????
Author
Collaborator

fr

fr
Author
Collaborator

this is like the average issue about making something at prismarinejs

this is like the average issue about making something at prismarinejs
Owner

fr

fr
Owner

half way done :3

half way done :3
Owner

is this really 4 months old holy hell

is this really 4 months old holy hell
Owner

nvm gitea on crack

nvm gitea on crack
Owner

done finally :fire :

done finally :fire :
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Parker2991/FridayNightFunkinBoyfriendBot#4
No description provided.