The 10th and 11th versions of my Minecraft bot.
1694977ddb
const cp = require('child_process') const version = require('../../version.json') const {getMessage,formatTime} = 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()} (${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.botName'), version.botName, c.colors)) let botVersion = version.botVersion let gitCommit let gitBranch try { gitCommit = cp.execSync('git rev-parse --short HEAD').toString('UTF-8').split('\n')[0] gitBranch = cp.execSync('git rev-parse --abbrev-ref HEAD').toString('UTF-8').split('\n')[0] } catch (e) { gitCommit = false gitBranch = false } if (gitCommit) { botVersion += ` (${gitCommit} - ${gitBranch})` } c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.botVer'), botVersion, c.colors)) } } |
||
---|---|---|
plugins | ||
util | ||
.gitignore | ||
index.js | ||
launch.cmd | ||
launch.sh | ||
LICENSE | ||
package-lock.json | ||
package.json | ||
README.md | ||
secret_example.json | ||
settings_example.json | ||
version.json |
botvX
What is it?
botvX is a Minecraft bot for Kaboom 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?
- Install Node.js for your operating system.
- Download the latest release, or alternatively, download the latest development version using
git clone https://code.chipmunk.land/7cc5c4f330d47060/botvX/
. - Extract the files if necessary.
- Run
npm install
in the bot's directory. If it doesn't work, try using the Node.js command prompt, or adding Node.js to your PATH. - Copy
settings_example.json
tosettings.json
, and adjust the settings to fit your needs. Do not forget to also create a secrets file. An example secrets file is provided assecret_example.json
. Do not forget, if you use the secrets template, to change the keys (the ones in there are public after all!). - Run ./launch.sh (macOS, Linux, FreeBSD) or ./launch.cmd (Windows) to start a bot launcher, which will reload the bot when the process closes. If it displays an error saying Node is not a command, please make sure Node.js is on your PATH.
Command list
Name | Usage | Description |
---|---|---|
about | About the bot | |
cb | <command> | Run a command in a command block |
cloop | add , remove , list, clear | Manage command loops |
eval | <code> | Run JavaScript code (must run through console) |
help | [cmd] | Shows command help |
logoff | Disconnect and reconnect the bot from a server | |
netmsg | <message> | Send a message to all servers the bot is connected to |
refill | Refill core | |
say | <message> | Sends a message to chat |
serverinfo | Get system/bot info, similar to Kaboom's serverinfo command |
|
stop | Restart bot | |
template | Used in development, does nothing | |
tpr | Teleport to a random location | |
verify | Check the hashing system |