This commit is contained in:
7cc5c4f330d47060 2024-08-22 07:34:39 -04:00
parent b950a12be3
commit 63fa2242ab
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA
50 changed files with 300 additions and 1231 deletions

View file

@ -2,17 +2,13 @@
## What is it?
botvX is a Minecraft bot for [Kaboom](https://kaboom.pw/) and its clones. It has many of the features that you would expect in a modern Kaboom bot:
botvX is a Minecraft bot originally designed for [Kaboom](https://kaboom.pw/) and its clones. It has many of the features that you would expect in a modern Kaboom bot:
- commands (obviously)
- a self care system
- a command core, to run commands quickly
- a hashing system, to enable trusted users to securely run certain commands in chat
## What does "botvX" mean?
"botvX" means "bot version 10". The v is used to signify that whatever after it is a version, as was done with previous versions (botv4, botv6, botv8, botv9), and the X is the Roman numeral for 10, since this is the 10th major version.
## How to install?
1. Install [Node.js](https://nodejs.org/) for your operating system.

View file

@ -4,6 +4,7 @@ const { getMessage, formatTime } = require('../util/lang.js')
const fs = require('fs')
const botVersion = require('../util/version.js')
const version = require('../version.json')
const index = require('../index.js')
const aboutBot = function (c) {
c.reply({
@ -55,13 +56,13 @@ const aboutBot = function (c) {
const os2 = function (o2, l) {
switch (o2) {
case 'win32':
return `${os.version()} (${os.release})`
return `${os.version()}`
case 'android':{
try {
const version = cp.execSync('getprop ro.build.version.release').toString('UTF-8').split('\n')[0]
return getMessage(l, 'command.about.serverInfo.os.android', [version])
} catch (e) {
getMessage(l, 'command.about.serverInfo.os.android.noVersion')
return getMessage(l, 'command.about.serverInfo.os.android.noVersion')
}
}
case 'linux':
@ -69,20 +70,20 @@ const os2 = function (o2, l) {
if (fs.readdirSync('/etc').includes('os-release')) {
const osrelease = fs.readFileSync('/etc/os-release').toString('UTF-8').split('\n')
const osrelease2 = {}
for (const i in osrelease) {
if (!osrelease[i].includes('=')) continue
let osrvalue = osrelease[i].split('=')[1]
for (const item of osrelease) {
if (!item.includes('=')) continue
let osrvalue = item.split('=')[1]
if (osrvalue.startsWith('"') && osrvalue.endsWith('"')) { osrvalue = osrvalue.slice(1, osrvalue.length - 1) };
osrelease2[osrelease[i].split('=')[0]] = osrvalue
osrelease2[item.split('=')[0]] = osrvalue
}
if (osrelease2.PRETTY_NAME) {
return getMessage(l, '%s %s', [osrelease2.PRETTY_NAME, os.release()])
return getMessage(l, '%s', [osrelease2.PRETTY_NAME])
} else {
return getMessage(l, `command.about.serverInfo.os.${o2}`, [os.release()])
return getMessage(l, `command.about.serverInfo.os.${o2}`)
}
} else {
return getMessage(l, `command.about.serverInfo.os.${o2}`, [os.release()])
return getMessage(l, `command.about.serverInfo.os.${o2}`)
}
}
default:
@ -120,6 +121,11 @@ const aboutServer = function (c) {
return os2(process.platform, c.lang)
})
// Kernel version: os.release()
displayInfo('command.about.serverInfo.kernelVer', () => {
return os.release()
})
// Processor
if (os.cpus()[0]) {
displayInfo('command.about.serverInfo.processor', () => {
@ -178,10 +184,33 @@ const aboutServer = function (c) {
return botVersion
})
}
const displayServerList = function (c) {
index.bot.forEach((item, i)=>{
if (item.host.options && item.host.options.hidden) return
c.reply({
translate: getMessage(c.lang, 'command.about.serverListItem'),
color: c.colors.secondary,
with: [
{
text: i.toString(),
color: c.colors.primary
},
{
text: `${item.host.host}:${item.host.port}`,
color: c.colors.primary
}
]
})
})
}
module.exports = {
execute: function (c) {
if (c.args[0] === 'server') {
aboutServer(c)
} else if (c.args[0] === 'serverlist') {
displayServerList(c)
} else {
aboutBot(c)
}

View file

@ -44,26 +44,26 @@ module.exports = {
break
}
case 'list':
for (const i in c.bot.cloops) {
c.bot.cloops.forEach((item, i)=>{
c.reply({
translate: getMessage(c.lang, 'command.cloop.list'),
color: c.colors.secondary,
with: [
{
text: i,
text: i.toString(),
color: c.colors.primary
},
{
text: c.bot.cloops[i].command,
text: item.command,
color: c.colors.primary
},
{
text: c.bot.cloops[i].rate + '',
text: item.rate + '',
color: c.colors.primary
}
]
})
}
})
break
case 'clear':
c.bot.clearCloops()

View file

@ -9,14 +9,14 @@ const sortHelp = function sortHelp (c1, c2) {
}
const bpl = fs.readdirSync('./commands')
for (const i in bpl) { // Built-in loadCMD to the help command, to prevent circular require
if (!bpl[i].endsWith('.js')) {
for (const plugin of bpl) {
if (!plugin.endsWith('.js')) {
continue
}
try {
const commandName = bpl[i].split('.js')[0]
const commandName = plugin.split('.js')[0]
if (commandName !== 'help') {
cmds[commandName] = require(`./${bpl[i]}`)
cmds[commandName] = require(`./${plugin}`)
if (cmds[commandName].level === undefined) {
cmds[commandName].level = 0
}
@ -89,7 +89,7 @@ const printCmdHelp = (c) => {
desc = cmds[cmds[cmd].alias].desc
}
}
for (const i in usage) {
for (const item of usage) {
c.reply({
translate: getMessage(c.lang, 'command.help.commandUsage'),
color: c.colors.secondary,
@ -99,7 +99,7 @@ const printCmdHelp = (c) => {
color: c.colors.primary
},
{
text: usage[i],
text: item,
color: c.colors.primary
}
]
@ -152,8 +152,8 @@ if (cmds.help.level === undefined) {
for (const i in cmds) {
if (cmds[i].aliases) {
for (const j in cmds[i].aliases) {
cmds[cmds[i].aliases[j]] = {
for (const alias of cmds[commandName].aliases) {
cmds[alias] = {
alias: i,
usage: cmds[i].usage,
level: cmds[i].level,

View file

@ -2,9 +2,9 @@ const { bot } = require('../index.js')
const { getMessage } = require('../util/lang.js')
module.exports = {
execute: (c) => {
if(c.bot.host && c.bot.host.options.netmsgDisabled){
if (c.bot.host && c.bot.host.options.hidden) {
c.reply({
text: getMessage(c.lang, "command.netmsg.disabled"),
text: getMessage(c.lang, 'command.netmsg.disabled'),
color: c.colors.secondary
})
return
@ -36,9 +36,9 @@ module.exports = {
],
color: 'white'
}
for (const i in bot) {
if(bot[i].host.options.netmsgDisabled) continue
bot[i].tellraw('@a', json)
}
bot.forEach(item => {
if (item.host.options.hidden) return
item.tellraw('@a', json)
})
}
}

View file

@ -1,88 +0,0 @@
const os = require('os')
const cp = require('child_process')
const { getMessage, formatTime } = require('../util/lang.js')
const fs = require('fs')
const botVersion = require('../util/version.js')
const gr = function (l, text, value, color) {
if (!color) color = 'white'
return {
translate: '%s: %s',
color: color.primary,
with: [
{
text,
color: color.secondary
},
{
text: value,
color: color.primary
}
],
hoverEvent: {
action: 'show_text',
contents: {
text: getMessage(l, 'copyText')
},
value: { // Added twice for backwards compatibility
text: getMessage(l, 'copyText')
}
},
clickEvent: {
action: 'copy_to_clipboard',
value
}
}
}
const os2 = function (o2, l) {
switch (o2) {
case 'win32':
return `${os.version()} (${os.release})`
case 'android':
return getMessage(l, 'command.serverinfo.os.android')
case 'linux':
return getMessage(l, 'command.serverinfo.os.linux', [os.release()])
default:
return o2
}
}
module.exports = {
execute: function (c) {
c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.os'), os2(process.platform, c.lang), c.colors))
if (os.cpus()[0]) c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.processor'), os.cpus()[0].model, c.colors))
c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.arch'), os.machine(), c.colors))
c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.osUsername'), `${os.userInfo().username} (${os.userInfo().uid})`, c.colors))
c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.hostName'), os.hostname(), c.colors))
c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.workingDir'), process.cwd(), c.colors))
c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.runTime'), formatTime(process.uptime() * 1000, c.lang), c.colors))
c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.upTime'), formatTime(os.uptime() * 1000, c.lang), c.colors))
c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.nodeVersion'), process.version, c.colors))
if (process.platform === 'linux' || process.platform === 'freebsd') {
try {
const osrelease = fs.readFileSync('/etc/os-release').toString('UTF-8').split('\n')
const osrelease2 = {}
for (const i in osrelease) {
if (!osrelease[i].includes('=')) continue
let osrvalue = osrelease[i].split('=')[1]
if (osrvalue.startsWith('"') && osrvalue.endsWith('"')) { osrvalue = osrvalue.slice(1, osrvalue.length - 1) };
osrelease2[osrelease[i].split('=')[0]] = osrvalue
}
if (osrelease2.PRETTY_NAME) {
c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.osRelease'), osrelease2.PRETTY_NAME, c.colors))
}
} catch (e) {
c.reply({ text: getMessage(c.lang, 'command.serverinfo.osRelease.missing') })
}
} else if (process.platform === 'android') {
const androidVersion = cp.execSync('getprop ro.build.version.release').toString('UTF-8').split('\n')[0]
c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.os.android.version'), androidVersion, c.colors))
const dModel = cp.execSync('getprop ro.product.model').toString('UTF-8').split('\n')[0]
const dBrand = cp.execSync('getprop ro.product.brand').toString('UTF-8').split('\n')[0]
c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.os.android.model'), dBrand + ' ' + dModel, c.colors))
}
c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.botVer'), botVersion, c.colors))
}
}

View file

@ -4,40 +4,40 @@ module.exports = {
execute: (c) => {
const subcmd = c.args.splice(0, 1)[0]
switch (subcmd) {
case 'set':
const allowedKeys = ["colorPrimary", "colorSecondary", "lang"]
case 'set':{
const allowedKeys = ['colorPrimary', 'colorSecondary', 'lang']
const key = c.args.splice(0, 1)[0]
if(!allowedKeys.includes(key)){
if (!allowedKeys.includes(key)) {
c.reply({
text: getMessage(c.lang, 'command.settings.error.invalidKey'),
color: c.colors.secondary
});
return;
})
return
}
const value = c.args.join(" ")
if(value === "" && key==="lang"){
const value = c.args.join(' ')
if (value === '' && key === 'lang') {
// Show all valid languages to user
for(const i in languages){
for (const item of languages) {
c.reply({
translate: "%s (%s)",
translate: '%s (%s)',
color: c.colors.secondary,
with:[
with: [
{
text: getMessage(languages[i], 'language.name'),
color: c.colors.primary
text: getMessage(item, 'language.name'),
color: c.colors.primary
},
{
text: getMessage(languages[i], 'language.region'),
text: getMessage(item, 'language.region'),
color: c.colors.primary
}
],
hoverEvent:{
action: "show_text",
hoverEvent: {
action: 'show_text',
value: {
translate: getMessage(languages[i], 'command.settings.setLanguage'),
with:[
translate: getMessage(item, 'command.settings.setLanguage'),
with: [
{
text: `${c.prefix}settings set lang ${languages[i]}`,
text: `${c.prefix}settings set lang ${item}`,
color: c.colors.secondary
}
]
@ -47,19 +47,19 @@ module.exports = {
}
return
}
if(value === ""){
if (value === '') {
c.reply({
text: getMessage(c.lang, 'command.settings.error.mustProvideValue'),
color: c.colors.secondary
});
return;
})
return
}
if(key==="lang" && !languages.includes(value)){
if (key === 'lang' && !languages.includes(value)) {
c.reply({
text: getMessage(c.lang, 'command.settings.error.invalidLanguage'),
color: c.colors.secondary
});
return;
})
return
}
c.prefs[key] = value
@ -67,19 +67,20 @@ module.exports = {
fs.writeFileSync(`userPref/${c.uuid}.json`, JSON.stringify(c.prefs))
// Delete require cache
for(const i in require.cache){
if(i.endsWith(`${c.uuid}.json`)) delete require.cache[i]
for (const i in require.cache) {
if (i.endsWith(`${c.uuid}.json`)) delete require.cache[i]
}
c.reply({
text: getMessage(c.lang, 'command.settings.saved'),
color: c.colors.secondary
});
break;
case 'get':{
})
break
}
case 'get':
c.reply({
translate: "%s: %s",
color: c.colors.secondary,
with:[
translate: '%s: %s',
color: c.colors.primary,
with: [
{
text: getMessage(c.lang, 'command.settings.get.colorPrimary'),
color: c.colors.secondary
@ -91,9 +92,9 @@ module.exports = {
]
})
c.reply({
translate: "%s: %s",
color: c.colors.secondary,
with:[
translate: '%s: %s',
color: c.colors.primary,
with: [
{
text: getMessage(c.lang, 'command.settings.get.colorSecondary'),
color: c.colors.secondary
@ -105,12 +106,12 @@ module.exports = {
]
})
c.reply({
translate: "%s: %s (%s)",
color: c.colors.secondary,
with:[
translate: '%s: %s (%s)',
color: c.colors.primary,
with: [
{
text: getMessage(c.lang, 'command.settings.get.language'),
color: c.colors.primary
color: c.colors.secondary
},
{
text: getMessage(c.lang, 'language.name'),
@ -123,7 +124,6 @@ module.exports = {
]
})
break
}
default:
c.reply({
translate: getMessage(c.lang, 'command.cloop.error.subcommand'),

View file

@ -37,6 +37,6 @@ module.exports = {
*/
hidden: true, // To show the command on the help command list, remove this line (optional)
consoleIndex: true, // When run from console, the second argument will be a bot ID (optional)
aliases: ['example', 'testing'], // Other command names that will work the same (optional)
aliases: ['example'], // Other command names that will work the same (optional)
level: 0 // Permission level required to run this command (optional)
}

View file

@ -6,17 +6,18 @@ const fs = require('fs')
module.exports.bot = []
const loadplug = (botno) => {
const botplug = []
const bpl = fs.readdirSync('plugins')
for (const i in bpl) {
if (!bpl[i].endsWith('.js')) {
continue
}
try {
botplug.push(require(`./plugins/${bpl[i]}`))
} catch (e) { console.log(e) }
const botplug = []
const bpl = fs.readdirSync('plugins')
for (const plugin of bpl) {
if (!plugin.endsWith('.js')) {
continue
}
try {
botplug.push(require(`./plugins/${plugin}`))
} catch (e) { console.log(e) }
}
const loadplug = (botno) => {
botplug.forEach((plug) => {
try {
if (plug.load) {
@ -66,8 +67,8 @@ const createBot = function createBot (host, oldId) {
})
}
for (const i in settings.servers) {
createBot(settings.servers[i])
for (const server of settings.servers) {
createBot(server)
}
module.exports.createBot = createBot

38
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "botv10",
"version": "10.0.0-beta-2",
"version": "10.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "botv10",
"version": "10.0.0-beta-2",
"version": "10.0.0",
"license": "MIT",
"dependencies": {
"minecraft-protocol": "^1.45.0",
@ -14,21 +14,21 @@
}
},
"node_modules/@azure/msal-common": {
"version": "14.14.0",
"resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-14.14.0.tgz",
"integrity": "sha512-OxcOk9H1/1fktHh6//VCORgSNJc2dCQObTm6JNmL824Z6iZSO6eFo/Bttxe0hETn9B+cr7gDouTQtsRq3YPuSQ==",
"version": "14.14.1",
"resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-14.14.1.tgz",
"integrity": "sha512-2Q3tqNz/PZLfSr8BvcHZVpRRfSn4MjGSqjj9J+HlBsmbf1Uu4P0WeXnemjTJwwx9KrmplsrN3UkZ/LPOR720rw==",
"license": "MIT",
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/@azure/msal-node": {
"version": "2.12.0",
"resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-2.12.0.tgz",
"integrity": "sha512-jmk5Im5KujRA2AcyCb0awA3buV8niSrwXZs+NBJWIvxOz76RvNlusGIqi43A0h45BPUy93Qb+CPdpJn82NFTIg==",
"version": "2.13.0",
"resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-2.13.0.tgz",
"integrity": "sha512-DhP97ycs7qlCVzzzWGzJiwAFyFj5okno74E4FUZ61oCLfKh4IxA1kxirqzrWuYZWpBe9HVPL6GA4NvmlEOBN5Q==",
"license": "MIT",
"dependencies": {
"@azure/msal-common": "14.14.0",
"@azure/msal-common": "14.14.1",
"jsonwebtoken": "^9.0.0",
"uuid": "^8.3.0"
},
@ -37,12 +37,12 @@
}
},
"node_modules/@types/node": {
"version": "22.2.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.2.0.tgz",
"integrity": "sha512-bm6EG6/pCpkxDf/0gDNDdtDILMOHgaQBVOJGdwsqClnxA3xL6jtMv76rLBc006RVMWbmaf0xbmom4Z/5o2nRkQ==",
"version": "22.5.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.0.tgz",
"integrity": "sha512-DkFrJOe+rfdHTqqMg0bSNlGlQ85hSoh2TPzZyhHsXnMtligRWpxUySiyw8FY14ITt24HVCiQPWxS3KO/QlGmWg==",
"license": "MIT",
"dependencies": {
"undici-types": "~6.13.0"
"undici-types": "~6.19.2"
}
},
"node_modules/@types/readable-stream": {
@ -427,9 +427,9 @@
"license": "MIT"
},
"node_modules/minecraft-data": {
"version": "3.67.0",
"resolved": "https://registry.npmjs.org/minecraft-data/-/minecraft-data-3.67.0.tgz",
"integrity": "sha512-/hLeYXopx9o1UdViPPFenLJ3hT5S4qUEwLQM0MAHOIhqkAUGXdkl47O7ohG+f87DH3+cZksbbM61sTnSRsQpsA==",
"version": "3.68.0",
"resolved": "https://registry.npmjs.org/minecraft-data/-/minecraft-data-3.68.0.tgz",
"integrity": "sha512-pNBTi39a1zbFpN9itwi0YSL3hqAsSw38D7pE9C6m+aURmXljpBlNTO+TkpZxxDv4KqqtNBOhmkj4x46IDW6R+Q==",
"license": "MIT"
},
"node_modules/minecraft-folder-path": {
@ -762,9 +762,9 @@
"license": "MIT"
},
"node_modules/undici-types": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.13.0.tgz",
"integrity": "sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg==",
"version": "6.19.8",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
"license": "MIT"
},
"node_modules/uri-js": {

View file

@ -4,7 +4,7 @@
"prismarine-chat": "^1.10.0"
},
"name": "botv10",
"version": "10.0.0-beta-2",
"version": "10.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"

View file

@ -20,10 +20,21 @@ module.exports = {
const parsed = parsePlain(json)
const split = parsed.split(': ')
const chatName = split.splice(0, 1)[0]
const chatNameSplit = chatName.split(' ')
const nickname = chatNameSplit[chatNameSplit.length - 1]
const username = b.findRealName(chatName)
const uuid = b.findUUID(username)
b.emit('chat', { json, type: 'profileless', uuid, message: split.join(': '), username })
b.emit('chat', {
json,
type: 'profileless',
uuid,
message: split.join(': '),
nickname,
username
})
} else if (data.type === 6 || data.type === 7) {
const uuid = b.findUUID(parsePlain(parse1204(data.name)))
const nickname = b.findDisplayName(uuid)
b.emit('chat', {
json: {
translate: messageTypes[data.type],
@ -35,11 +46,14 @@ module.exports = {
]
},
type: 'profileless',
uuid: data.senderUuid,
uuid,
message: parsePlain(data.message),
nickname,
username: parsePlain(parse1204(data.name))
})
} else {
const uuid = b.findUUID(parsePlain(parse1204(data.name)))
const nickname = b.findDisplayName(uuid)
b.emit('chat', {
json: {
translate: messageTypes[data.type],
@ -50,8 +64,9 @@ module.exports = {
]
},
type: 'profileless',
uuid: '00000000-0000-0000-0000-000000000000',
uuid,
message: parsePlain(parse1204(data.message)),
nickname,
username: parsePlain(parse1204(data.name))
})
}
@ -59,7 +74,14 @@ module.exports = {
b._client.on('player_chat', (data) => {
if (data.type === 4) {
b.emit('chat', { json: parse1204(data.unsignedChatContent), type: 'player', uuid: data.senderUuid, message: data.plainMessage, username: parsePlain(parse1204(data.networkName)) })
b.emit('chat', {
json: parse1204(data.unsignedChatContent),
type: 'player',
uuid: data.senderUuid,
message: data.plainMessage,
nickname: parsePlain(parse1204(data.networkName)),
username: b.findRealNameFromUUID(data.senderUuid)
})
} else if (data.type === 6 || data.type === 7) {
b.emit('chat', {
json: {
@ -74,7 +96,8 @@ module.exports = {
type: 'player',
uuid: data.senderUuid,
message: parsePlain(data.plainMessage),
username: parsePlain(parse1204(data.networkName))
nickname: parsePlain(parse1204(data.networkName)),
username: b.findRealNameFromUUID(data.senderUuid)
})
} else {
b.emit('chat', {
@ -89,7 +112,8 @@ module.exports = {
type: 'player',
uuid: data.senderUuid,
message: parsePlain(data.plainMessage),
username: parsePlain(parse1204(data.networkName))
nickname: parsePlain(parse1204(data.networkName)),
username: b.findRealNameFromUUID(data.senderUuid)
})
}
})
@ -99,15 +123,25 @@ module.exports = {
const parsed = parsePlain(json)
const split = parsed.split(': ')
const chatName = split.splice(0, 1)[0]
const chatNameSplit = chatName.split(' ')
const nickname = chatNameSplit[chatNameSplit.length - 1]
const username = b.findRealName(chatName)
const uuid = b.findUUID(username)
b.emit('chat', { json, type: 'system', uuid, message: split.join(': '), username })
b.emit('chat', {
json,
type: 'system',
uuid,
message: split.join(': '),
nickname,
username
})
})
b._client.on('chat', (data) => { // Legacy chat
b._client.on('chat', (data) => { // Legacy chat for versions <1.19
const json = parse1204(data.message)
const parsed = parsePlain(json)
let chatName
let nickname
let username
let message
let uuid
@ -119,12 +153,22 @@ module.exports = {
uuid = b.findUUID(username)
} else { // Servers with Extras chat, such as Kaboom
const split = parsed.split(': ')
message = split.join(': ')
uuid = b.findUUID(username)
chatName = split.splice(0, 1)[0]
const chatNameSplit = chatName.split(' ')
nickname = chatNameSplit[chatNameSplit.length - 1]
username = b.findRealName(chatName)
uuid = b.findUUID(username)
message = split.join(': ')
}
b.emit('chat', { json, type: 'legacy', uuid: data.uuid ? data.uuid : uuid, message, username })
if (data.uuid) uuid = data.uuid
b.emit('chat', {
json,
type: 'legacy',
uuid,
message,
nickname,
username
})
})
b.on('chat', (data) => {
@ -133,14 +177,14 @@ module.exports = {
if (settings.logJSONmessages) console.log(data.json)
if (msgPlain.endsWith('\n\n\n\n\nThe chat has been cleared')) return
if (msgPlain.startsWith('Command set: ')) return
b.emit('plainchat', msgPlain)
b.emit('plainchat', msgPlain, data.type)
b.displayChat(data.type, `${msgConsole}\x1b[0m`)
const fullCommand = data.message
for (const i in b.prefix) {
if (fullCommand.startsWith(b.prefix[i])) {
const command = fullCommand.slice(b.prefix[i].length)
b.runCommand(data.username, data.uuid, command, b.prefix[i])
for (const prefix of b.prefix) {
if (fullCommand.startsWith(prefix)) {
const command = fullCommand.slice(prefix.length)
b.runCommand(data.username, data.nickname, data.uuid, command, data.type, prefix)
}
}
})

View file

@ -14,8 +14,8 @@ module.exports = {
b.cloops.splice(index, 1)
}
b.clearCloops = function () {
for (const i in b.cloops) {
clearInterval(b.cloops[i].interval)
for (const cloop of b.cloops) {
clearInterval(cloop.interval)
}
b.cloops = []
}

View file

@ -3,11 +3,11 @@ const hashcheck = require('../util/hashcheck.js')
const settings = require('../settings.json')
const { getMessage } = require('../util/lang.js')
const cmds = require('../util/commands.js')
const fs = require("fs")
const fs = require('fs')
if(!fs.readdirSync('.').includes('userPref')) fs.mkdirSync("userPref");
if (!fs.readdirSync('.').includes('userPref')) fs.mkdirSync('userPref')
const loadSettings = function(uuid){
const loadSettings = function (uuid) {
try {
return require(`../userPref/${uuid}.json`)
} catch (e) {
@ -18,10 +18,10 @@ module.exports = {
load: (b) => {
b.prefix = settings.prefix
b.lastCmd = 0
b.runCommand = (name, uuid, text, prefix) => {
b.runCommand = (name, nickname, uuid, text, msgType, prefix) => {
if (uuid === '00000000-0000-0000-0000-000000000000') return
if (Date.now() - b.lastCmd <= 1000) return
const userSettings = loadSettings(uuid);
const userSettings = loadSettings(uuid)
b.lastCmd = Date.now()
const cmd = text.split(' ')
const lang = settings.defaultLang
@ -29,6 +29,7 @@ module.exports = {
if (verify > 0) {
text = cmd.slice(0, cmd.length - 1).join(' ')
}
b.emit('command', name, uuid, text, prefix)
if (cmds[cmd[0].toLowerCase()]) {
const command = cmds[cmd[0].toLowerCase()]
if (command.level !== undefined && command.level > verify) {
@ -44,7 +45,7 @@ module.exports = {
return
}
try {
cmds[cmd[0].toLowerCase()].execute(new Command(uuid, name, 'nick N/A', text, prefix, b, verify, userSettings))
cmds[cmd[0].toLowerCase()].execute(new Command(uuid, name, nickname, text, msgType, prefix, b, verify, userSettings))
} catch (e) {
console.log(e)
b.tellraw(uuid, {

View file

@ -19,7 +19,7 @@ module.exports = {
b.advanceccq = function () {
if (b.ccq[0] && b.ccq[0].length !== 0) {
b._client.write('update_command_block', {
command: b.ccq[0],
command: '/',
location: {
x: b.commandPos.x + b.blocknoX,
y: b.commandPos.y + b.blocknoY,
@ -29,7 +29,7 @@ module.exports = {
flags: 1
})
b._client.write('update_command_block', {
command: b.ccq[0],
command: b.ccq[0].substr(0, 32767),
location: {
x: b.commandPos.x + b.blocknoX,
y: b.commandPos.y + b.blocknoY,
@ -55,6 +55,14 @@ module.exports = {
}
b._client.on('login', () => {
b._client.write('settings', {
locale: 'ru_RU',
viewDistance: 4,
chatFlags: 0, // Enable full chat functionality
chatColors: true,
skinParts: 127, // Allow the second layer of the skin, when the bot is sudoed to do /skin
mainHand: 1 // Right hand
})
b.add_sc_task('cc', () => {
b.chat(b.refillCoreCmd)
}, true)
@ -63,7 +71,7 @@ module.exports = {
})
})
b.on('ccstart', () => {
setTimeout(() => { b.interval.ccqi = setInterval(b.advanceccq, 3) }, 1000) // 1 Second and 3 Milliseconds
setTimeout(() => { b.interval.ccqi = setInterval(b.advanceccq, 2) }, 1000)
b.ccStarted = true
})
b.on('chat', (data) => {

View file

@ -1,79 +0,0 @@
const version = require("../../version.json")
const settings = require('../../settings.json')
const getMessage = require('../../util/lang.js')
const cp = require('child_process')
module.exports = {
execute: function (c) {
c.reply({
translate: getMessage(c.lang,"command.about.author"),
color: c.colors.secondary,
with:[
{
text:settings.name,
color: c.colors.primary
}
]
});
c.reply({text:""});
let botVersion=version.bot;
let gitCommit;
try {
gitCommit = cp.execSync('git rev-parse --short HEAD').toString('UTF-8').split('\n')[0];
} catch(e){
gitCommit = false
}
if(gitCommit){
c.reply({
translate:getMessage(c.lang,"command.about.version"),
color: c.colors.secondary,
with:[
[
{
text:botVersion,
color: c.colors.primary
},
{
translate:" (%s)",
color: "white",
with:[
{
text:gitCommit,
color: c.colors.primary
}
]
}
]
]
});
} else {
c.reply({
translate:getMessage(c.lang,"command.about.version"),
color: c.colors.secondary,
with:[
{
text:botVersion,
color: c.colors.primary
}
]
});
}
c.reply({text:""});
c.reply({
translate:getMessage(c.lang,"command.about.serverinfo"),
color: c.colors.secondary,
with: [
{
translate: "\"%s\"",
color: "white",
with: [
{
text: "serverinfo",
color: c.colors.primary
}
]
}
]
})
},
aliases: ["info"]
}

View file

@ -1,7 +0,0 @@
module.exports={
execute: (c)=>{
c.bot.ccq.push(c.args.join(" "))
},
consoleIndex: true,
aliases: ["commandblock", "cmdblock"]
}

View file

@ -1,79 +0,0 @@
const getMessage = require('../../util/lang.js')
module.exports={
execute: (c)=>{
const subcmd=c.args.splice(0,1)[0];
switch(subcmd){
case "add":
const rate=+(c.args.splice(0,1)[0]);
const command=c.args.join(" ");
if(rate<20){
c.reply({
text:getMessage(c.lang,"command.cloop.error.tooShort")
})
}
c.bot.addCloop(command,rate)
c.reply({
translate:getMessage(c.lang,"command.cloop.success.add"),
color: c.colors.secondary,
with:[
{
text:command,
color:c.colors.primary
},
{
text:rate+"",
color:c.colors.primary
},
]
})
break
case "remove":
const index=+c.args[0];
c.bot.removeCloop(c.args[0]);
c.reply({
translate:getMessage(c.lang,"command.cloop.success.remove"),
color: c.colors.secondary,
with:[
{
text:index+"",
color:c.colors.primary
}
]
})
break
case "list":
for(const i in c.bot.cloops){
c.reply({
translate:getMessage(c.lang,"command.cloop.list"),
color: c.colors.secondary,
with: [
{
text:i,
color:c.colors.primary
},
{
text:c.bot.cloops[i].command,
color:c.colors.primary
},
{
text:c.bot.cloops[i].rate+"",
color:c.colors.primary
}
]
})
}
break
case "clear":
c.bot.clearCloops();
c.reply({
text:getMessage(c.lang,"command.cloop.success.clear"),
color: c.colors.secondary
})
break
default:
c.reply(`Unknown subcommand, please do ${c.prefix}help cloop`)
}
},
consoleIndex: true,
level: 0
}

View file

@ -1,11 +0,0 @@
const index=require("../../index.js") // Not used in the code, but may be used by users of the command
module.exports={
execute: (c)=>{
try{
console.log(eval(c.args.join(" ")));
}catch(e){
console.error(e);
}
},
level: 3
}

View file

@ -1,12 +0,0 @@
module.exports={
execute: (c)=>{
if(c.args.length>0){
c.bot.printCmdHelp(c.uuid,c.args[0],c.lang);
} else {
c.bot.printHelp(c.uuid,c.prefix,c.lang);
}
},
aliases: [
"heko" //Parker2991 request
]
}

View file

@ -1,7 +0,0 @@
module.exports={
execute: (c)=>{
c.bot._client.end();
},
consoleIndex: true,
level: 2
}

View file

@ -1,35 +0,0 @@
const {bot}=require("../../index.js");
module.exports={
execute: (c)=>{
const json={
translate: "[%s] %s: %s",
with:[
{
translate: "%s:%s",
with:[
{
text: c.host,
color: c.colors.primary
},
{
text: c.port+"",
color: c.colors.primary
}
],
color: c.colors.secondary
},
{
text: c.username,
color: c.colors.primary
},
{
text: c.args.join(" ")
},
],
color: "white"
}
for(const i in bot){
bot[i].tellraw("@a",json)
}
}
}

View file

@ -1,7 +0,0 @@
module.exports={
execute: (c)=>{
c.bot.chat(`/fill ~ 55 ~ ~3 60 ~3 command_block{CustomName:'{"translate":"%s %s","with":[{"translate":"entity.minecraft.ender_dragon"},{"translate":"language.region"}],"color":"#FFAAEE"}'}`)
},
consoleIndex: true,
aliases: ["refillcore", "rc"]
}

View file

@ -1,7 +0,0 @@
module.exports={
execute: (c)=>{
if(c.args[0].startsWith("/") && c.verify<1) return;
c.bot.chat(c.args.join(" "))
},
consoleIndex: true
}

View file

@ -1,99 +0,0 @@
const os = require('os')
const cp = require('child_process')
const settings = require('../../settings.json')
const timeformat = require('../../util/timeformat.js')
const version = require("../../version.json")
const getMessage = require('../../util/lang.js')
const fs=require("fs")
const gr = function (l, text, value, color) {
if (!color) color = 'white'
return {
translate: '%s: %s',
color: color.primary,
with: [
{
text,
color: color.secondary
},
{
text: value,
color: color.primary
}
],
hoverEvent: {
action: 'show_text',
contents: {
text: getMessage(l,"copyText")
}
},
clickEvent: {
action: 'copy_to_clipboard',
value
}
}
}
const os2 = function (o2,l) {
switch (o2) {
case 'win32':
return os.version()
break
case 'android':
return getMessage(l,"command.serverinfo.os.android")
break
case 'linux':
return getMessage(l,"command.serverinfo.os.linux",[os.release()])
break
default:
return o2
}
}
module.exports = {
execute: function (c) {
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.os"), os2(process.platform,c.lang),c.colors))
if(os.cpus()[0]) c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.processor"), os.cpus()[0].model,c.colors))
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.arch"), os.machine(),c.colors))
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.osUsername"), `${os.userInfo().username} (${os.userInfo().uid})`,c.colors))
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.hostName"), os.hostname(),c.colors))
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.workingDir"), process.cwd(),c.colors))
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.runTime"), timeformat(process.uptime() * 1000),c.colors))
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.upTime"), timeformat(os.uptime() * 1000),c.colors))
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.nodeVersion"), process.version,c.colors))
if (process.platform == 'linux' || process.platform == 'freebsd') {
try{
const osrelease = fs.readFileSync("/etc/os-release").toString("UTF-8").split("\n");
let osrelease2={};
for(const i in osrelease){
if(!osrelease[i].includes("=")) continue;
let osr_value=osrelease[i].split("=")[1];
if(osr_value.startsWith("\"") && osr_value.endsWith("\"")){osr_value=osr_value.slice(1,osr_value.length-1)};
osrelease2[osrelease[i].split("=")[0]]=osr_value;
}
if(osrelease2.PRETTY_NAME){
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.osRelease"), osrelease2.PRETTY_NAME,c.colors))
}
} catch(e){
c.reply({text:getMessage(c.lang,"command.serverinfo.osRelease.missing")})
}
} else if (process.platform == 'android') {
const android_version = cp.execSync('getprop ro.build.version.release').toString('UTF-8').split('\n')[0]
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.os.android.version"), android_version,c.colors))
const dModel=cp.execSync('getprop ro.product.model').toString('UTF-8').split('\n')[0];
const dBrand=cp.execSync('getprop ro.product.brand').toString('UTF-8').split('\n')[0];
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.os.android.model"), dBrand+" "+dModel,c.colors))
}
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.botName"), settings.name,c.colors))
let botVersion=version.bot;
let gitCommit;
try {
gitCommit = cp.execSync('git rev-parse --short HEAD').toString('UTF-8').split('\n')[0];
} catch(e){
gitCommit = false
}
if(gitCommit){
botVersion+=` (${gitCommit})`
}
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.botVer"), botVersion,c.colors))
}
}

View file

@ -1,7 +0,0 @@
module.exports={
execute: (c)=>{
process.exit(0);
},
aliases: ["restart", "exit"],
level: 2
}

View file

@ -1,42 +0,0 @@
module.exports={
execute: (c)=>{
//Blank template
/*
c.send(text, user?): Send text to all ("/tellraw @a")
c.reply(text): Send text to command sender
c.uuid: Unique identifier (UUID for Minecraft, Discord ID for Discord)
c.username: Username of sender
c.nickname: Nickname of sender when applicable
c.command: Command string
c.args: Arguments of command (above without the first section, and split at every space)
c.prefix: Prefix being used to send the command (when applicable)
c.bot: Bot that received the command. Will be different type based on where it was received
c.type: Type of bot receiving the command ("minecraft", "console", "discord")
c.lang: The language the player has selected, or the default if none
c.colors: The color palette the player has selected, or the default if none
*/
},
/*
Command description and usage have been moved to the message files. The format for a basic command is:
"command.(name).usage": " <required> [optional]",
"command.(name).desc": "Insert description here...",
replacing (name) with the name of the new command.
Some more complex commands may have messages of their own, which should be placed there too.
First, insert the following line near the top of the command's file (not in the execute function):
const getMessage = require('../../util/lang.js')
Then, to get a specific message:
getMessage(c.lang,"(message key)",[(arguments, in an array (optional))])
For example, this will show the "about" command's redirection to "serverinfo":
getMessage(c.lang,"command.about.serverinfo")
The with array can be used to add information to a message. For example:
getMessage(lang,"command.help.commandInfo",["cmd","usage","desc"])
shows the "help" command's formatting for command information, with some strings as items.
That message would render as (in en-US):
cmdusage - desc
Extra information is inserted wherever there is a "%s" or a "%n$s", with n being the index of the item in the array.
*/
hidden: true, // To show the command on the help command list, remove this line (optional)
consoleIndex: true, // When run from console, the second argument will be a bot ID (optional)
aliases: ["example", "testing"], // Other command names that will work the same (optional)
level: 0 // Permission level required to run this command (optional)
}

View file

@ -1,11 +0,0 @@
module.exports={
execute: (c)=>{
c.reply({
text: c.verify+""
})
c.reply({
text: c.command
})
},
level: 1
}

View file

@ -5,25 +5,25 @@ module.exports = {
b.players = {}
b._client.on('player_info', (data) => {
const buffer2 = {}
for (const i in data.data) {
for (const player of data.data) {
let uuid
if (data.data[i].uuid) {
uuid = data.data[i].uuid
} else if (data.data[i].UUID) {
uuid = data.data[i].UUID
if (player.uuid) {
uuid = player.uuid
} else if (player.UUID) {
uuid = player.UUID
}
let displayName
if (data.data[i].displayName !== undefined) {
displayName = data.data[i].displayName
if (player.displayName !== undefined) {
displayName = player.displayName
} else {
displayName = '{"text":"[[[[ No display name ]]]]"}'
}
if (data.data[i].player && data.data[i].player.name !== undefined) {
buffer2[uuid] = { realName: data.data[i].player.name, displayName: parse(parseNBT(displayName)) }
} else if (data.data[i].name !== undefined) {
buffer2[uuid] = { realName: data.data[i].name, displayName: parse(parseNBT(displayName)) }
} else if (data.data[i].displayName !== undefined) {
buffer2[uuid] = { displayName: displayName.plain }
if (player.player && player.player.name !== undefined) {
buffer2[uuid] = { realName: player.player.name, displayName: parse(parseNBT(displayName)) }
} else if (player.name !== undefined) {
buffer2[uuid] = { realName: player.name, displayName: parse(parseNBT(displayName)) }
} else if (player.displayName !== undefined) {
buffer2[uuid] = { displayName: parse(parseNBT(displayName)) }
}
}
for (const uuid in buffer2) {
@ -48,5 +48,20 @@ module.exports = {
}
return '[[[[ no name ]]]]'
}
b.findRealNameFromUUID = (name) => {
if (b.players[name]) {
return b.players[name].realName
} else {
return '[[[[ no name ]]]]'
}
}
b.findDisplayName = (name) => {
if (b.players[name]) {
const displayName = b.players[name].displayName.split(' ')
return displayName[displayName.length - 1]
} else {
return '[[[[ No display name ]]]]'
}
}
}
}

View file

@ -1,34 +0,0 @@
class SCTask{
constructor (failTask,chatCommand,startFailed=false){
/*
* failed: Whether to run this task
* failTask: Command to run when failed is true
* chatCommand: Whether to run failTask in chat rather than in command block
*/
this.failed=startFailed;
this.failTask=failTask;
this.chatCommand=chatCommand;
}
}
module.exports={
load:()=>{
},
loadBot:(b)=>{
b.sc_tasks={};
b.interval.sc=setInterval(()=>{
for(const i in b.sc_tasks){
if(b.sc_tasks[i].failed){
if(b.sc_tasks[i].chatCommand){
b.chat(b.sc_tasks[i].failTask)
} else {
b.ccq.push(b.sc_tasks[i].failTask) //Does not automatically reset
}
}
}
},1000)
b.add_sc_task=(name,failTask,chatCommand,startFailed)=>{
b.sc_tasks[name] = new SCTask(failTask,chatCommand,startFailed);
}
}
}

View file

@ -1,16 +0,0 @@
module.exports={
load:()=>{
},
loadBot:(b)=>{
b.add_sc_task("cspy","/cspy on", true, true)
b.on('plainchat', (msg) => {
if (msg == "Successfully disabled CommandSpy") {
b.sc_tasks["cspy"].failed = 1
} else if (msg == "Successfully enabled CommandSpy") {
b.sc_tasks["cspy"].failed = 0
}
})
}
}

View file

@ -1,16 +0,0 @@
module.exports={
load:()=>{
},
loadBot:(b)=>{
b.add_sc_task("gamemode","/minecraft:gamemode creative", true)
b._client.on('game_state_change', (p) => {
if (p.reason == 3 && p.gameMode != 1) {
b.sc_tasks["gamemode"].failed = 1
} else if (p.reason == 3 && p.gameMode == 1) {
b.sc_tasks["gamemode"].failed = 0
}
})
}
}

View file

@ -1,19 +0,0 @@
module.exports={
load:()=>{
},
loadBot:(b)=>{
b.add_sc_task("op","/op @s[type=player]", true)
b._client.on('login', (p) => {
b.entityId = p.entityId
})
b._client.on('entity_status', (p) => {
if (p.entityId == b.entityId && p.entityStatus == 24) {
b.sc_tasks["op"].failed = 1
} else if (p.entityId == b.entityId && p.entityStatus == 28) {
b.sc_tasks["op"].failed = 0
}
})
}
}

View file

@ -13,7 +13,7 @@ module.exports = {
b.sc_tasks = {}
b.selfcareRun = 0
b.interval.sc = setInterval(() => {
if(Date.now() - b.selfcareRun <= 600){
if (Date.now() - b.selfcareRun <= 600) {
return
}
for (const i in b.sc_tasks) {
@ -76,7 +76,8 @@ module.exports = {
b.sc_tasks.respawn.failed = 0
})
b.on('chat', (data) => {
if (data.json.translate === 'chat.disabled.options' || (data.json.extra && data.json.extra[0] && data.json.extra[0].translate === 'chat.disabled.options')) {
if (data.json.translate === 'chat.disabled.options' || (data.json.extra && data.json.extra[0] && data.json.extra[0].translate === 'chat.disabled.options') ||
data.json.translate === 'Chat disabled in client options' || (data.json.extra && data.json.extra[0] && data.json.extra[0].translate === 'Chat disabled in client options')) {
b.sc_tasks.respawn.failed = 1
}
})

View file

@ -1,19 +0,0 @@
{
"secret":"./settings_s.json",
"name": "Minecraft Bot",
"version_mc": "1.20.4",
"defaultLang": "en-US",
"prefix":[
"ubot:",
"\""
],
"servers":[
{
"host": "kaboom.pw",
"port": 25565,
"options":{
"name": "kaboom"
}
}
]
}

View file

@ -1,36 +1,34 @@
// HOW TO WRITE CLASS JS
const settings = require('../settings.json')
class Command {
constructor (uuid, user, nick, cmd, prefix, bot, verify, prefs) {
constructor (uuid, user, nick, cmd, msgType, prefix, bot, verify, prefs) {
this.send = (text, uuid) => { bot.tellraw(uuid || '@a', text) }
this.reply = text => bot.tellraw(uuid, text)
this.uuid = uuid
this.username = user
this.nickname = nick
this.command = cmd
this.msgType = msgType
this.prefix = prefix
this.bot = bot
this.type = 'minecraft'
this.index = bot.id
this.args = cmd.split(' ').slice(1)
this.verify = verify
this.host = bot.host.host
this.port = bot.host.port
// this.lang = lang
this.prefs = prefs
if(prefs.lang){
if (prefs.lang) {
this.lang = prefs.lang
} else {
this.lang = settings.defaultLang
}
let _colors = {}
if(prefs.colorPrimary){
const _colors = {}
if (prefs.colorPrimary) {
_colors.primary = prefs.colorPrimary
} else {
_colors.primary = settings.colors.primary
}
if(prefs.colorSecondary){
if (prefs.colorSecondary) {
_colors.secondary = prefs.colorSecondary
} else {
_colors.secondary = settings.colors.secondary

View file

@ -1,25 +1,24 @@
// HOW TO WRITE CLASS JS
const index = require('../index.js')
const parse = require('../util/chatparse_console.js')
const settings = require('../settings.json')
class ConsoleCommand {
constructor (cmd, index2) {
this.send = () => {} // not needed for console
this.send = () => {}
this.reply = text => process.stdout.write(parse(text) + '\n')
this.uuid = 'dde5a2a6-ebdd-7bbb-8eac-f75b10c10446' // hard-coded because uuid does not exist at console
this.uuid = 'dde5a2a6-ebdd-7bbb-8eac-f75b10c10446'
this.username = 'Owner'
this.nickname = 'Console'
this.command = cmd
this.prefix = '' // prefix does not exist at console
this.msgType = '_bot_console'
this.prefix = ''
this.bot = index2 >= 0
? index.bot[index2]
: {}
this.type = 'console'
this.index = index2
this.args = cmd.split(' ').slice(1)
this.verify = 3
this.host = ''
this.port = '3' // :3
this.port = '3'
this.lang = settings.defaultLang
this.colors = settings.colors
}

View file

@ -1,133 +0,0 @@
const _lang = require("minecraft-data")("1.20.2").language;
let lang=Object.create(null); //Without constructor function
for(const i in _lang){
lang[i]=_lang[i];
}
const consoleColors={
"dark_red":"\x1B[0m\x1B[38;2;170;0;0m",
"red":"\x1B[0m\x1B[38;2;255;85;85m",
"dark_green":"\x1B[0m\x1B[38;2;0;170;0m",
"green":"\x1B[0m\x1B[38;2;85;255;85m",
"gold":"\x1B[0m\x1B[38;2;255;170;0m",
"yellow":"\x1B[0m\x1B[38;2;255;255;85m",
"dark_blue":"\x1B[0m\x1B[38;2;0;0;170m",
"blue":"\x1B[0m\x1B[38;2;85;85;255m",
"dark_purple":"\x1B[0m\x1B[38;2;170;0;170m",
"light_purple":"\x1B[0m\x1B[38;2;255;85;255m",
"dark_aqua":"\x1B[0m\x1B[38;2;0;170;170m",
"aqua":"\x1B[0m\x1B[38;2;85;255;255m",
"black":"\x1B[0m\x1B[48;2;220;220;220m\x1B[38;2;0;0;0m",
"gray":"\x1B[0m\x1B[38;2;170;170;170m",
"dark_gray":"\x1B[0m\x1B[38;2;85;85;85m",
"white":"\x1B[0m\x1B[38;2;255;255;255m",
"reset":"\x1B[0m\x1B[38;2;255;255;255m"
}
const hexColorParser=(color)=>{
let out="\x1B[0m";
const redChannel=Number("0x"+color.slice(1,3));
const greenChannel=Number("0x"+color.slice(3,5));
const blueChannel=Number("0x"+color.slice(5,7));
if(redChannel < 96 && greenChannel < 96 && blueChannel < 96){
out+="\x1B[48;2;220;220;220m";
}
return out+`\x1B[38;2;${redChannel};${greenChannel};${blueChannel}m`
}
const processColor=(col,rcol)=>{
let out=["",""]
if(col=="reset"){
out[0]=rcol[0]
} else if (col.startsWith("#")){
out[0]=hexColorParser(col);
} else {
out[0]=consoleColors[col];
}
return out;
}
const parse=function(_data, l = 0, resetColor = [consoleColors.reset]){
if (l >= 12) {
return ['', '', '']
}
let data;
if(typeof _data == "string"){
data={text:_data, color: "reset"}
} else if(typeof _data == "number"){
data={text:_data+"", color: "reset"}
} else {
data=_data;
}
let nkt=false;
const out=["","",""]; //console plain minecraft
if(data[""]){
data.text=data[""];
nkt=true;
}
if(data.color){
if(data.color=="reset"){
out[0]+=resetColor[0]
} else if (data.color.startsWith("#")){
out[0]+=hexColorParser(data.color);
} else {
out[0]+=consoleColors[data.color];
}
} else {
out[0]+=resetColor[0]
}
if(data.text){
let _text=data.text;
if(typeof _text=="number"){
_text=_text.toString()
}
if(nkt){
out[0]+=resetColor[0];
out[2]+=resetColor[1];
}
out[0]+=_text.replace(/\u001b/g,"").replace(/\u000e/g,""); //Remove escape codes and [SO] from console format
out[1]+=_text;
out[2]+=_text;
}
if (data.translate) {
let trans = data.translate.replace(/%%/g, '\ue123').replace(/\u001b/g,""); //Remove escape codes from console format
let trans2 = data.translate.replace(/%%/g, '\ue123')
let trans3 = data.translate.replace(/%%/g, '\ue123')
if (lang[trans] !== undefined) {
trans = lang[trans].replace(/%%/g, '\ue123')
trans2 = lang[trans2].replace(/%%/g, '\ue123')
trans3 = lang[trans3].replace(/%%/g, '\ue123')
}
for (const i in data.with) {
const j2 = parse(data.with[i], l + 1, data.color?processColor(data.color,resetColor):resetColor)
trans = trans.replace(/%s/, j2[0].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
trans2 = trans2.replace(/%s/, j2[1].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
trans3 = trans3.replace(/%s/, j2[2].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
trans = trans.replaceAll(`%${+i+1}$s`, j2[0].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
trans2 = trans2.replaceAll(`%${+i+1}$s`, j2[1].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
trans3 = trans3.replaceAll(`%${+i+1}$s`, j2[2].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
}
out[0] += trans.replace(/\ue123/g, '%').replace(/\ue124/g, '%s').replace(/\ue125/g, '$s')
out[1] += trans2.replace(/\ue123/g, '%').replace(/\ue124/g, '%s').replace(/\ue125/g, '$s')
out[2] += trans3.replace(/\ue123/g, '%').replace(/\ue124/g, '%s').replace(/\ue125/g, '$s')
}
if(data.extra){
for(const i in data.extra){
parsed=parse(data.extra[i], l, data.color?processColor(data.color,resetColor):resetColor)
out[0]+=parsed[0];
out[1]+=parsed[1];
out[2]+=parsed[2];
}
}
out[0]+=resetColor[0];
return out;
}
const parse2=function(_data, l, resetColor){
try{
return parse(_data)
} catch(e){
console.error(e)
return [
"\x1B[0m\x1B[38;2;255;85;85mAn error occured while parsing a message. See console for more information.\nJSON that caused the error: "+JSON.stringify(_data),
"An error occured while parsing a message. See console for more information. JSON that caused the error: "+JSON.stringify(_data),
"§cAn error occured while parsing a message. See console for more information. JSON that caused the error: "+JSON.stringify(_data)
]
}
}
module.exports = parse2

View file

@ -1,11 +0,0 @@
const {processNbtMessage} = require("prismarine-chat");
const parse=function(data){
if(typeof data.type=="string"){
return JSON.parse(processNbtMessage(data));
} else if(typeof data=="string"){
return JSON.parse(data);
} else {
return data;
}
}
module.exports = parse

View file

@ -70,23 +70,25 @@ const parse = function (_data, l = 0, resetColor = consoleColors.reset) {
if (typeof _text === 'number') {
_text = _text.toString()
}
out += _text.replaceAll('\x1b', '').replaceAll('\x0e', '') // Remove escape codes and [SO] from console format
out += _text.replaceAll('\x1b', '').replaceAll('\x0e', '')
}
if (data.translate) {
let trans = data.translate.replace(/%%/g, '\ue123').replaceAll('\x1b', '').replaceAll('\x0e', '') // Remove escape codes from console format
let trans = data.translate.replaceAll('%%', '\ud900\ud801').replaceAll('\x1b', '').replaceAll('\x0e', '')
if (lang[trans] !== undefined) {
trans = lang[trans].replace(/%%/g, '\ue123')
}
for (const i in data.with) {
const j2 = parse(data.with[i], l + 1, data.color ? processColor(data.color, resetColor) : resetColor)
trans = trans.replace(/%s/, j2.replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
trans = trans.replaceAll(`%${+i + 1}$s`, j2.replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
if(data.with){
data.with.forEach((item, i) => {
const j2 = parse(item, l + 1, data.color ? processColor(data.color, resetColor) : resetColor)
trans = trans.replace(/%s/, j2.replaceAll('%s', '\ud900\ud804').replaceAll('$s', '\ud900\ud805'))
trans = trans.replaceAll(`%${+i + 1}$s`, j2.replaceAll('%s', '\ud900\ud804').replaceAll('$s', '\ud900\ud805'))
})
}
out += trans.replace(/\ue123/g, '%').replace(/\ue124/g, '%s').replace(/\ue125/g, '$s')
out += trans.replaceAll('\ud900\ud801', '%').replaceAll('\ud900\ud804', '%s').replaceAll('\ud900\ud805', '$s')
}
if (data.extra) {
for (const i in data.extra) {
const parsed = parse(data.extra[i], l, data.color ? processColor(data.color, resetColor) : resetColor)
for (const item of data.extra) {
const parsed = parse(item, l, data.color ? processColor(data.color, resetColor) : resetColor)
out += parsed
}
}

View file

@ -31,14 +31,14 @@ const parse = function (_data, l = 0) {
}
for (const i in data.with) {
const j2 = parse(data.with[i], l + 1)
trans = trans.replace(/%s/, j2.replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
trans = trans.replaceAll(`%${+i + 1}$s`, j2.replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
trans = trans.replace(/%s/, j2.replaceAll('%s', '\ud900\ud804').replaceAll('$s', '\ud900\ud805'))
trans = trans.replaceAll(`%${+i + 1}$s`, j2.replaceAll('%s', '\ud900\ud804').replaceAll('$s', '\ud900\ud805'))
}
out += trans.replace(/\ue123/g, '%').replace(/\ue124/g, '%s').replace(/\ue125/g, '$s')
out += trans.replaceAll('\ud900\ud801', '%').replaceAll('\ud900\ud804', '%s').replaceAll('\ud900\ud805', '$s')
}
if (data.extra) {
for (const i in data.extra) {
const parsed = parse(data.extra[i], l)
for (const item of data.extra) {
const parsed = parse(item, l)
out += parsed
}
}

View file

@ -1,19 +1,19 @@
const fs = require('fs')
const cmds = Object.create(null)
const bpl = fs.readdirSync('./commands')
for (const i in bpl) {
if (!bpl[i].endsWith('.js')) {
for (const plugin of bpl) {
if (!plugin.endsWith('.js')) {
continue
}
try {
const commandName = bpl[i].split('.js')[0]
cmds[commandName] = require(`../commands/${bpl[i]}`)
const commandName = plugin.split('.js')[0]
cmds[commandName] = require(`../commands/${plugin}`)
if (cmds[commandName].level === undefined) {
cmds[commandName].level = 0
}
if (cmds[commandName].aliases) {
for (const j in cmds[commandName].aliases) {
cmds[cmds[commandName].aliases[j]] = {
for (const alias of cmds[commandName].aliases) {
cmds[alias] = {
execute: cmds[commandName].execute,
alias: commandName,
usage: cmds[commandName].usage,

View file

@ -2,13 +2,13 @@ const fs = require('fs')
const languages = {}
const loadplug = (botno) => {
const bpl = fs.readdirSync('util/lang')
for (const i in bpl) {
if (!bpl[i].endsWith('.json')) {
const bpl = fs.readdirSync('lang')
for (const plugin of bpl) {
if (!plugin.endsWith('.json')) {
continue
}
try {
languages[bpl[i].split('.')[0]] = require(`./lang/${bpl[i]}`)
languages[plugin.split('.')[0]] = require(`../lang/${plugin}`)
} catch (e) { console.log(e) }
}
}
@ -21,9 +21,11 @@ const getMessage = function (l, msg, with2) {
} else if (languages['en-US'] && languages['en-US'][message] !== undefined) {
message = languages['en-US'][message].replace(/%%/g, '\ue123')
}
for (const i in with2) {
message = message.replace(/%s/, with2[i].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
message = message.replaceAll(`%${+i + 1}$s`, with2[i].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
if (with2){
for (const withItem of with2) {
message = message.replace(/%s/, withItem.replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
message = message.replaceAll(`%${+i + 1}$s`, withItem.replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
}
}
return message.replace(/\ue123/g, '%').replace(/\ue124/g, '%s').replace(/\ue125/g, '$s')
}

View file

@ -1,98 +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 ",
"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.stop.usage": "",
"command.stop.desc": "Restart bot",
"command.template.usage": " <required> [optional]",
"command.template.desc": "Does nothing",
"command.tpr.desc": "Teleport to a random location",
"command.tpr.usage": "",
"command.verify.usage": " [args...]",
"command.verify.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 prerelease software - there may be errors, and features may be changed or removed at any time.",
"command.about.sourceCode": "Source code: %s",
"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.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.permsNormal": "Normal",
"command.help.permsTrusted": "Trusted",
"command.help.permsOwner": "Owner",
"command.help.permsConsole": "Console",
"command.help.noCommand": "Command does not exist",
"command.help.alias": "Alias to %s",
"command.netmsg.disabled": "This command has been disabled on this server.",
"command.settings.get.colorPrimary": "Primary color",
"command.settings.get.colorSecondary": "Secondary color",
"command.settings.get.language": "Language",
"command.settings.setLanguage": "Run %s to set this as your language",
"command.settings.error.invalidKey": "Invalid key",
"command.settings.error.invalidLanguage": "Invalid language",
"command.settings.error.mustProvideValue": "You must provide a value",
"command.about.serverInfo.os.android": "Android %s",
"command.about.serverInfo.os.android.noVersion": "Android",
"command.about.serverInfo.os.freebsd": "FreeBSD %s",
"command.about.serverInfo.os.linux": "Linux %s",
"command.about.serverInfo.os.macos": "macOS",
"command.about.serverInfo.os.macos_old": "OS X",
"command.about.serverInfo.os": "Operating system",
"command.about.serverInfo.processor": "CPU",
"command.about.serverInfo.arch": "Architecture",
"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.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": "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 your client's hashing system.",
"command.disallowed.perms.yourLevel": "Your permission level: %s",
"command.disallowed.perms.cmdLevel": "Command requires: %s",
"copyText": "Click to copy!"
}

View file

@ -1,89 +0,0 @@
{
"time.week": " week ",
"time.weekPlural": " weeks ",
"time.day": " day ",
"time.dayPlural": " days ",
"time.hour": " houw ",
"time.hourPlural": " houws ",
"time.minute": " minyute ",
"time.minutePlural": " minyutes ",
"time.second": " second ",
"time.secondPlural": " seconds ",
"command.about.usage": "",
"command.about.desc": "About the bot",
"command.cb.usage": " <command>",
"command.cb.desc": "Wun a command in a command bwock",
"command.cloop.usage": " add <wate> <command>|| remove <index>|| list|| clear",
"command.cloop.desc": "Manage command woops",
"command.eval.usage": " <code>",
"command.eval.desc": "Wun JavaScwipt code",
"command.help.usage": " [cmd]",
"command.help.desc": "Shows command hewp",
"command.logoff.usage": "",
"command.logoff.desc": "Disconnyect and weconnyect the bot fwom a sewvew",
"command.netmsg.usage": " <message>",
"command.netmsg.desc": "Send a message to aww sewvews the bot is connyected to",
"command.refill.usage": "",
"command.refill.desc": "Wefiww cowe",
"command.say.usage": " <message>",
"command.say.desc": "Sends a message to chat",
"command.serverinfo.usage": "",
"command.serverinfo.desc": "Get system/bot info",
"command.stop.usage": "",
"command.stop.desc": "Westawt bot",
"command.template.usage": " <wequiwed> [optionyaw]",
"command.template.desc": "Does nyothing",
"command.tpr.desc": "Tewepowt to a wandom wocation",
"command.tpr.usage": "",
"command.verify.usage": " [awgs...]",
"command.verify.desc": "Check the hashing system",
"command.about.author": "%s - a Minyecwaft bot made by %s",
"command.about.version": "Vewsion %s",
"command.about.preRelease": "This is pwewewease softwawe - thewe may be ewwows, and featuwes may be changed ow wemoved at any time.",
"command.about.sourceCode": "Souwce code: %s",
"command.about.sourceCode.openInBrowser": "Cwick to open the souwce code wink in youw defauwt bwowsew",
"command.about.serverinfo": "To view system infowmation, wun the command %s.",
"command.cloop.error.tooShort": "Command woops must have a wate above 20ms.",
"command.cloop.error.subcommand": "Unknyown subcommand, pwease do %s",
"command.cloop.success.add": "Added command woop with command %s and wate %s",
"command.cloop.success.remove": "Wemoved command woop %s",
"command.cloop.success.clear": "Cweawed aww command woops",
"command.cloop.list": "%s: Command: %s Wate: %s",
"command.help.cmdList": "Commands:",
"command.help.commandInfo": "%s%s - %s",
"command.help.commandUsage": "Usage - %s%s",
"command.help.commandDesc": "Descwiption - %s",
"command.help.commandPerms": "Wequiwed pewmissions - %s",
"command.help.permsNormal": "Nyowmaw",
"command.help.permsTrusted": "Twusted",
"command.help.permsOwner": "Ownyew",
"command.help.permsConsole": "Consowe",
"command.help.noCommand": "Command does nyot exist",
"command.serverinfo.os.android": "Andwoid",
"command.serverinfo.os.freebsd": "FweeBSD",
"command.serverinfo.os.linux": "Winyux %s",
"command.serverinfo.os.macos": "macOS",
"command.serverinfo.os.macos_old": "OS X",
"command.serverinfo.os": "Opewating system",
"command.serverinfo.processor": "CPU",
"command.serverinfo.arch": "Awchitectuwe",
"command.serverinfo.osUsername": "Usewnyame",
"command.serverinfo.hostName": "Hostnyame",
"command.serverinfo.workingDir": "Wowking diwectowy",
"command.serverinfo.runTime": "Bot uptime",
"command.serverinfo.upTime": "System uptime",
"command.serverinfo.nodeVersion": "Nyode.js vewsion",
"command.serverinfo.osRelease": "Winyux wewease",
"command.serverinfo.osRelease.missing": "/etc/os-release does nyot exist. Infowmation may be wimited.",
"command.serverinfo.os.android.version": "Andwoid vewsion",
"command.serverinfo.os.android.model": "Device modew",
"command.serverinfo.botName": "Bot nyame",
"command.serverinfo.botVer": "Bot vewsion",
"command.tpr.success": "Tewepowting %s to %s, %s, %s",
"command.verify.success": "Successfuwwy vewified with pewmission wevew %s",
"command.error": "An ewwow occuwed (check consowe fow mowe info)",
"command.disallowed.perms": "You do nyot have pewmission to wun this command. If you do have pewmission, pwease make suwe you put the command hash at the end, ow wan the command thwough youw cwient's hashing system.",
"command.disallowed.perms.yourLevel": "Youw pewmission wevew: %s",
"command.disallowed.perms.cmdLevel": "Command wequiwes: %s",
"copyText": "Cwick to copy!"
}

View file

@ -1,71 +0,0 @@
{
"command.about.usage": "",
"command.about.desc": "About the bot",
"command.cb.usage": " <command>",
"command.cb.desc": "Wun a command in a command bwock",
"command.cloop.usage": " add <wate> <command>|| remove <index>|| list|| clear",
"command.cloop.desc": "Manage command woops",
"command.eval.usage": " <code>",
"command.eval.desc": "Wun JavaScwipt code",
"command.help.usage": " [cmd]",
"command.help.desc": "Shows command hewp",
"command.logoff.usage": "",
"command.logoff.desc": "Disconnyect and weconnyect the bot fwom a sewvew",
"command.netmsg.usage": " <message>",
"command.netmsg.desc": "Send a message to aww sewvews the bot is connyected to",
"command.refill.usage": "",
"command.refill.desc": "Wefiww cowe",
"command.say.usage": " <message>",
"command.say.desc": "Sends a message to chat",
"command.serverinfo.usage": "",
"command.serverinfo.desc": "Get system/bot info",
"command.stop.usage": "",
"command.stop.desc": "Westawt bot",
"command.template.usage": " <wequiwed> [optionyaw]",
"command.template.desc": "Does nyothing",
"command.verify.usage": " [awgs...]",
"command.verify.desc": "Check the hashing system",
"command.about.author": "%s - a Minyecwaft bot made by 77c8f4699b732c11 / a5a06d596f15c7db\nThis is currently set to uwu language to test support for other languages. It is stored internally as Hebrew (Israel) - language code he-IL.",
"command.about.version": "Vewsion %s",
"command.about.serverinfo": "To view system infowmation, wun the command %s.",
"command.cloop.error.tooShort": "Command woops must have a wate above 20ms.",
"command.cloop.success.add": "Added command woop with command %s and wate %s",
"command.cloop.success.remove": "Wemoved command woop %s",
"command.cloop.success.clear": "Cweawed aww command woops",
"command.cloop.list": "%s: Command: %s Rate: %s",
"command.help.cmdList": "Commands",
"command.help.commandInfo": "%s%s - %s",
"command.help.commandUsage": "Usage - %s%s",
"command.help.commandDesc": "Descwiption - %s",
"command.help.commandPerms": "Wequiwed pewmissions - %s",
"command.help.permsNormal": "Nyowmaw",
"command.help.permsTrusted": "Twusted",
"command.help.permsOwner": "Ownyew",
"command.help.permsConsole": "Consowe",
"command.help.noCommand": "Command does nyot exist",
"command.serverinfo.os.android": "Andwoid",
"command.serverinfo.os.freebsd": "FweeBSD",
"command.serverinfo.os.linux": "Winyux",
"command.serverinfo.os.macos": "macOS",
"command.serverinfo.os.macos_old": "OS X",
"command.serverinfo.os": "Opewating system",
"command.serverinfo.processor": "CPU",
"command.serverinfo.arch": "Awchitectuwe",
"command.serverinfo.osUsername": "Usewnyame",
"command.serverinfo.hostName": "Hostnyame",
"command.serverinfo.workingDir": "Wowking diwectowy",
"command.serverinfo.runTime": "Bot uptime",
"command.serverinfo.upTime": "System uptime",
"command.serverinfo.nodeVersion": "Nyode.js vewsion",
"command.serverinfo.osRelease": "Winyux wewease",
"command.serverinfo.osRelease.missing": "/etc/os-release does nyot exist. Infowmation may be wimited.",
"command.serverinfo.os.android.version": "Andwoid vewsion",
"command.serverinfo.os.android.model": "Device modew",
"command.serverinfo.botName": "Bot nyame",
"command.serverinfo.botVer": "Bot vewsion",
"command.error": "An ewwow occuwed (check consowe fow mowe info)",
"command.disallowed.perms": "You do nyot have pewmission to wun this command. If you do have pewmission, pwease make suwe you put the command hash at the end, ow wan the command thwough youw cwient's hashing system.",
"command.disallowed.perms.yourLevel": "Youw pewmission wevew: %s",
"command.disallowed.perms.cmdLevel": "Command wequiwes: %s",
"copyText": "Cwick to copy!"
}

View file

@ -1,17 +0,0 @@
const settings=require("../settings.json");
module.exports = function (text) {
return JSON.stringify({
translate: "[%s] %s",
color: "#FFAAFF",
with:[
{
text: settings.name,
color: "light_purple"
},
{
text: text,
color: "white"
}
]
})
}

View file

@ -1,24 +0,0 @@
module.exports = function (time) {
let finalString = ''
const seconds = Math.floor(time / 1000) % 60
const minutes = Math.floor(time / 60000) % 60
const hours = Math.floor(time / 3600000) % 24
const days = Math.floor(time / 86400000) % 7
const weeks = Math.floor(time / 604800000)
if (weeks != 0) {
finalString += `${weeks} week${weeks == 1 ? '' : 's'} `
}
if (days != 0) {
finalString += `${days} day${days == 1 ? '' : 's'} `
}
if (hours != 0) {
finalString += `${hours} hour${hours == 1 ? '' : 's'} `
}
if (minutes != 0) {
finalString += `${minutes} minute${minutes == 1 ? '' : 's'} `
}
if (seconds != 0) {
finalString += `${seconds} second${seconds == 1 ? '' : 's'} `
}
return finalString
}

View file

@ -1,3 +1,4 @@
const crypto = require('crypto')
const rsg = function (count) {
let output = ''
for (let i = 0; i < count; i++) {
@ -29,9 +30,19 @@ const rsg = function (count) {
}
return output
}
const rsgLegal = function (count) {
let output = ''
if(Math.random()>0.5){
output += "uwu_"
} else {
output += "owo_"
}
output += crypto.randomBytes(count).toString("hex")
return output
}
module.exports = function (legal) {
if (legal) {
return Math.floor(Math.random() * 1000000).toString()
return rsgLegal(6)
} else {
return rsg(6 + Math.floor(Math.random() * 3))
}

View file

@ -1,7 +1,7 @@
{
"botName": "botvX Dev",
"botVersion": "10.0.0-beta.2",
"botVersion": "10.0.0",
"botAuthor": "a5a06d596f15c7db",
"isPreRelease": true,
"sourceURL": "https://code.chipmunk.land/7cc5c4f330d47060/botvX"
}
}