diff --git a/src/commands/owner/servereval.js b/src/commands/owner/servereval.js index a5ec7a9..bd6bf50 100644 --- a/src/commands/owner/servereval.js +++ b/src/commands/owner/servereval.js @@ -20,13 +20,17 @@ module.exports = { const discordClient = context.discordClient; const args = context.arguments; const script = args.slice(1).join(' '); + const { MessageBuilder } = require('prismarine-chat')(bot.options.version); try { if (source.sources.console) { bot.console.log(bot.getMessageAsPrismarine({ text: util.inspect(eval(args.join(' ')), { stylize })})?.toAnsi()) } else if (bot.options.useChat || bot.options.isSavage) { bot.chat.message(bot.getMessageAsPrismarine({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })?.toMotd().replaceAll('§','&')) } else { - bot.tellraw(`@a[name="${source.player.profile.name}"]`, [ + bot.tellraw(`@a[name="${source.player.profile.name}"]`, new MessageBuilder() + .setText(util.inspect(eval(script), { stylize }).substring(0, 32700)) + ) +/* bot.tellraw(`@a[name="${source.player.profile.name}"]`, [ { text: util.inspect(eval(script), { stylize }).substring(0, 32700), hoverEvent: { @@ -41,7 +45,7 @@ module.exports = { value: `${script}` } } - ]); + ]);*/ } } catch (e) { throw new CommandError(e.toString()) diff --git a/src/commands/public/info.js b/src/commands/public/info.js index fb8f5d3..b197844 100644 --- a/src/commands/public/info.js +++ b/src/commands/public/info.js @@ -360,20 +360,6 @@ module.exports = { } if (bot.options.isSavage) { bot.chat.message(bot.getMessageAsPrismarine(component)?.toMotd().replaceAll('§','&')); -// bot.chat.message(bot.getMessageAsPrismarine(component)?.toMotd().replaceAll('§','&')); -// console.log(component.includes('\n')); -// if (component.includes('\n')) { -// console.log('e'); -// } -// console.log(bot.getMessageAsPrismarine(component)?.toString()?.find) -// bot.chat.message(bot.getMessageAsPrismarine(component)?.toMotd().replaceAll('§','&').replaceAll('\n','\n')); -// bot.chat.message(bot.getMessageAsPrismarine(component)?.toMotd().replaceAll('\n','\n')?.replaceAll('§','&')); -// console.log(component.toString()); -// console.log(component.toString().replaceAll) - //console.log(component.find((e) => e).with) -// for (const componentText of component.find((e) => e).with) { -// bot.chat.message(bot.getMessageAsPrismarine(component)?.toMotd().replaceAll('§','&')) - // } } else { bot.tellraw(`@a[name="${source.player.profile.name}"]`, component); } diff --git a/src/modules/chat_command_handler.js b/src/modules/command_handler.js similarity index 100% rename from src/modules/chat_command_handler.js rename to src/modules/command_handler.js diff --git a/src/modules/command_suggestion.js b/src/modules/command_suggestion.js deleted file mode 100644 index 3efcdcf..0000000 --- a/src/modules/command_suggestion.js +++ /dev/null @@ -1,44 +0,0 @@ -function commandsuggestions(context) { - const bot = context.bot - if (!bot.options.isKaboom) return - bot.on('systemChat',(data)=>{ - try { - const message = data; - if (message.text === "fnfboyfriendbot_request_command_suggestion") { - const extra = message.extra; - const uuidString = extra[0]?.text; - const uuidMatch = uuidString.match(/UUID:\[I;(-?\d+),(-?\d+),(-?\d+),(-?\d+)\]/); - if (!uuidMatch) return; - if (Array.isArray(extra) && extra.length > 0) { - const commandSuggestions = { - extra: [ - { text: "fnfboyfriendbot_request_command_suggestion" }, - ...bot.commandManager.commandlist.map((c) => { - const aliases = c.data.aliases.length > 0 ? c.data.aliases : []; - return { - extra: [ - c.data.trustLevel === 0 ? "PUBLIC" : - c.data.trustLevel === 1 ? "TRUSTED" : - c.data.trustLevel === 2 ? "ADMIN" : - c.data.trustLevel === 3 ? "OWNER" : - "OWNER", - "true", - ...aliases - ], - text: c.data.name - }; - }) - ], - text: "" - }; - const jsonString = (commandSuggestions); - bot.tellraw(`@a[nbt={UUID:[I;${uuidMatch.slice(1).map(Number)}]}]`, jsonString) - } - } - } catch (e) { - if (e.toString() === "TypeError: Cannot read properties of undefined (reading '0')") return - else console.log(e.toString()) - } - }) -} -module.exports = commandsuggestions diff --git a/src/modules/memusage.js b/src/modules/memusage.js index 1063fe5..6917b65 100644 --- a/src/modules/memusage.js +++ b/src/modules/memusage.js @@ -67,26 +67,6 @@ module.exports = (context) => { .setColor(config.colors.commands.secondary) .setText("MiB") ) -/* component = { - translate: "%s%s%s %s | %s: %s%s / %s%s | %s: %s%s / %s%s |", - color: config.colors.commands.tertiary, - with: [ - { text: "FNF", color: "dark_blue" }, - { text: "Boyfriend", color: "dark_aqua" }, - { text: "Bot", color: "blue" }, - { text: "Memory Usage" }, - { text: "Free Server Memory", color: config.colors.commands.primary }, - { text: `${Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer }, - { text: "MiB", color: config.colors.commands.secondary }, - { text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer }, - { text: "MiB", color: config.colors.commands.secondary }, - { text: "Bot Memory Usage", color: config.colors.commands.primary }, - { text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer }, - { text: "MiB", color: config.colors.commands.secondary }, - { text: `${Math.floor(process.memoryUsage().heapTotal / 1048576 )}`, color: config.colors.integer }, - { text: "MiB", color: config.colors.commands.secondary } - ] - }*/ if (!bot.memUsage.enabled) return; bot.core.run(`minecraft:title @a[tag=!memusage] actionbar ${JSON.stringify(component)}`) }, 100) diff --git a/src/modules/player_list.js b/src/modules/player_list.js index baaa3fe..7fbf452 100644 --- a/src/modules/player_list.js +++ b/src/modules/player_list.js @@ -40,6 +40,7 @@ function player_list (context) { bot.players = bot.players.filter(_entry => _entry.uuid !== entry.uuid) bot.players.push({ uuid: entry.uuid, + mcUUID: "", profile: { name: entry.player.name, properties: entry.player.properties }, chatSession: undefined, gamemode: undefined,