Compare commits

...

7 commits

43 changed files with 628 additions and 545 deletions

View file

@ -1,4 +1,4 @@
import { default as parsePlain } from '../util/chatparse_plain.js' import parsePlain from '../util/chatparse_plain.js'
const priority = 0 const priority = 0
const parse = (data, b) => { const parse = (data, b) => {

View file

@ -1,4 +1,4 @@
import { default as parsePlain } from '../util/chatparse_plain.js' import parsePlain from '../util/chatparse_plain.js'
const priority = 0 const priority = 0
const parse = (data, b) => { const parse = (data, b) => {

View file

@ -1,4 +1,4 @@
import { default as parsePlain } from '../util/chatparse_plain.js' import parsePlain from '../util/chatparse_plain.js'
const priority = 1 const priority = 1
const parse = (data, b) => { const parse = (data, b) => {

View file

@ -1,4 +1,4 @@
import { default as parsePlain } from '../util/chatparse_plain.js' import parsePlain from '../util/chatparse_plain.js'
const priority = 2 const priority = 2
const parse = (data, b) => { const parse = (data, b) => {

View file

@ -1,4 +1,4 @@
import { default as parsePlain } from '../util/chatparse_plain.js' import parsePlain from '../util/chatparse_plain.js'
const priority = 1 const priority = 1
const parse = (data, b) => { const parse = (data, b) => {

View file

@ -2,11 +2,10 @@ import os from 'node:os'
import { execSync } from 'child_process' import { execSync } from 'child_process'
import { getMessage, formatTime } from '../util/lang.js' import { getMessage, formatTime } from '../util/lang.js'
import memoryconvert from '../util/memoryconvert.js' import memoryconvert from '../util/memoryconvert.js'
import { readdirSync, readFileSync } from "node:fs" import { readdirSync, readFileSync } from 'node:fs'
import { default as botVersion } from "../util/version.js" import botVersion from '../util/version.js'
import { default as version } from "../version.json" with { type: "json" } import version from '../version.js'
import { bots } from "../index.js" import { bots } from '../index.js'
const aboutBot = function (c) { const aboutBot = function (c) {
c.reply({ c.reply({

6
commands/cb.js Executable file
View file

@ -0,0 +1,6 @@
const execute = (c) => {
c.bot.ccq.push(c.args.join(' '))
}
const consoleIndex = true
const aliases = ['commandblock', 'cmdblock']
export { execute, consoleIndex, aliases }

View file

@ -1,13 +1,13 @@
import * as index from "../index.js" // Not used in the code, but may be used by users of the command import * as index from '../index.js' // Not used in the code, but may be used by users of the command
import { getMessage } from '../util/lang.js' import { getMessage } from '../util/lang.js'
const execute = (c) => { const execute = (c) => {
if(c.verify != 2){ if (c.verify !== 2) {
c.reply({ c.reply({
text: getMessage(c.lang, "command.disallowed.perms.short") text: getMessage(c.lang, 'command.disallowed.perms.short')
}) })
c.reply({ c.reply({
text: getMessage(c.lang, "command.disabled.nonConsole") text: getMessage(c.lang, 'command.disabled.nonConsole')
}) })
return return
} }
@ -48,4 +48,3 @@ const execute = (c) => {
} }
const level = 2 const level = 2
export { execute, level } export { execute, level }

View file

@ -1,4 +1,4 @@
import cmds from "../util/commands.js" import cmds from '../util/commands.js'
import { getMessage } from '../util/lang.js' import { getMessage } from '../util/lang.js'
const sortHelp = function sortHelp (c1, c2) { const sortHelp = function sortHelp (c1, c2) {
@ -171,12 +171,12 @@ const printCmdHelp = (c) => {
} }
] ]
}) })
if(cmds[cmd].aliases){ if (cmds[cmd].aliases) {
const aliasList = []; const aliasList = []
for(const item of cmds[cmd].aliases){ for (const item of cmds[cmd].aliases) {
if(aliasList.length>0){ if (aliasList.length > 0) {
aliasList.push({ aliasList.push({
text: ", ", text: ', ',
color: c.colors.secondary color: c.colors.secondary
}) })
} }
@ -224,7 +224,6 @@ const printCmdHelp = (c) => {
}) })
} }
const execute = (c) => { const execute = (c) => {
if (c.args.length > 0) { if (c.args.length > 0) {
printCmdHelp(c) printCmdHelp(c)
@ -236,4 +235,3 @@ const aliases = [
'heko' // Parker2991 request 'heko' // Parker2991 request
] ]
export { execute, aliases } export { execute, aliases }

8
commands/logoff.js Executable file
View file

@ -0,0 +1,8 @@
const execute= (c) => {
c.reply("Command has been disabled")
//c.bot._client.end()
}
const consoleIndex= true
const level= 2
export { execute, consoleIndex, level }

57
commands/netmsg.js Executable file
View file

@ -0,0 +1,57 @@
import { bots } from '../index.js'
import { getMessage } from '../util/lang.js'
const execute = (c) => {
let host = c.host
let port = c.port
if (c.bot.host.options && c.bot.host.options.hidden) {
host = 'localhost' // Makes hidden servers appear as localhost
port = '25565'
} else if (c.bot.host.options && c.bot.host.options.displayAsIPv6) {
host = `[${host}]`
}
const json = {
translate: '[%s] %s: %s',
with: [
{
text: c.serverName,
hoverEvent: {
action: 'show_text',
value: {
translate: '%s: %s:%s',
with: [
{
text: getMessage(c.lang, 'command.netmsg.serverAddress'),
color: c.colors.primary
},
{
text: host,
color: c.colors.primary
},
{
text: port + '',
color: c.colors.primary
}
],
color: c.colors.secondary
}
},
color: c.colors.primary
},
{
text: c.username,
color: c.colors.primary
},
{
text: c.args.join(' ').slice(0, 512)
}
],
color: 'white'
}
bots.forEach(item => {
if (item.host.options && item.host.options.netmsgIncomingDisabled && c.type !== 'console') return
item.tellraw('@a', json)
})
}
export { execute }

7
commands/refill.js Executable file
View file

@ -0,0 +1,7 @@
const execute= (c) => {
c.bot.chat(c.bot.refillCoreCmd)
}
const consoleIndex= true
const aliases = ['refillcore', 'rc']
export { execute, consoleIndex, aliases }

8
commands/restart.js Executable file
View file

@ -0,0 +1,8 @@
const execute= (c) => {
c.reply("Command has been disabled")
//process.exit(0)
}
const aliases = ['reboot']
const level= 2
export { execute, aliases, level }

View file

@ -1,5 +1,5 @@
import { default as settings } from '../settings.js' import settings from '../settings.js'
import { default as version } from "../version.json" with { type: "json" } import version from '../version.js'
const execute = (c) => { const execute = (c) => {
if (c.verify < 1) { if (c.verify < 1) {
c.bot.tellraw('@a', { c.bot.tellraw('@a', {

8
commands/stop.js Executable file
View file

@ -0,0 +1,8 @@
const execute= (c) => {
c.reply("Command has been disabled")
//process.exit(1)
}
const aliases = ['exit']
const level= 2
export { execute, aliases, level }

View file

@ -34,11 +34,11 @@ const execute = (c) => {
c.reply(reply('uuid', c.uuid)) c.reply(reply('uuid', c.uuid))
c.reply(reply('username', c.username)) c.reply(reply('username', c.username))
c.reply(reply('nickname', c.nickname)) c.reply(reply('nickname', c.nickname))
c.reply(reply('command', c.command.slice(0,1024))) c.reply(reply('command', c.command.slice(0, 1024)))
c.reply(reply('msgType', c.msgType)) c.reply(reply('msgType', c.msgType))
c.reply(reply('msgSubtype', c.msgSubtype)) c.reply(reply('msgSubtype', c.msgSubtype))
c.reply(reply('prefix', c.prefix)) c.reply(reply('prefix', c.prefix))
c.reply(reply('args', c.args.join(', ').slice(0,1024))) c.reply(reply('args', c.args.join(', ').slice(0, 1024)))
c.reply(reply('verify', c.verify.toString())) c.reply(reply('verify', c.verify.toString()))
c.reply(reply('host', c.host)) c.reply(reply('host', c.host))
c.reply(reply('port', c.port.toString())) c.reply(reply('port', c.port.toString()))

View file

@ -1,20 +1,20 @@
import { createClient } from "minecraft-protocol"; import { createClient } from 'minecraft-protocol'
import { default as settings } from './settings.js' import settings from './settings.js'
import generateUser from './util/usergen.js' import generateUser from './util/usergen.js'
import EventEmitter from 'node:events' import EventEmitter from 'node:events'
import { readdirSync } from "node:fs"; import { readdirSync } from 'node:fs'
const bots = []; const bots = []
const plugins = []; const plugins = []
const bpl = readdirSync('plugins') const bpl = readdirSync('plugins')
for (const plugin of bpl) { for (const plugin of bpl) {
if (!plugin.endsWith('.js')) { if (!plugin.endsWith('.js')) {
continue continue
} }
try { try {
import(`./plugins/${plugin}`).then((pluginItem)=>{ import(`./plugins/${plugin}`).then((pluginItem) => {
for(const bot of bots){ for (const bot of bots) {
pluginItem.default(bot) pluginItem.default(bot)
} }
plugins.push(pluginItem.default) // For rejoining plugins.push(pluginItem.default) // For rejoining
@ -54,7 +54,7 @@ const createBot = function createBot (host, oldId) {
delete bots[oldId] delete bots[oldId]
bot.id = oldId bot.id = oldId
bots[oldId] = bot bots[oldId] = bot
for(const pluginItem of plugins){ for (const pluginItem of plugins) {
pluginItem(bot) pluginItem(bot)
} }
} else { } else {

136
lang/en-US.js Normal file
View file

@ -0,0 +1,136 @@
export default {
'time.week': ' week ',
'time.weekPlural': ' weeks ',
'time.day': ' day ',
'time.dayPlural': ' days ',
'time.hour': ' hour ',
'time.hourPlural': ' hours ',
'time.minute': ' minute ',
'time.minutePlural': ' minutes ',
'time.second': ' second ',
'time.secondPlural': ' seconds ',
'chat.antiSpamTriggered': 'Anti-spam has been triggered for this server.',
'command.about.usage': '',
'command.about.desc': 'About the bot',
'command.cb.usage': ' <command>',
'command.cb.desc': 'Run a command in a command block',
'command.cloop.usage': ' add <rate> <command>|| remove <index>|| list|| clear',
'command.cloop.desc': 'Manage command loops',
'command.eval.usage': ' <code>',
'command.eval.desc': 'Run JavaScript code',
'command.help.usage': ' [cmd]',
'command.help.desc': 'Shows command help',
'command.logoff.usage': '',
'command.logoff.desc': 'Disconnect and reconnect the bot from a server',
'command.netmsg.usage': ' <message>',
'command.netmsg.desc': 'Send a message to all servers the bot is connected to',
'command.refill.usage': '',
'command.refill.desc': 'Refill core',
'command.say.usage': ' <message>',
'command.say.desc': 'Sends a message to chat',
'command.restart.usage': '',
'command.restart.desc': 'Restart bot',
'command.stop.usage': '',
'command.stop.desc': 'Stop bot',
'command.template.usage': ' <required> [optional]',
'command.template.desc': 'Does nothing',
'command.test.usage': ' [args...]',
'command.test.desc': 'Chat parsing debugger command',
'command.tpr.usage': '',
'command.tpr.desc': 'Teleport to a random location',
'command.validate.usage': ' [args...]',
'command.validate.desc': 'Check the hashing system',
'command.about.author': '%s - a Minecraft bot made by %s for Kaboom and clones',
'command.about.version': 'Version %s',
'command.about.preRelease': "This is a development version - there may be errors, and features may be changed or removed at any time. Please report any errors to the bot's developer.",
'command.about.sourceCode': 'Source code: %s',
'command.about.license': 'This bot is free and open-source software and is available under the terms of the MIT license.',
'command.about.subcommands': "This command has subcommands to find out more about this bot - try running the commands \"servers\" for a list of Minecraft servers the bot is connected to, or \"serverinfo\" for technical specifications of the bot's server.",
'command.about.sourceCode.openInBrowser': 'Click to open the source code link in your default browser',
'command.cloop.error.tooShort': 'Command loops must have a rate above 20ms.',
'command.cloop.error.subcommand': 'Unknown subcommand, please do %s',
'command.cloop.success.add': 'Added command loop with command %s and rate %s',
'command.cloop.success.remove': 'Removed command loop %s',
'command.cloop.success.clear': 'Cleared all command loops',
'command.cloop.list': '%s: Command: %s Rate: %s',
'command.eval.output': 'Output',
'command.help.cmdList': 'Commands',
'command.help.commandInfo': '%s%s - %s',
'command.help.commandUsage': 'Usage - %s%s',
'command.help.commandDesc': 'Description - %s',
'command.help.commandPerms': 'Required permissions - %s',
'command.help.commandUsage.lf': 'Usage - %s%s\n',
'command.help.commandDesc.lf': 'Description - %s\n',
'command.help.commandPerms.lf': 'Required permissions - %s\n',
'command.help.commandAliases': 'Aliases - %s',
'command.help.runCommand': 'Click to run command',
'command.help.permsNormal': 'Public',
'command.help.permsTrusted': 'Trusted',
'command.help.permsOwner': 'Owner',
'command.help.noCommand': 'Command does not exist',
'command.help.alias': 'Alias to %s',
'command.help.copyAlias': 'Click to copy this alias to your clipboard',
'command.netmsg.serverAddress': 'Server Address',
'command.test.uuid': 'UUID',
'command.test.username': 'Username',
'command.test.nickname': 'Nickname',
'command.test.command': 'Command',
'command.test.msgType': 'Message type',
'command.test.msgSubtype': 'Message subtype',
'command.test.prefix': 'Prefix',
'command.test.args': 'Arguments',
'command.test.verify': 'Permission level',
'command.test.host': 'Server host',
'command.test.port': 'Server port',
'command.test.lang': 'Language',
'command.test.colorPrimary': 'Primary color',
'command.test.colorSecondary': 'Secondary color',
'command.about.serverInfo.os.android': 'Android %s',
'command.about.serverInfo.os.android.noVersion': 'Android',
'command.about.serverInfo.os.freebsd': 'FreeBSD',
'command.about.serverInfo.os.linux': 'Linux',
'command.about.serverInfo.os.macos': 'macOS',
'command.about.serverInfo.os.macos_old': 'OS X',
'command.about.serverInfo.os': 'Operating system',
'command.about.serverInfo.kernelVer': 'Kernel version',
'command.about.serverInfo.processor': 'CPU',
'command.about.serverInfo.arch': 'Architecture',
'command.about.serverInfo.totalMem': 'Total memory',
'command.about.serverInfo.freeMem': 'Free memory',
'command.about.serverInfo.usedMem': 'Used memory',
'command.about.serverInfo.osUsername': 'Username',
'command.about.serverInfo.hostName': 'Hostname',
'command.about.serverInfo.workingDir': 'Working directory',
'command.about.serverInfo.runTime': 'Bot uptime',
'command.about.serverInfo.upTime': 'System uptime',
'command.about.serverInfo.nodeVersion': 'Node.js version',
'command.about.serverInfo.osRelease': 'Linux release',
'command.about.serverInfo.osRelease.missing': '/etc/os-release does not exist. Information may be limited.',
'command.about.serverInfo.os.android.version': 'Android version',
'command.about.serverInfo.os.android.model': 'Device model',
'command.about.serverInfo.botName': 'Bot name',
'command.about.serverInfo.botVer': 'Bot version',
'command.about.serverListItem': 'Server %s - %s',
'command.about.serverListItem.thisServer': 'Server %s - %s (this server)',
'command.tpr.success': 'Teleporting %s to %s, %s, %s',
'command.verify.success': 'Successfully verified with permission level %s',
'command.error': 'An error occured (check console for more info)',
'command.disallowed.perms.short': 'You do not have permission to run this command.',
'command.disallowed.perms': 'You do not have permission to run this command. If you do have permission, please make sure you put the command hash at the end, or ran the command through the hashing system of your client or proxy.',
'command.disallowed.perms.yourLevel': 'Your permission level: %s',
'command.disallowed.perms.cmdLevel': 'Command requires: %s',
'command.disabled.generic': 'This command has been disabled.',
'command.disabled.local': 'This command has been disabled on this server.',
'command.disabled.console': 'This command cannot be run from the console.',
'command.disabled.nonConsole': 'This command must be run from the console.',
'feature.deprecated': '%s will be removed in the future.',
'feature.deprecated.replace': '%s will be replaced with %s in the future.',
'feature.deprecated.merge': '%s will be merged with %s in the future.',
'feature.removed': '%s has been removed.',
'feature.removed.replace': '%s has been replaced with %s.',
'feature.removed.merge': '%s has been merged with %s.',
'feature.removed.plural': '%s have been removed.',
'feature.removed.replace.plural': '%s have been replaced with %s.',
'feature.removed.merge.plural': '%s have been merged with %s.',
copyText: 'Click to copy this item to your clipboard'
}

View file

@ -1,138 +0,0 @@
{
"language.name": "English",
"language.region": "United States",
"time.week": " week ",
"time.weekPlural": " weeks ",
"time.day": " day ",
"time.dayPlural": " days ",
"time.hour": " hour ",
"time.hourPlural": " hours ",
"time.minute": " minute ",
"time.minutePlural": " minutes ",
"time.second": " second ",
"time.secondPlural": " seconds ",
"chat.antiSpamTriggered": "Anti-spam has been triggered for this server.",
"command.about.usage": "",
"command.about.desc": "About the bot",
"command.cb.usage": " <command>",
"command.cb.desc": "Run a command in a command block",
"command.cloop.usage": " add <rate> <command>|| remove <index>|| list|| clear",
"command.cloop.desc": "Manage command loops",
"command.eval.usage": " <code>",
"command.eval.desc": "Run JavaScript code",
"command.help.usage": " [cmd]",
"command.help.desc": "Shows command help",
"command.logoff.usage": "",
"command.logoff.desc": "Disconnect and reconnect the bot from a server",
"command.netmsg.usage": " <message>",
"command.netmsg.desc": "Send a message to all servers the bot is connected to",
"command.refill.usage": "",
"command.refill.desc": "Refill core",
"command.say.usage": " <message>",
"command.say.desc": "Sends a message to chat",
"command.restart.usage": "",
"command.restart.desc": "Restart bot",
"command.stop.usage": "",
"command.stop.desc": "Stop bot",
"command.template.usage": " <required> [optional]",
"command.template.desc": "Does nothing",
"command.test.usage": " [args...]",
"command.test.desc": "Chat parsing debugger command",
"command.tpr.usage": "",
"command.tpr.desc": "Teleport to a random location",
"command.validate.usage": " [args...]",
"command.validate.desc": "Check the hashing system",
"command.about.author": "%s - a Minecraft bot made by %s for Kaboom and clones",
"command.about.version": "Version %s",
"command.about.preRelease": "This is a development version - there may be errors, and features may be changed or removed at any time. Please report any errors to the bot's developer.",
"command.about.sourceCode": "Source code: %s",
"command.about.license": "This bot is free and open-source software and is available under the terms of the MIT license.",
"command.about.subcommands": "This command has subcommands to find out more about this bot - try running the commands \"servers\" for a list of Minecraft servers the bot is connected to, or \"serverinfo\" for technical specifications of the bot's server.",
"command.about.sourceCode.openInBrowser": "Click to open the source code link in your default browser",
"command.cloop.error.tooShort": "Command loops must have a rate above 20ms.",
"command.cloop.error.subcommand": "Unknown subcommand, please do %s",
"command.cloop.success.add": "Added command loop with command %s and rate %s",
"command.cloop.success.remove": "Removed command loop %s",
"command.cloop.success.clear": "Cleared all command loops",
"command.cloop.list": "%s: Command: %s Rate: %s",
"command.eval.output": "Output",
"command.help.cmdList": "Commands",
"command.help.commandInfo": "%s%s - %s",
"command.help.commandUsage": "Usage - %s%s",
"command.help.commandDesc": "Description - %s",
"command.help.commandPerms": "Required permissions - %s",
"command.help.commandUsage.lf": "Usage - %s%s\n",
"command.help.commandDesc.lf": "Description - %s\n",
"command.help.commandPerms.lf": "Required permissions - %s\n",
"command.help.commandAliases": "Aliases - %s",
"command.help.runCommand": "Click to run command",
"command.help.permsNormal": "Public",
"command.help.permsTrusted": "Trusted",
"command.help.permsOwner": "Owner",
"command.help.noCommand": "Command does not exist",
"command.help.alias": "Alias to %s",
"command.help.copyAlias": "Click to copy this alias to your clipboard",
"command.netmsg.serverAddress": "Server Address",
"command.test.uuid": "UUID",
"command.test.username": "Username",
"command.test.nickname": "Nickname",
"command.test.command": "Command",
"command.test.msgType": "Message type",
"command.test.msgSubtype": "Message subtype",
"command.test.prefix": "Prefix",
"command.test.args": "Arguments",
"command.test.verify": "Permission level",
"command.test.host": "Server host",
"command.test.port": "Server port",
"command.test.lang": "Language",
"command.test.colorPrimary": "Primary color",
"command.test.colorSecondary": "Secondary color",
"command.about.serverInfo.os.android": "Android %s",
"command.about.serverInfo.os.android.noVersion": "Android",
"command.about.serverInfo.os.freebsd": "FreeBSD",
"command.about.serverInfo.os.linux": "Linux",
"command.about.serverInfo.os.macos": "macOS",
"command.about.serverInfo.os.macos_old": "OS X",
"command.about.serverInfo.os": "Operating system",
"command.about.serverInfo.kernelVer": "Kernel version",
"command.about.serverInfo.processor": "CPU",
"command.about.serverInfo.arch": "Architecture",
"command.about.serverInfo.totalMem": "Total memory",
"command.about.serverInfo.freeMem": "Free memory",
"command.about.serverInfo.usedMem": "Used memory",
"command.about.serverInfo.osUsername": "Username",
"command.about.serverInfo.hostName": "Hostname",
"command.about.serverInfo.workingDir": "Working directory",
"command.about.serverInfo.runTime": "Bot uptime",
"command.about.serverInfo.upTime": "System uptime",
"command.about.serverInfo.nodeVersion": "Node.js version",
"command.about.serverInfo.osRelease": "Linux release",
"command.about.serverInfo.osRelease.missing": "/etc/os-release does not exist. Information may be limited.",
"command.about.serverInfo.os.android.version": "Android version",
"command.about.serverInfo.os.android.model": "Device model",
"command.about.serverInfo.botName": "Bot name",
"command.about.serverInfo.botVer": "Bot version",
"command.about.serverListItem": "Server %s - %s",
"command.about.serverListItem.thisServer": "Server %s - %s (this server)",
"command.tpr.success": "Teleporting %s to %s, %s, %s",
"command.verify.success": "Successfully verified with permission level %s",
"command.error": "An error occured (check console for more info)",
"command.disallowed.perms.short": "You do not have permission to run this command.",
"command.disallowed.perms": "You do not have permission to run this command. If you do have permission, please make sure you put the command hash at the end, or ran the command through the hashing system of your client or proxy.",
"command.disallowed.perms.yourLevel": "Your permission level: %s",
"command.disallowed.perms.cmdLevel": "Command requires: %s",
"command.disabled.generic": "This command has been disabled.",
"command.disabled.local": "This command has been disabled on this server.",
"command.disabled.console": "This command cannot be run from the console.",
"command.disabled.nonConsole": "This command must be run from the console.",
"feature.deprecated": "%s will be removed in the future.",
"feature.deprecated.replace": "%s will be replaced with %s in the future.",
"feature.deprecated.merge": "%s will be merged with %s in the future.",
"feature.removed": "%s has been removed.",
"feature.removed.replace": "%s has been replaced with %s.",
"feature.removed.merge": "%s has been merged with %s.",
"feature.removed.plural": "%s have been removed.",
"feature.removed.replace.plural": "%s have been replaced with %s.",
"feature.removed.merge.plural": "%s have been merged with %s.",
"copyText": "Click to copy this item to your clipboard"
}

View file

@ -1,6 +1,6 @@
import chatlog from '../util/chatlog.js' import chatlog from '../util/chatlog.js'
import { readdirSync, mkdirSync } from "node:fs" import { readdirSync, mkdirSync } from 'node:fs'
import { default as settings } from '../settings.js' import settings from '../settings.js'
const checkLog = () => { const checkLog = () => {
if (settings.disableLogging) return if (settings.disableLogging) return
@ -20,7 +20,6 @@ const checkLog = () => {
setInterval(checkLog, 3600000) // Runs once every hour, setInterval(checkLog, 3600000) // Runs once every hour,
checkLog() // and at bot startup. checkLog() // and at bot startup.
export default function load (b) { export default function load (b) {
b.on('plainchat', (msg, type) => { b.on('plainchat', (msg, type) => {
if (!settings.disableLogging && !settings.disableChatLogging) chatlog(`chat_${b.host.host}_${b.host.port}`, `[${type}] ${msg}`) if (!settings.disableLogging && !settings.disableChatLogging) chatlog(`chat_${b.host.host}_${b.host.port}`, `[${type}] ${msg}`)

View file

@ -1,5 +1,5 @@
import cmds from "../util/commands.js" import cmds from '../util/commands.js'
import { default as settings } from '../settings.js' import settings from '../settings.js'
import Command from '../util/Command.js' import Command from '../util/Command.js'
export default function load (b) { export default function load (b) {
b.on('chat', (data) => { b.on('chat', (data) => {
@ -11,18 +11,18 @@ export default function load (b) {
} }
} }
}) })
b.runCommand = function (user, nick, uuid, command, type, subtype, prefix){ b.runCommand = function (user, nick, uuid, command, type, subtype, prefix) {
const context = new Command(uuid, user, nick, command, "minecraft", type, subtype, prefix, b, 0) const context = new Command(uuid, user, nick, command, 'minecraft', type, subtype, prefix, b, 0)
b.emit('command', context) b.emit('command', context)
if(cmds[context.cmdName.toLowerCase()]){ if (cmds[context.cmdName.toLowerCase()]) {
try { try {
cmds[context.cmdName.toLowerCase()].execute(context) cmds[context.cmdName.toLowerCase()].execute(context)
} catch (e) { } catch (e) {
console.log(e) console.log(e)
context.reply({ context.reply({
text: "An error occured (check console)" text: 'An error occured (check console)'
}) })
} }
} }

View file

@ -1,6 +1,6 @@
import { default as uuidToInt } from '../util/uuidtoint.js' import uuidToInt from '../util/uuidtoint.js'
import { default as plainParser } from '../util/chatparse_plain.js' import plainParser from '../util/chatparse_plain.js'
import { default as mcParser } from '../util/chatparse_mc.js' import mcParser from '../util/chatparse_mc.js'
const cs = { const cs = {
x: 4, x: 4,
y: 6, y: 6,

View file

@ -1,21 +1,21 @@
import { createInterface, cursorTo, clearLine } from "node:readline" import { createInterface, cursorTo, clearLine } from 'node:readline'
import { default as settings } from '../settings.js' import settings from '../settings.js'
import cmds from "../util/commands.js" import cmds from '../util/commands.js'
import { bots } from "../index.js" import { bots } from '../index.js'
import Command from '../util/Command.js' import Command from '../util/Command.js'
import parse2 from "../util/chatparse_console.js" import parse2 from '../util/chatparse_console.js'
import { userInfo } from "node:os" import { userInfo } from 'node:os'
const consoleBotStub = { const consoleBotStub = {
host: { host: {
host: "bot console ", host: 'bot console ',
port: 3 port: 3
}, },
tellraw: (_unused, data) => console.log(parse2(data)) tellraw: (_unused, data) => console.log(parse2(data))
} }
const uuid = "4d616465-6c69-6e65-2075-7775203a3300" const uuid = '4d616465-6c69-6e65-2075-7775203a3300'
const user = userInfo().username // OS user the bot is running as const user = userInfo().username // OS user the bot is running as
const nick = "console" const nick = user
const rl = createInterface({ const rl = createInterface({
input: process.stdin, input: process.stdin,
@ -29,16 +29,16 @@ rl.on('line', (l) => {
const tmpcmd = l.split(' ') const tmpcmd = l.split(' ')
const index2 = tmpcmd.splice(1, 1)[0] const index2 = tmpcmd.splice(1, 1)[0]
if (index2 === '*') { if (index2 === '*') {
for (let i = 0; i < index.bots.length; i++) { for (let i = 0; i < bots.length; i++) {
const cmd = new Command(uuid, user, nick, tmpcmd.join(' '), "console", "console", "console", "", bots[i], 2, {}) const cmd = new Command(uuid, user, nick, tmpcmd.join(' '), 'console', 'console', 'console', '', bots[i], 2, {})
cmds[l.split(' ')[0].toLowerCase()].execute(cmd) cmds[l.split(' ')[0].toLowerCase()].execute(cmd)
} }
} else { } else {
const cmd = new Command(uuid, user, nick, tmpcmd.join(' '), "console", "console", "console", "", bots[+index2], 2, {}) const cmd = new Command(uuid, user, nick, tmpcmd.join(' '), 'console', 'console', 'console', '', bots[+index2], 2, {})
cmds[l.split(' ')[0].toLowerCase()].execute(cmd) cmds[l.split(' ')[0].toLowerCase()].execute(cmd)
} }
} else { } else {
const cmd = new Command(uuid, user, nick, l, "console", "console", "console", "", consoleBotStub, 2, {}) const cmd = new Command(uuid, user, nick, l, 'console', 'console', 'console', '', consoleBotStub, 2, {})
cmds[l.split(' ')[0].toLowerCase()].execute(cmd) cmds[l.split(' ')[0].toLowerCase()].execute(cmd)
} }
} }

View file

@ -1,15 +1,15 @@
import { default as settings } from '../settings.js' import settings from '../settings.js'
import { default as version } from '../version.json' with {type: "json"} import version from '../version.js'
import { bots } from "../index.js" import { bots } from '../index.js'
import botVersion from "../util/version.js" import botVersion from '../util/version.js'
import chatlog from '../util/chatlog.js' import chatlog from '../util/chatlog.js'
process.on("uncaughtException",(e, o)=>{ process.on('uncaughtException', (e, o) => {
for(const i in bots){ for (const i in bots) {
try{ try {
bots[i].ccq[0]=`/tellraw ${version.botAuthor} ${ bots[i].ccq[0] = `/tellraw ${version.botAuthor} ${
JSON.stringify({ JSON.stringify({
translate: "%s\n", translate: '%s\n',
color: settings.colors.fatalError, color: settings.colors.fatalError,
with: [ with: [
`An error occured and ${version.botName} will now shut down.` `An error occured and ${version.botName} will now shut down.`
@ -17,9 +17,9 @@ process.on("uncaughtException",(e, o)=>{
}) })
}` }`
bots[i].advanceccq() bots[i].advanceccq()
const stack = e.stack.split("\n") const stack = e.stack.split('\n')
for(const item of stack){ for (const item of stack) {
bots[i].ccq[0]=`/tellraw ${version.botAuthor} ${ bots[i].ccq[0] = `/tellraw ${version.botAuthor} ${
JSON.stringify({ JSON.stringify({
text: item, text: item,
color: settings.colors.fatalError color: settings.colors.fatalError
@ -27,13 +27,13 @@ process.on("uncaughtException",(e, o)=>{
}` }`
bots[i].advanceccq() bots[i].advanceccq()
} }
bots[i].ccq[0]=`/tellraw ${version.botAuthor} ${ bots[i].ccq[0] = `/tellraw ${version.botAuthor} ${
JSON.stringify({ JSON.stringify({
translate: "\n%s", translate: '\n%s',
color: settings.colors.fatalError, color: settings.colors.fatalError,
with: [ with: [
[ [
"Additional info:\n", 'Additional info:\n',
`Bot version: ${botVersion}` `Bot version: ${botVersion}`
] ]
] ]
@ -42,7 +42,7 @@ process.on("uncaughtException",(e, o)=>{
bots[i].advanceccq() // Force the command queue to advance bots[i].advanceccq() // Force the command queue to advance
} catch (e) {} } catch (e) {}
} }
chatlog("error", e.stack) chatlog('error', e.stack)
console.error(e) console.error(e)
process.exit(1) process.exit(1)
}) })

View file

@ -1,5 +1,5 @@
import { default as parse } from '../util/chatparse_plain.js' import parse from '../util/chatparse_plain.js'
import { default as parseNBT } from '../util/parseNBT.js' import parseNBT from '../util/parseNBT.js'
export default function load (b) { export default function load (b) {
b.players = {} b.players = {}

View file

@ -1,4 +1,4 @@
import { createBot } from "../index.js" import { createBot } from '../index.js'
export default function load (b) { export default function load (b) {
b._client.on('end', () => { b._client.on('end', () => {
b.info(`Bot ${b.id} disconnected`) b.info(`Bot ${b.id} disconnected`)

View file

@ -1,7 +1,7 @@
import { default as parsePlain } from '../util/chatparse_plain.js' import parsePlain from '../util/chatparse_plain.js'
import { default as parseMc } from '../util/chatparse_mc_withHex.js' import parseMc from '../util/chatparse_mc_withHex.js'
import { default as settings } from '../settings.js' import settings from '../settings.js'
import { default as version } from '../version.json' with {type: "json"} import version from '../version.js'
class SCTask { class SCTask {
constructor (failTask, startFailed = false) { constructor (failTask, startFailed = false) {
/* /*
@ -13,11 +13,10 @@ class SCTask {
} }
} }
export default function load (b) { export default function load (b) {
b.sc_tasks = {} b.sc_tasks = {}
b.selfcareRun = 0 b.selfcareRun = 0
b._client.on("login", ()=>{ b._client.on('login', () => {
b.interval.sc = setInterval(() => { b.interval.sc = setInterval(() => {
if (Date.now() - b.selfcareRun <= 600) { if (Date.now() - b.selfcareRun <= 600) {
return return

View file

@ -1,9 +1,9 @@
import { default as settings } from '../settings.js' import settings from '../settings.js'
import { default as parsePlain } from '../util/chatparse_plain.js' import parsePlain from '../util/chatparse_plain.js'
import { default as parseConsole } from '../util/chatparse_console.js' import parseConsole from '../util/chatparse_console.js'
import { default as parse1204 } from '../util/parseNBT.js' import parse1204 from '../util/parseNBT.js'
import { getMessage } from '../util/lang.js' import { getMessage } from '../util/lang.js'
import { readdirSync } from "node:fs" import { readdirSync } from 'node:fs'
const convertChatStyleItem = (item) => { const convertChatStyleItem = (item) => {
const output = {} const output = {}
for (const i in item) { for (const i in item) {
@ -38,13 +38,12 @@ for (const plugin of bpl) {
continue continue
} }
try { try {
import(`../chatParsers/${plugin}`).then((pluginItem)=>{ import(`../chatParsers/${plugin}`).then((pluginItem) => {
parsers[pluginItem.priority].push(pluginItem.parse) parsers[pluginItem.priority].push(pluginItem.parse)
}) })
} catch (e) { console.log(e) } } catch (e) { console.log(e) }
} }
export default function load (b) { export default function load (b) {
b.messageCount = 0 b.messageCount = 0
b.chatDisabledUntil = 0 b.chatDisabledUntil = 0
@ -58,16 +57,16 @@ export default function load (b) {
nbtItems.forEach((item, i) => { nbtItems.forEach((item, i) => {
b.messageTypes[i] = convertChatTypeItem(item.element.value.chat.value) b.messageTypes[i] = convertChatTypeItem(item.element.value.chat.value)
}) })
} else if(data.entries && data.id == 'minecraft:chat_type'){ } else if (data.entries && data.id === 'minecraft:chat_type') {
data.entries.forEach((item, i)=>{ data.entries.forEach((item, i) => {
b.messageTypes[i] = convertChatTypeItem(data.entries[i].value.value.chat.value) b.messageTypes[i] = convertChatTypeItem(data.entries[i].value.value.chat.value)
}) })
} }
}) })
b._client.on('profileless_chat', (data) => { b._client.on('profileless_chat', (data) => {
let messageType; let messageType
if(data.type.registryIndex){ if (data.type.registryIndex) {
messageType = b.messageTypes[data.type.registryIndex-1] messageType = b.messageTypes[data.type.registryIndex - 1]
} else { } else {
messageType = b.messageTypes[data.type] messageType = b.messageTypes[data.type]
} }
@ -101,9 +100,9 @@ export default function load (b) {
}) })
b._client.on('player_chat', (data) => { b._client.on('player_chat', (data) => {
let messageType; let messageType
if(data.type.registryIndex){ if (data.type.registryIndex) {
messageType = b.messageTypes[data.type.registryIndex-1] messageType = b.messageTypes[data.type.registryIndex - 1]
} else { } else {
messageType = b.messageTypes[data.type] messageType = b.messageTypes[data.type]
} }

View file

@ -1,36 +1,35 @@
export default { export default {
"terminalMode": "blackTerminal_24bit", terminalMode: 'blackTerminal_24bit', // Terminal mode. Most modern terminals support 24-bit color
"version_mc": "1.21.1", version_mc: '1.21.1', // Minecraft version to connect with
"displaySubtypesToConsole": true, defaultLang: 'en-US', // Default language
"defaultLang": "en-US", colors: { // All colors the bot uses
"colors": { secondary: '#DD99FF',
"secondary": "#DD99FF", primary: '#EECCFF',
"primary": "#EECCFF", tertiary: 'white',
"tertiary": "white", warning: '#FFAA33',
"warning": "#FFAA33", error: '#FF6688',
"error": "#FF6688", fatalError: '#BB3344'
"fatalError": "#BB3344"
}, },
"prefixes": [ prefixes: [ // A list of prefixes the bot will respond to in-game
"ubotesm:", 'ubotesm:',
"ubotdev:", 'ubotdev:',
"es\"", 'es"',
"d\"" 'd"'
], ],
"servers": [ servers: [ // Server list
{ {
"host": "kaboom.pw", host: 'kaboom.pw', // Server address
"port": 25565, port: 25565, // Server port. The default is 25565.
"options": { options: {
"name": "kaboom" name: 'kaboom' // Server name in netmsg
} }
}, },
{ {
"host": "chipmunk.land", host: 'chipmunk.land',
"port": 25565, port: 25565,
"options": { options: {
"name": "chipmunk" name: 'chipmunk'
} }
} }
] ]

View file

@ -1,14 +1,14 @@
import { default as settings } from '../settings.js' import settings from '../settings.js'
export default class Command { export default class Command {
constructor (uuid, user, nick, cmd, senderType, msgType, msgSubtype, prefix, bot, verify) { constructor (uuid, user, nick, cmd, senderType, msgType, msgSubtype, prefix, bot, verify) {
this.uuid=uuid; this.uuid = uuid
this.reply = text => bot.tellraw(uuid, text) this.reply = text => bot.tellraw(uuid, text)
this.username = user; this.username = user
this.nickname = nick; this.nickname = nick
this.command = cmd; this.command = cmd
this.type = senderType; this.type = senderType
this.msgType = msgType; this.msgType = msgType
this.msgSubtype = msgSubtype; this.msgSubtype = msgSubtype
this.args = cmd.split(' ').slice(1) this.args = cmd.split(' ').slice(1)
this.cmdName = cmd.split(' ')[0] this.cmdName = cmd.split(' ')[0]
this.prefix = prefix this.prefix = prefix

View file

@ -1,5 +1,5 @@
import { appendFileSync } from 'node:fs' import { appendFileSync } from 'node:fs'
import { default as settings } from '../settings.js' import settings from '../settings.js'
export default function chatlog (fileName, item) { export default function chatlog (fileName, item) {
if (settings.disableLogging) return if (settings.disableLogging) return

View file

@ -1,6 +1,188 @@
import { default as settings } from '../settings.js' import settings from '../settings.js'
import lang from './mc_lang.js' import lang from './mc_lang.js'
import { default as _consoleColors } from './consolecolors.json' with {type: "json"}
const _consoleColors = {
blackTerminal_24bit: {
fourBit: {
dark_red: '\u001B[0;38;2;170;0;0m',
red: '\u001B[0;38;2;255;85;85m',
dark_green: '\u001B[0;38;2;0;170;0m',
green: '\u001B[0;38;2;85;255;85m',
gold: '\u001B[0;38;2;255;170;0m',
yellow: '\u001B[0;38;2;255;255;85m',
dark_blue: '\u001B[0;38;2;0;0;170m',
blue: '\u001B[0;38;2;85;85;255m',
dark_purple: '\u001B[0;38;2;170;0;170m',
light_purple: '\u001B[0;38;2;255;85;255m',
dark_aqua: '\u001B[0;38;2;0;170;170m',
aqua: '\u001B[0;38;2;85;255;255m',
black: '\u001B[0;48;2;220;220;220;38;2;0;0;0m',
gray: '\u001B[0;38;2;170;170;170m',
dark_gray: '\u001B[0;38;2;85;85;85m',
white: '\u001B[0;38;2;255;255;255m',
reset: '\u001B[0;38;2;255;255;255m'
},
twentyFourBit: {
enabled: true,
bit: 24,
lightMode: false
}
},
whiteTerminal_24bit: {
fourBit: {
dark_red: '\u001B[0;38;2;170;0;0m',
red: '\u001B[0;38;2;255;85;85m',
dark_green: '\u001B[0;38;2;0;170;0m',
green: '\u001B[0;48;2;20;20;20;38;2;85;255;85m',
gold: '\u001B[0;38;2;255;170;0m',
yellow: '\u001B[0;48;2;20;20;20;38;2;255;255;85m',
dark_blue: '\u001B[0;38;2;0;0;170m',
blue: '\u001B[0;38;2;85;85;255m',
dark_purple: '\u001B[0;38;2;170;0;170m',
light_purple: '\u001B[0;38;2;255;85;255m',
dark_aqua: '\u001B[0;38;2;0;170;170m',
aqua: '\u001B[0;48;2;20;20;20;38;2;85;255;255m',
black: '\u001B[0;38;2;0;0;0m',
gray: '\u001B[0;38;2;170;170;170m',
dark_gray: '\u001B[0;38;2;85;85;85m',
white: '\u001B[0;48;2;20;20;20;38;2;255;255;255m',
reset: '\u001B[0;48;2;20;20;20;38;2;255;255;255m'
},
twentyFourBit: {
enabled: true,
bit: 24,
lightMode: true
}
},
blackTerminal_8bit: {
fourBit: {
dark_red: '\u001B[0;38;5;124m',
red: '\u001B[0;38;5;203m',
dark_green: '\u001B[0;38;5;34m',
green: '\u001B[0;38;5;83m',
gold: '\u001B[0;38;5;214m',
yellow: '\u001B[0;38;5;227m',
dark_blue: '\u001B[0;38;5;19m',
blue: '\u001B[0;38;5;63m',
dark_purple: '\u001B[0;38;5;127m',
light_purple: '\u001B[0;38;5;207m',
dark_aqua: '\u001B[0;38;5;37m',
aqua: '\u001B[0;38;5;87m',
black: '\u001B[0;48;5;253;38;5;16m',
gray: '\u001B[0;38;5;145m',
dark_gray: '\u001B[0;38;5;59m',
white: '\u001B[0;38;5;231m',
reset: '\u001B[0;38;5;231m'
},
twentyFourBit: {
enabled: true,
bit: 8,
lightMode: false
}
},
whiteTerminal_8bit: {
fourBit: {
dark_red: '\u001B[0;38;5;124m',
red: '\u001B[0;38;5;203m',
dark_green: '\u001B[0;38;5;34m',
green: '\u001B[0;48;5;16;38;5;83m',
gold: '\u001B[0;38;5;214m',
yellow: '\u001B[0;48;5;16;38;5;227m',
dark_blue: '\u001B[0;38;5;19m',
blue: '\u001B[0;38;5;63m',
dark_purple: '\u001B[0;38;5;127m',
light_purple: '\u001B[0;38;5;207m',
dark_aqua: '\u001B[0;38;5;37m',
aqua: '\u001B[0;48;5;16;38;5;87m',
black: '\u001B[0;38;5;16m',
gray: '\u001B[0;38;5;145m',
dark_gray: '\u001B[0;38;5;59m',
white: '\u001B[0;48;5;16;38;5;231m',
reset: '\u001B[0;48;5;16;38;5;231m'
},
twentyFourBit: {
enabled: true,
bit: 8,
lightMode: true
}
},
blackTerminal_4bit: {
fourBit: {
dark_red: '\u001B[0;31m',
red: '\u001B[0;1;31m',
dark_green: '\u001B[0;32m',
green: '\u001B[0;1;32m',
gold: '\u001B[0;33m',
yellow: '\u001B[0;1;33m',
dark_blue: '\u001B[0;34m',
blue: '\u001B[0;1;34m',
dark_purple: '\u001B[0;35m',
light_purple: '\u001B[0;1;35m',
dark_aqua: '\u001B[0;36m',
aqua: '\u001B[0;1;36m',
black: '\u001B[0;1;47;30m',
gray: '\u001B[0;37m',
dark_gray: '\u001B[0;1;30m',
white: '\u001B[0;1;37m',
reset: '\u001B[0;1;37m'
},
twentyFourBit: {
enabled: true,
bit: 4,
lightMode: false
}
},
whiteTerminal_4bit: {
fourBit: {
dark_red: '\u001B[0;31m',
red: '\u001B[0;1;31m',
dark_green: '\u001B[0;32m',
green: '\u001B[0;40;1;32m',
gold: '\u001B[0;33m',
yellow: '\u001B[0;40;1;33m',
dark_blue: '\u001B[0;34m',
blue: '\u001B[0;1;34m',
dark_purple: '\u001B[0;35m',
light_purple: '\u001B[0;1;35m',
dark_aqua: '\u001B[0;36m',
aqua: '\u001B[0;40;1;36m',
black: '\u001B[0;30m',
gray: '\u001B[0;37m',
dark_gray: '\u001B[0;1;30m',
white: '\u001B[0;40;1;37m',
reset: '\u001B[0;40;1;37m'
},
twentyFourBit: {
enabled: true,
bit: 4,
lightMode: true
}
},
none: {
fourBit: {
dark_red: '',
red: '',
dark_green: '',
green: '',
gold: '',
yellow: '',
dark_blue: '',
blue: '',
dark_purple: '',
light_purple: '',
dark_aqua: '',
aqua: '',
black: '',
gray: '',
dark_gray: '',
white: '',
reset: ''
},
twentyFourBit: {
enabled: false
}
}
}
let consoleColors let consoleColors
let consoleColors24 let consoleColors24

View file

@ -1,6 +1,6 @@
const cmds = Object.create(null) import { readdirSync } from 'node:fs'
import { readdirSync } from "node:fs" const cmds = Object.create(null)
const bpl = readdirSync('commands') const bpl = readdirSync('commands')
for (const plugin of bpl) { for (const plugin of bpl) {
@ -9,7 +9,7 @@ for (const plugin of bpl) {
} }
try { try {
const commandName = plugin.split('.js')[0] const commandName = plugin.split('.js')[0]
import(`../commands/${plugin}`).then((pluginItem)=>{ import(`../commands/${plugin}`).then((pluginItem) => {
cmds[commandName] = pluginItem // For rejoining cmds[commandName] = pluginItem // For rejoining
if (cmds[commandName].aliases) { if (cmds[commandName].aliases) {
for (const j in cmds[commandName].aliases) { for (const j in cmds[commandName].aliases) {

View file

@ -1,182 +0,0 @@
{
"blackTerminal_24bit":{
"fourBit":{
"dark_red": "\u001B[0;38;2;170;0;0m",
"red": "\u001B[0;38;2;255;85;85m",
"dark_green": "\u001B[0;38;2;0;170;0m",
"green": "\u001B[0;38;2;85;255;85m",
"gold": "\u001B[0;38;2;255;170;0m",
"yellow": "\u001B[0;38;2;255;255;85m",
"dark_blue": "\u001B[0;38;2;0;0;170m",
"blue": "\u001B[0;38;2;85;85;255m",
"dark_purple": "\u001B[0;38;2;170;0;170m",
"light_purple": "\u001B[0;38;2;255;85;255m",
"dark_aqua": "\u001B[0;38;2;0;170;170m",
"aqua": "\u001B[0;38;2;85;255;255m",
"black": "\u001B[0;48;2;220;220;220;38;2;0;0;0m",
"gray": "\u001B[0;38;2;170;170;170m",
"dark_gray": "\u001B[0;38;2;85;85;85m",
"white": "\u001B[0;38;2;255;255;255m",
"reset": "\u001B[0;38;2;255;255;255m"
},
"twentyFourBit":{
"enabled": true,
"bit": 24,
"lightMode": false
}
},
"whiteTerminal_24bit":{
"fourBit":{
"dark_red": "\u001B[0;38;2;170;0;0m",
"red": "\u001B[0;38;2;255;85;85m",
"dark_green": "\u001B[0;38;2;0;170;0m",
"green": "\u001B[0;48;2;20;20;20;38;2;85;255;85m",
"gold": "\u001B[0;38;2;255;170;0m",
"yellow": "\u001B[0;48;2;20;20;20;38;2;255;255;85m",
"dark_blue": "\u001B[0;38;2;0;0;170m",
"blue": "\u001B[0;38;2;85;85;255m",
"dark_purple": "\u001B[0;38;2;170;0;170m",
"light_purple": "\u001B[0;38;2;255;85;255m",
"dark_aqua": "\u001B[0;38;2;0;170;170m",
"aqua": "\u001B[0;48;2;20;20;20;38;2;85;255;255m",
"black": "\u001B[0;38;2;0;0;0m",
"gray": "\u001B[0;38;2;170;170;170m",
"dark_gray": "\u001B[0;38;2;85;85;85m",
"white": "\u001B[0;48;2;20;20;20;38;2;255;255;255m",
"reset": "\u001B[0;48;2;20;20;20;38;2;255;255;255m"
},
"twentyFourBit":{
"enabled": true,
"bit": 24,
"lightMode": true
}
},
"blackTerminal_8bit":{
"fourBit":{
"dark_red": "\u001B[0;38;5;124m",
"red": "\u001B[0;38;5;203m",
"dark_green": "\u001B[0;38;5;34m",
"green": "\u001B[0;38;5;83m",
"gold": "\u001B[0;38;5;214m",
"yellow": "\u001B[0;38;5;227m",
"dark_blue": "\u001B[0;38;5;19m",
"blue": "\u001B[0;38;5;63m",
"dark_purple": "\u001B[0;38;5;127m",
"light_purple": "\u001B[0;38;5;207m",
"dark_aqua": "\u001B[0;38;5;37m",
"aqua": "\u001B[0;38;5;87m",
"black": "\u001B[0;48;5;253;38;5;16m",
"gray": "\u001B[0;38;5;145m",
"dark_gray": "\u001B[0;38;5;59m",
"white": "\u001B[0;38;5;231m",
"reset": "\u001B[0;38;5;231m"
},
"twentyFourBit":{
"enabled": true,
"bit": 8,
"lightMode": false
}
},
"whiteTerminal_8bit":{
"fourBit":{
"dark_red": "\u001B[0;38;5;124m",
"red": "\u001B[0;38;5;203m",
"dark_green": "\u001B[0;38;5;34m",
"green": "\u001B[0;48;5;16;38;5;83m",
"gold": "\u001B[0;38;5;214m",
"yellow": "\u001B[0;48;5;16;38;5;227m",
"dark_blue": "\u001B[0;38;5;19m",
"blue": "\u001B[0;38;5;63m",
"dark_purple": "\u001B[0;38;5;127m",
"light_purple": "\u001B[0;38;5;207m",
"dark_aqua": "\u001B[0;38;5;37m",
"aqua": "\u001B[0;48;5;16;38;5;87m",
"black": "\u001B[0;38;5;16m",
"gray": "\u001B[0;38;5;145m",
"dark_gray": "\u001B[0;38;5;59m",
"white": "\u001B[0;48;5;16;38;5;231m",
"reset": "\u001B[0;48;5;16;38;5;231m"
},
"twentyFourBit":{
"enabled": true,
"bit": 8,
"lightMode": true
}
},
"blackTerminal_4bit":{
"fourBit":{
"dark_red": "\u001B[0;31m",
"red": "\u001B[0;1;31m",
"dark_green": "\u001B[0;32m",
"green": "\u001B[0;1;32m",
"gold": "\u001B[0;33m",
"yellow": "\u001B[0;1;33m",
"dark_blue": "\u001B[0;34m",
"blue": "\u001B[0;1;34m",
"dark_purple": "\u001B[0;35m",
"light_purple": "\u001B[0;1;35m",
"dark_aqua": "\u001B[0;36m",
"aqua": "\u001B[0;1;36m",
"black": "\u001B[0;1;47;30m",
"gray": "\u001B[0;37m",
"dark_gray": "\u001B[0;1;30m",
"white": "\u001B[0;1;37m",
"reset": "\u001B[0;1;37m"
},
"twentyFourBit":{
"enabled": true,
"bit": 4,
"lightMode": false
}
},
"whiteTerminal_4bit":{
"fourBit":{
"dark_red": "\u001B[0;31m",
"red": "\u001B[0;1;31m",
"dark_green": "\u001B[0;32m",
"green": "\u001B[0;40;1;32m",
"gold": "\u001B[0;33m",
"yellow": "\u001B[0;40;1;33m",
"dark_blue": "\u001B[0;34m",
"blue": "\u001B[0;1;34m",
"dark_purple": "\u001B[0;35m",
"light_purple": "\u001B[0;1;35m",
"dark_aqua": "\u001B[0;36m",
"aqua": "\u001B[0;40;1;36m",
"black": "\u001B[0;30m",
"gray": "\u001B[0;37m",
"dark_gray": "\u001B[0;1;30m",
"white": "\u001B[0;40;1;37m",
"reset": "\u001B[0;40;1;37m"
},
"twentyFourBit":{
"enabled": true,
"bit": 4,
"lightMode": true
}
},
"none":{
"fourBit":{
"dark_red": "",
"red": "",
"dark_green": "",
"green": "",
"gold": "",
"yellow": "",
"dark_blue": "",
"blue": "",
"dark_purple": "",
"light_purple": "",
"dark_aqua": "",
"aqua": "",
"black": "",
"gray": "",
"dark_gray": "",
"white": "",
"reset": ""
},
"twentyFourBit":{
"enabled": false
}
}
}

View file

@ -1,16 +1,16 @@
import { readdirSync } from "node:fs" import { readdirSync } from 'node:fs'
import settings from '../settings.js'
const languages = {} const languages = {}
import { default as settings } from '../settings.js'
const fallbackLocale = settings.fallbackLocale ? settings.fallbackLocale : 'en-US' const fallbackLocale = settings.fallbackLocale ? settings.fallbackLocale : 'en-US'
const loadplug = () => { const loadplug = () => {
const bpl = readdirSync('lang') const bpl = readdirSync('lang')
for (const plugin of bpl) { for (const plugin of bpl) {
if (!plugin.endsWith('.json')) { if (!plugin.endsWith('.js')) {
continue continue
} }
try { try {
import(`../lang/${plugin}`, {with: {type: "json"}}).then(languageFile => { import(`../lang/${plugin}`).then(languageFile => {
languages[plugin.split('.')[0]] = languageFile.default languages[plugin.split('.')[0]] = languageFile.default
}) })
} catch (e) { console.log(e) } } catch (e) { console.log(e) }
@ -34,7 +34,7 @@ const getMessage = function (l, msg, with2) {
return message.replace(/\ue123/g, '%').replace(/\ue124/g, '%s').replace(/\ue125/g, '$s') return message.replace(/\ue123/g, '%').replace(/\ue124/g, '%s').replace(/\ue125/g, '$s')
} }
const languages_keys = Object.keys(languages) const languagesKeys = Object.keys(languages)
const formatTime = function (time, language) { const formatTime = function (time, language) {
let finalString = '' let finalString = ''
const seconds = Math.floor(time / 1000) % 60 const seconds = Math.floor(time / 1000) % 60
@ -66,7 +66,7 @@ const formatTime = function (time, language) {
} }
export { export {
languages_keys as languages, languagesKeys as languages,
formatTime, formatTime,
getMessage getMessage
} }

View file

@ -12,5 +12,4 @@ export default function memoryconvert (bytes) {
} else { // Bytes } else { // Bytes
return `${bytes} B` return `${bytes} B`
} }
} }

View file

@ -1,4 +1,4 @@
import { randomBytes } from "crypto"; import { randomBytes } from 'crypto'
const rsg = function (count) { const rsg = function (count) {
let output = '' let output = ''
for (let i = 0; i < count; i++) { for (let i = 0; i < count; i++) {

View file

@ -1,5 +1,5 @@
import { default as version } from "../version.json" with { type: "json" } import version from '../version.js'
import { execSync } from "child_process" import { execSync } from 'child_process'
let botVersion = version.botVersion let botVersion = version.botVersion
let gitCommit let gitCommit
let gitBranch let gitBranch

7
version.js Normal file
View file

@ -0,0 +1,7 @@
export default {
botName: 'botv12 Dev',
botVersion: '12.0.0-alpha.1',
botAuthor: 'owo439895035',
isPreRelease: true,
sourceURL: 'https://code.chipmunk.land/7cc5c4f330d47060/botv12'
}

View file

@ -1,7 +0,0 @@
{
"botName": "botv12 Dev",
"botVersion": "12.0.0-alpha.1",
"botAuthor": "owo439895035",
"isPreRelease": true,
"sourceURL": "https://code.chipmunk.land/7cc5c4f330d47060/botv12"
}