h-hewwo chipmunk :333333
This commit is contained in:
commit
455fe5aede
47 changed files with 2704 additions and 0 deletions
153
.gitignore
vendored
Normal file
153
.gitignore
vendored
Normal file
|
@ -0,0 +1,153 @@
|
|||
# ---> VisualStudioCode
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
!.vscode/*.code-snippets
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Built Visual Studio Code Extensions
|
||||
*.vsix
|
||||
|
||||
# ---> Kate
|
||||
# Swap Files #
|
||||
.*.kate-swp
|
||||
.swp.*
|
||||
|
||||
# ---> Node
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional stylelint cache
|
||||
.stylelintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# vuepress v2.x temp and cache directory
|
||||
.temp
|
||||
.cache
|
||||
|
||||
# Docusaurus cache and generated files
|
||||
.docusaurus
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
|
||||
# yarn v2
|
||||
.yarn/cache
|
||||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
# Bot Settings
|
||||
settings.json
|
9
LICENSE
Normal file
9
LICENSE
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2024 7cc5c4f330d47060
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
42
README.md
Normal file
42
README.md
Normal file
|
@ -0,0 +1,42 @@
|
|||
# botvX
|
||||
|
||||
## Что это такое?
|
||||
|
||||
botvX or UBot 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:
|
||||
|
||||
- commands (obviously)
|
||||
- a self care system
|
||||
- a command core, to run commands quickly
|
||||
|
||||
## 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.
|
||||
|
||||
## What does "UBot" mean?
|
||||
|
||||
"UBot" just means "UBot", but is based on an older bot name "UnnamedBot". On some older versions, this bot did not have a proper name. "UnnamedBot" was introduced in version 4, which was shortened to just "UBot" around version 8.
|
||||
|
||||
## How to install?
|
||||
|
||||
1. Download the latest release, or alternatively, download the latest development version using <code>git clone https://10.0.0.151:3000/7cc5c4f330d47060/botvX/</code>.
|
||||
2. Extract the files if necessary.
|
||||
3. Copy <code>settings2.json</code> to <code>settings.json</code> , and adjust the settings to fit your needs. Do not forget to also create a secrets file.
|
||||
4. Run ./launch.sh to start a bot launcher, which will reload the bot when the process closes.
|
||||
|
||||
## Command list
|
||||
|
||||
| Name | Usage | Description |
|
||||
|-|-|-|
|
||||
| about | | About the bot |
|
||||
| cb | \<command\> | Run a command in a command block |
|
||||
| cloop | add <rate> <command>, remove <index>, 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 <code>serverinfo</code> command |
|
||||
| stop | | Restart bot |
|
||||
| template | | Used in development, does nothing |
|
||||
| verify | | Check the hashing system |
|
77
index.js
Executable file
77
index.js
Executable file
|
@ -0,0 +1,77 @@
|
|||
const m = require('minecraft-protocol')
|
||||
const settings = require('./settings.json')
|
||||
const generateUser = require('./util/usergen.js')
|
||||
const EventEmitter = require('node:events')
|
||||
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) }
|
||||
}
|
||||
botplug.forEach((plug) => {
|
||||
try {
|
||||
if (botno !== undefined) {
|
||||
if (plug.loadBot) {
|
||||
plug.loadBot(module.exports.bot[botno])
|
||||
}
|
||||
} else {
|
||||
plug.load()
|
||||
}
|
||||
} catch (e) { console.log(e) }
|
||||
})
|
||||
}
|
||||
loadplug()
|
||||
|
||||
const createBot = function createBot (host, oldId) {
|
||||
if (host.options.disabled) {
|
||||
console.log(`Skipping server ${host.host}:${host.port}`)
|
||||
return
|
||||
}
|
||||
const bot = new EventEmitter()
|
||||
bot._client = m.createClient({
|
||||
host: host.host,
|
||||
port: host.port ? host.port : 25565,
|
||||
username: generateUser(host.options.legalName),
|
||||
version: settings.version_mc
|
||||
})
|
||||
bot._client.on('success', () => {
|
||||
})
|
||||
if (typeof oldId !== 'undefined') {
|
||||
for (const i in module.exports.bot[oldId].interval) {
|
||||
clearInterval(module.exports.bot[oldId].interval[i])
|
||||
}
|
||||
delete module.exports.bot[oldId]
|
||||
bot.id = oldId
|
||||
module.exports.bot[oldId] = bot
|
||||
console.log('Re-creating bot ' + bot.id)
|
||||
} else {
|
||||
bot.id = module.exports.bot.length
|
||||
module.exports.bot.push(bot)
|
||||
console.log('Creating bot ' + bot.id)
|
||||
}
|
||||
|
||||
bot.host = host
|
||||
bot.interval = {}
|
||||
|
||||
bot.info = (msg) => {
|
||||
console.log(`[${bot.id}] [info] ${msg}`)
|
||||
}
|
||||
loadplug(bot.id)
|
||||
bot._client.on('error', (err) => {
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
|
||||
for (const i in settings.servers) {
|
||||
createBot(settings.servers[i])
|
||||
}
|
||||
module.exports.createBot = createBot
|
5
launch.sh
Executable file
5
launch.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
while [ true ];
|
||||
do node index.js;
|
||||
sleep 6;
|
||||
done
|
830
package-lock.json
generated
Executable file
830
package-lock.json
generated
Executable file
|
@ -0,0 +1,830 @@
|
|||
{
|
||||
"name": "botv10",
|
||||
"version": "10.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "botv10",
|
||||
"version": "10.0.0",
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
"minecraft-protocol": "^1.45.0",
|
||||
"prismarine-chat": "^1.10.0"
|
||||
}
|
||||
},
|
||||
"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==",
|
||||
"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==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@azure/msal-common": "14.14.0",
|
||||
"jsonwebtoken": "^9.0.0",
|
||||
"uuid": "^8.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.14.12",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.12.tgz",
|
||||
"integrity": "sha512-r7wNXakLeSsGT0H1AU863vS2wa5wBOK4bWMjZz2wj+8nBx+m5PeIn0k8AloSLpRuiwdRQZwarZqHE4FNArPuJQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~5.26.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/readable-stream": {
|
||||
"version": "4.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-4.0.15.tgz",
|
||||
"integrity": "sha512-oAZ3kw+kJFkEqyh7xORZOku1YAKvsFTogRY8kVl4vHpEKiDkfnSA/My8haRE7fvmix5Zyy+1pwzOi7yycGLBJw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"safe-buffer": "~5.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@xboxreplay/errors": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@xboxreplay/errors/-/errors-0.1.0.tgz",
|
||||
"integrity": "sha512-Tgz1d/OIPDWPeyOvuL5+aai5VCcqObhPnlI3skQuf80GVF3k1I0lPCnGC+8Cm5PV9aLBT5m8qPcJoIUQ2U4y9g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@xboxreplay/xboxlive-auth": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@xboxreplay/xboxlive-auth/-/xboxlive-auth-3.3.3.tgz",
|
||||
"integrity": "sha512-j0AU8pW10LM8O68CTZ5QHnvOjSsnPICy0oQcP7zyM7eWkDQ/InkiQiirQKsPn1XRYDl4ccNu0WM582s3UKwcBg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@xboxreplay/errors": "^0.1.0",
|
||||
"axios": "^0.21.1"
|
||||
}
|
||||
},
|
||||
"node_modules/abort-controller": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
|
||||
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"event-target-shim": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/aes-js": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz",
|
||||
"integrity": "sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/ajv": {
|
||||
"version": "6.12.6",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
||||
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
"fast-json-stable-stringify": "^2.0.0",
|
||||
"json-schema-traverse": "^0.4.1",
|
||||
"uri-js": "^4.2.2"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/epoberezkin"
|
||||
}
|
||||
},
|
||||
"node_modules/asn1": {
|
||||
"version": "0.2.3",
|
||||
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz",
|
||||
"integrity": "sha512-6i37w/+EhlWlGUJff3T/Q8u1RGmP5wgbiwYnOnbOqvtrPxT63/sYFyP9RcpxtxGymtfA075IvmOnL7ycNOWl3w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
|
||||
"integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.14.0"
|
||||
}
|
||||
},
|
||||
"node_modules/base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/buffer": {
|
||||
"version": "6.0.3",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
|
||||
"integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.2.1"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer-equal": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.1.tgz",
|
||||
"integrity": "sha512-QoV3ptgEaQpvVwbXdSO39iqPQTCxSF7A5U99AxbHYqUdCizL/lH2Z0A2y6nbZucxMEOtNyZfG2s6gsVugGpKkg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer-equal-constant-time": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
|
||||
"integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==",
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/commander": {
|
||||
"version": "2.20.3",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.5",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz",
|
||||
"integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "2.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/discontinuous-range": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/discontinuous-range/-/discontinuous-range-1.0.0.tgz",
|
||||
"integrity": "sha512-c68LpLbO+7kP/b1Hr1qs8/BJ09F5khZGTxqxZuhzxpmwJKOgRFHJWIb9/KmqnqHhLdO55aOxFH/EGBvUQbL/RQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/ecdsa-sig-formatter": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
|
||||
"integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/endian-toggle": {
|
||||
"version": "0.0.0",
|
||||
"resolved": "https://registry.npmjs.org/endian-toggle/-/endian-toggle-0.0.0.tgz",
|
||||
"integrity": "sha512-ShfqhXeHRE4TmggSlHXG8CMGIcsOsqDw/GcoPcosToE59Rm9e4aXaMhEQf2kPBsBRrKem1bbOAv5gOKnkliMFQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/event-target-shim": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
||||
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/events": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
|
||||
"integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.8.x"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/fast-json-stable-stringify": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
|
||||
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.15.6",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
|
||||
"integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"debug": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/ieee754": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/jose": {
|
||||
"version": "4.15.9",
|
||||
"resolved": "https://registry.npmjs.org/jose/-/jose-4.15.9.tgz",
|
||||
"integrity": "sha512-1vUQX+IdDMVPj4k8kOxgUqlcK518yluMuGZwqlr44FS1ppZB/5GWh4rZG89erpOBOJjU/OBsnCVFfapsRz6nEA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/panva"
|
||||
}
|
||||
},
|
||||
"node_modules/json-schema-traverse": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
|
||||
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/jsonwebtoken": {
|
||||
"version": "9.0.2",
|
||||
"resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz",
|
||||
"integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"jws": "^3.2.2",
|
||||
"lodash.includes": "^4.3.0",
|
||||
"lodash.isboolean": "^3.0.3",
|
||||
"lodash.isinteger": "^4.0.4",
|
||||
"lodash.isnumber": "^3.0.3",
|
||||
"lodash.isplainobject": "^4.0.6",
|
||||
"lodash.isstring": "^4.0.1",
|
||||
"lodash.once": "^4.0.0",
|
||||
"ms": "^2.1.1",
|
||||
"semver": "^7.5.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12",
|
||||
"npm": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/jwa": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz",
|
||||
"integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"buffer-equal-constant-time": "1.0.1",
|
||||
"ecdsa-sig-formatter": "1.0.11",
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/jws": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz",
|
||||
"integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"jwa": "^1.4.1",
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/lodash.get": {
|
||||
"version": "4.4.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
|
||||
"integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.includes": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
|
||||
"integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.isboolean": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz",
|
||||
"integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.isinteger": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz",
|
||||
"integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.isnumber": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz",
|
||||
"integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.isplainobject": {
|
||||
"version": "4.0.6",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
|
||||
"integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.isstring": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz",
|
||||
"integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.merge": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
|
||||
"integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.once": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
|
||||
"integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.reduce": {
|
||||
"version": "4.6.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.reduce/-/lodash.reduce-4.6.0.tgz",
|
||||
"integrity": "sha512-6raRe2vxCYBhpBu+B+TtNGUzah+hQjVdu3E17wfusjyrXBka2nBS8OH/gjVZ5PvHOhWmIZTYri09Z6n/QfnNMw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/macaddress": {
|
||||
"version": "0.5.3",
|
||||
"resolved": "https://registry.npmjs.org/macaddress/-/macaddress-0.5.3.tgz",
|
||||
"integrity": "sha512-vGBKTA+jwM4KgjGZ+S/8/Mkj9rWzePyGY6jManXPGhiWu63RYwW8dKPyk5koP+8qNVhPhHgFa1y/MJ4wrjsNrg==",
|
||||
"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==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/minecraft-folder-path": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/minecraft-folder-path/-/minecraft-folder-path-1.2.0.tgz",
|
||||
"integrity": "sha512-qaUSbKWoOsH9brn0JQuBhxNAzTDMwrOXorwuRxdJKKKDYvZhtml+6GVCUrY5HRiEsieBEjCUnhVpDuQiKsiFaw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/minecraft-protocol": {
|
||||
"version": "1.47.0",
|
||||
"resolved": "https://registry.npmjs.org/minecraft-protocol/-/minecraft-protocol-1.47.0.tgz",
|
||||
"integrity": "sha512-IHL8faXLLIWv1O+2v2NgyKlooilu/OiSL9orI8Kqed/rZvVOrFPzs2PwMAYjpQX9gxLPhiSU19KqZ8CjfNuqhg==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"@types/readable-stream": "^4.0.0",
|
||||
"aes-js": "^3.1.2",
|
||||
"buffer-equal": "^1.0.0",
|
||||
"debug": "^4.3.2",
|
||||
"endian-toggle": "^0.0.0",
|
||||
"lodash.get": "^4.1.2",
|
||||
"lodash.merge": "^4.3.0",
|
||||
"minecraft-data": "^3.55.0",
|
||||
"minecraft-folder-path": "^1.2.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"node-rsa": "^0.4.2",
|
||||
"prismarine-auth": "^2.2.0",
|
||||
"prismarine-chat": "^1.10.0",
|
||||
"prismarine-nbt": "^2.5.0",
|
||||
"prismarine-realms": "^1.2.0",
|
||||
"protodef": "^1.8.0",
|
||||
"readable-stream": "^4.1.0",
|
||||
"uuid-1345": "^1.0.1",
|
||||
"yggdrasil": "^1.4.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/mojangson": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/mojangson/-/mojangson-2.0.4.tgz",
|
||||
"integrity": "sha512-HYmhgDjr1gzF7trGgvcC/huIg2L8FsVbi/KacRe6r1AswbboGVZDS47SOZlomPuMWvZLas8m9vuHHucdZMwTmQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"nearley": "^2.19.5"
|
||||
}
|
||||
},
|
||||
"node_modules/moo": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/moo/-/moo-0.5.2.tgz",
|
||||
"integrity": "sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q==",
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/nearley": {
|
||||
"version": "2.20.1",
|
||||
"resolved": "https://registry.npmjs.org/nearley/-/nearley-2.20.1.tgz",
|
||||
"integrity": "sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"commander": "^2.19.0",
|
||||
"moo": "^0.5.0",
|
||||
"railroad-diagrams": "^1.0.0",
|
||||
"randexp": "0.4.6"
|
||||
},
|
||||
"bin": {
|
||||
"nearley-railroad": "bin/nearley-railroad.js",
|
||||
"nearley-test": "bin/nearley-test.js",
|
||||
"nearley-unparse": "bin/nearley-unparse.js",
|
||||
"nearleyc": "bin/nearleyc.js"
|
||||
},
|
||||
"funding": {
|
||||
"type": "individual",
|
||||
"url": "https://nearley.js.org/#give-to-nearley"
|
||||
}
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/node-rsa": {
|
||||
"version": "0.4.2",
|
||||
"resolved": "https://registry.npmjs.org/node-rsa/-/node-rsa-0.4.2.tgz",
|
||||
"integrity": "sha512-Bvso6Zi9LY4otIZefYrscsUpo2mUpiAVIEmSZV2q41sP8tHZoert3Yu6zv4f/RXJqMNZQKCtnhDugIuCma23YA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"asn1": "0.2.3"
|
||||
}
|
||||
},
|
||||
"node_modules/prismarine-auth": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/prismarine-auth/-/prismarine-auth-2.5.0.tgz",
|
||||
"integrity": "sha512-CRv/pL6d/T+4cdjWS223PXG+ygHbz40Kef04L59SLMT+axNdAQro23eZZhgiIIu6u7rlvJcZYlIY93gFNtKxXA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@azure/msal-node": "^2.0.2",
|
||||
"@xboxreplay/xboxlive-auth": "^3.3.3",
|
||||
"debug": "^4.3.3",
|
||||
"jose": "^4.1.4",
|
||||
"node-fetch": "^2.6.1",
|
||||
"smart-buffer": "^4.1.0",
|
||||
"uuid-1345": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/prismarine-chat": {
|
||||
"version": "1.10.1",
|
||||
"resolved": "https://registry.npmjs.org/prismarine-chat/-/prismarine-chat-1.10.1.tgz",
|
||||
"integrity": "sha512-XukYcuueuhDxzEXG7r8BZyt6jOObrPPB4JESCgb+/XenB9nExoSHF8eTQWWj8faKPLqm1dRQaYwFJlNBlJZJUw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mojangson": "^2.0.1",
|
||||
"prismarine-nbt": "^2.0.0",
|
||||
"prismarine-registry": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prismarine-nbt": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/prismarine-nbt/-/prismarine-nbt-2.5.0.tgz",
|
||||
"integrity": "sha512-F0/8UAa9SDDnAGrBYqZc4nG8h2zj5cE2eAJU5xlDR/IsQQ3moVxkOjE3h3nMv6SbvZrvAcgX7waA/nd9LLHYdA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"protodef": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prismarine-realms": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/prismarine-realms/-/prismarine-realms-1.3.2.tgz",
|
||||
"integrity": "sha512-5apl9Ru8veTj5q2OozRc4GZOuSIcs3yY4UEtALiLKHstBe8bRw8vNlaz4Zla3jsQ8yP/ul1b1IJINTRbocuA6g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "^4.3.3",
|
||||
"node-fetch": "^2.6.1"
|
||||
}
|
||||
},
|
||||
"node_modules/prismarine-registry": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/prismarine-registry/-/prismarine-registry-1.7.0.tgz",
|
||||
"integrity": "sha512-yyva0FpWI078nNeMhx8ekVza5uUTYhEv+C+ADu3wUQXiG8qhXkvrf0uzsnhTgZL8BLdsi2axgCEiKw9qSKIuxQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"minecraft-data": "^3.0.0",
|
||||
"prismarine-nbt": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/process": {
|
||||
"version": "0.11.10",
|
||||
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
||||
"integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/protodef": {
|
||||
"version": "1.15.0",
|
||||
"resolved": "https://registry.npmjs.org/protodef/-/protodef-1.15.0.tgz",
|
||||
"integrity": "sha512-bZ2Omw8dT+DACjJHLrBWZlqN4MlT9g9oSpJDdkUAJOStUzgJp+Zn42FJfPUdwutUxjaxA0PftN0PDlNa2XbneA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"lodash.get": "^4.4.2",
|
||||
"lodash.reduce": "^4.6.0",
|
||||
"protodef-validator": "^1.3.0",
|
||||
"readable-stream": "^3.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/protodef-validator": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/protodef-validator/-/protodef-validator-1.3.1.tgz",
|
||||
"integrity": "sha512-lZ5FWKZYR9xOjpMw1+EfZRfCjzNRQWPq+Dk+jki47Sikl2EeWEPnTfnJERwnU/EwFq6us+0zqHHzSsmLeYX+Lg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ajv": "^6.5.4"
|
||||
},
|
||||
"bin": {
|
||||
"protodef-validator": "cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/protodef/node_modules/readable-stream": {
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/punycode": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
||||
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/railroad-diagrams": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz",
|
||||
"integrity": "sha512-cz93DjNeLY0idrCNOH6PviZGRN9GJhsdm9hpn1YCS879fj4W+x5IFJhhkRZcwVgMmFF7R82UA/7Oh+R8lLZg6A==",
|
||||
"license": "CC0-1.0"
|
||||
},
|
||||
"node_modules/randexp": {
|
||||
"version": "0.4.6",
|
||||
"resolved": "https://registry.npmjs.org/randexp/-/randexp-0.4.6.tgz",
|
||||
"integrity": "sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"discontinuous-range": "1.0.0",
|
||||
"ret": "~0.1.10"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.12"
|
||||
}
|
||||
},
|
||||
"node_modules/readable-stream": {
|
||||
"version": "4.5.2",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz",
|
||||
"integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"abort-controller": "^3.0.0",
|
||||
"buffer": "^6.0.3",
|
||||
"events": "^3.3.0",
|
||||
"process": "^0.11.10",
|
||||
"string_decoder": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ret": {
|
||||
"version": "0.1.15",
|
||||
"resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz",
|
||||
"integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.12"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "7.6.3",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
|
||||
"integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==",
|
||||
"license": "ISC",
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/smart-buffer": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
|
||||
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 6.0.0",
|
||||
"npm": ">= 3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/string_decoder": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safe-buffer": "~5.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/string_decoder/node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "5.26.5",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
||||
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/uri-js": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||
"integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/uuid-1345": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid-1345/-/uuid-1345-1.0.2.tgz",
|
||||
"integrity": "sha512-bA5zYZui+3nwAc0s3VdGQGBfbVsJLVX7Np7ch2aqcEWFi5lsAEcmO3+lx3djM1npgpZI8KY2FITZ2uYTnYUYyw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"macaddress": "^0.5.1"
|
||||
}
|
||||
},
|
||||
"node_modules/webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
|
||||
"license": "BSD-2-Clause"
|
||||
},
|
||||
"node_modules/whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/yggdrasil": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/yggdrasil/-/yggdrasil-1.7.0.tgz",
|
||||
"integrity": "sha512-QBIo5fiNd7688G3FqXXYGr36uyrYzczlNuzpWFy2zL3+R+3KT2lF+wFxm51synfA3l3z6IBiGOc1/EVXWCYY1Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"node-fetch": "^2.6.1",
|
||||
"uuid": "^8.2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
package.json
Executable file
15
package.json
Executable file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"minecraft-protocol": "^1.45.0",
|
||||
"prismarine-chat": "^1.10.0"
|
||||
},
|
||||
"name": "botv10",
|
||||
"version": "10.0.0",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "UNLICENSED",
|
||||
"description": ""
|
||||
}
|
101
plugins/!chat.js
Executable file
101
plugins/!chat.js
Executable file
|
@ -0,0 +1,101 @@
|
|||
const console2 = require('./console.js')
|
||||
const parse = require('../util/chatparse.js')
|
||||
const parse1204 = require('../util/chatparse_1204.js')
|
||||
const messageTypes = [
|
||||
'',
|
||||
'chat.type.emote',
|
||||
'commands.message.display.incoming',
|
||||
'',
|
||||
'',
|
||||
'chat.type.announcement',
|
||||
'',
|
||||
''
|
||||
]
|
||||
module.exports = {
|
||||
load: () => {
|
||||
|
||||
},
|
||||
loadBot: (b) => {
|
||||
b._client.on('profileless_chat', (data) => {
|
||||
if (data.type === 4) {
|
||||
const json = parse1204(data.message)
|
||||
const parsed = parse(json)[1]
|
||||
const split = parsed.split(': ')
|
||||
const chatName = split.splice(0, 1)[0]
|
||||
const username = b.findRealName(chatName)
|
||||
const uuid = b.findUUID(username)
|
||||
b.emit('chat', { json, type: 'profileless', uuid, message: split.join(': '), username })
|
||||
} else {
|
||||
b.emit('chat', {
|
||||
json: {
|
||||
translate: messageTypes[data.type],
|
||||
color: data.type === 2 ? 'gray' : 'reset',
|
||||
with: [
|
||||
parse1204(data.name),
|
||||
parse1204(data.message)
|
||||
]
|
||||
},
|
||||
type: 'profileless',
|
||||
uuid: '00000000-0000-0000-0000-000000000000',
|
||||
message: parse(parse1204(data.message))[1],
|
||||
username: parse(parse1204(data.name))[1]
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
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: parse(parse1204(data.networkName))[1] })
|
||||
} else {
|
||||
b.emit('chat', {
|
||||
json: {
|
||||
translate: messageTypes[data.type],
|
||||
color: data.type === 2 ? 'gray' : 'reset',
|
||||
with: [
|
||||
parse1204(data.networkName),
|
||||
data.plainMessage
|
||||
]
|
||||
},
|
||||
type: 'player',
|
||||
uuid: data.senderUuid,
|
||||
message: parse(data.plainMessage)[1],
|
||||
username: parse(parse1204(data.networkName))[1]
|
||||
})
|
||||
}
|
||||
})
|
||||
b._client.on('system_chat', (data) => {
|
||||
const json = parse1204(data.content)
|
||||
const parsed = parse(json)[1]
|
||||
const split = parsed.split(': ')
|
||||
const chatName = split.splice(0, 1)[0]
|
||||
const username = b.findRealName(chatName)
|
||||
const uuid = b.findUUID(username)
|
||||
b.emit('chat', { json, type: 'system', uuid, message: split.join(': '), username })
|
||||
})
|
||||
b._client.on('chat', (data) => { // Legacy chat
|
||||
const json = parse1204(data.message)
|
||||
const parsed = parse(json)[1]
|
||||
const split = parsed.split(': ')
|
||||
const chatName = split.splice(0, 1)[0]
|
||||
const username = b.findRealName(chatName)
|
||||
const uuid = b.findUUID(username)
|
||||
b.emit('chat', { json, type: 'legacy', uuid: data.uuid ? data.uuid : uuid, message: split.join(': '), username })
|
||||
})
|
||||
b.on('chat', (data) => {
|
||||
const msg = parse(data.json)
|
||||
if (msg[1].endsWith('\n\n\n\n\nThe chat has been cleared')) return
|
||||
if (msg[1].startsWith('Command set: ')) return
|
||||
b.emit('plainchat', msg[1])
|
||||
console2.write(`[${b.id}] [${data.type}] ` + msg[0])
|
||||
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])
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
parse
|
||||
}
|
26
plugins/cloop.js
Executable file
26
plugins/cloop.js
Executable file
|
@ -0,0 +1,26 @@
|
|||
module.exports = {
|
||||
load: () => {
|
||||
|
||||
},
|
||||
loadBot: (b) => {
|
||||
b.cloops = []
|
||||
b.addCloop = function (command, rate) {
|
||||
b.cloops.push({
|
||||
command,
|
||||
rate,
|
||||
interval: setInterval(() => { b.ccq.push(command) }, rate)
|
||||
})
|
||||
b.ccq.push(command)
|
||||
}
|
||||
b.removeCloop = function (index) {
|
||||
clearInterval(b.cloops[index].interval)
|
||||
b.cloops.splice(index, 1)
|
||||
}
|
||||
b.clearCloops = function () {
|
||||
for (const i in b.cloops) {
|
||||
clearInterval(b.cloops[i].interval)
|
||||
}
|
||||
b.cloops = []
|
||||
}
|
||||
}
|
||||
}
|
186
plugins/command.js
Executable file
186
plugins/command.js
Executable file
|
@ -0,0 +1,186 @@
|
|||
const fs = require('fs')
|
||||
const Command = require('../util/Command.js')
|
||||
const hashcheck = require('../util/hashcheck.js')
|
||||
const settings = require('../settings.json')
|
||||
const getMessage = require('../util/lang.js')
|
||||
const cmds = Object.create(null)
|
||||
const sortHelp = function sortHelp (c1, c2) {
|
||||
const level1 = cmds[c1.with[1]].level ? cmds[c1.with[1]].level : 0
|
||||
const level2 = cmds[c2.with[1]].level ? cmds[c2.with[1]].level : 0
|
||||
return level1 - level2
|
||||
}
|
||||
module.exports = {
|
||||
load: () => {
|
||||
module.exports.loadCMD()
|
||||
},
|
||||
loadBot: (b) => {
|
||||
b.prefix = settings.prefix
|
||||
b.lastCmd = 0
|
||||
b.runCommand = (name, uuid, text, prefix) => {
|
||||
if (uuid === '00000000-0000-0000-0000-000000000000') return
|
||||
if (Date.now() - b.lastCmd <= 1000) return
|
||||
b.lastCmd = Date.now()
|
||||
const cmd = text.split(' ')
|
||||
const lang = settings.defaultLang
|
||||
const verify = hashcheck(cmd)
|
||||
if (verify > 0) {
|
||||
text = cmd.slice(0, cmd.length - 1).join(' ')
|
||||
}
|
||||
if (cmds[cmd[0].toLowerCase()]) {
|
||||
const command = cmds[cmd[0].toLowerCase()]
|
||||
if (command.level !== undefined && command.level > verify) {
|
||||
b.tellraw(uuid, {
|
||||
text: getMessage(lang, 'command.disallowed.perms')
|
||||
})
|
||||
b.tellraw(uuid, {
|
||||
text: getMessage(lang, 'command.disallowed.perms.yourLevel', [verify + ''])
|
||||
})
|
||||
b.tellraw(uuid, {
|
||||
text: getMessage(lang, 'command.disallowed.perms.cmdLevel', [command.level + ''])
|
||||
})
|
||||
return
|
||||
}
|
||||
try {
|
||||
cmds[cmd[0].toLowerCase()].execute(new Command(uuid, name, 'nick N/A', text, prefix, b, verify))
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
b.tellraw(uuid, {
|
||||
text: getMessage(lang, 'command.error'),
|
||||
color: 'red',
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
value: {
|
||||
text: e.stack
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
b.printHelp = (uuid, prefix, lang) => {
|
||||
const commandList = []
|
||||
for (const i in cmds) {
|
||||
if (cmds[i].hidden) continue
|
||||
let cmdColor
|
||||
switch (cmds[i].level) {
|
||||
case 0:
|
||||
cmdColor = 'green'
|
||||
break
|
||||
case 1:
|
||||
cmdColor = 'red'
|
||||
break
|
||||
case 2:
|
||||
cmdColor = 'dark_red'
|
||||
break
|
||||
case 3:
|
||||
cmdColor = 'dark_gray'
|
||||
break
|
||||
default:
|
||||
cmdColor = 'gray'
|
||||
}
|
||||
commandList.push(
|
||||
{
|
||||
translate: '%s%s ',
|
||||
color: cmdColor,
|
||||
with: [
|
||||
prefix,
|
||||
i
|
||||
]
|
||||
}
|
||||
)
|
||||
}
|
||||
b.tellraw(uuid, {
|
||||
translate: '%s: %s',
|
||||
with: [
|
||||
getMessage(lang, 'command.help.cmdList'),
|
||||
commandList.sort(sortHelp)
|
||||
]
|
||||
})
|
||||
}
|
||||
b.printCmdHelp = (uuid, cmd, lang, color) => {
|
||||
if (!cmds[cmd]) {
|
||||
b.tellraw(uuid, { text: getMessage(lang, 'command.help.noCommand') })
|
||||
return
|
||||
}
|
||||
let usage = getMessage(lang, `command.${cmd}.usage`).split('||')
|
||||
let desc = getMessage(lang, `command.${cmd}.desc`)
|
||||
if (cmds[cmd].usage) {
|
||||
usage = cmds[cmd].usage.split('||')
|
||||
}
|
||||
if (cmds[cmd].desc) {
|
||||
desc = cmds[cmd].desc
|
||||
}
|
||||
// b.tellraw(uuid,{"text":getMessage(lang,"command.help.commandInfo",[cmd,usage,desc])});
|
||||
for (const i in usage) {
|
||||
b.tellraw(uuid, {
|
||||
translate: getMessage(lang, 'command.help.commandUsage'),
|
||||
color: color.secondary,
|
||||
with: [
|
||||
{
|
||||
text: cmd,
|
||||
color: color.primary
|
||||
},
|
||||
{
|
||||
text: usage[i],
|
||||
color: color.primary
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
b.tellraw(uuid, {
|
||||
translate: getMessage(lang, 'command.help.commandDesc'),
|
||||
color: color.secondary,
|
||||
with: [
|
||||
{
|
||||
text: desc,
|
||||
color: color.primary
|
||||
}
|
||||
]
|
||||
})
|
||||
const permsN = getMessage(lang, 'command.help.permsNormal')
|
||||
const permsT = getMessage(lang, 'command.help.permsTrusted')
|
||||
const permsO = getMessage(lang, 'command.help.permsOwner')
|
||||
const permsC = getMessage(lang, 'command.help.permsConsole')
|
||||
const rPerms = cmds[cmd].level ? cmds[cmd].level : 0
|
||||
b.tellraw(uuid, {
|
||||
translate: getMessage(lang, 'command.help.commandPerms'),
|
||||
color: color.secondary,
|
||||
with: [
|
||||
{
|
||||
text: [permsN, permsT, permsO, permsC][rPerms],
|
||||
color: color.primary
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
},
|
||||
loadCMD: () => {
|
||||
const bpl = fs.readdirSync('./plugins/commands')
|
||||
for (const i in bpl) {
|
||||
if (!bpl[i].endsWith('.js')) {
|
||||
continue
|
||||
}
|
||||
try {
|
||||
const commandName = bpl[i].split('.js')[0]
|
||||
cmds[commandName] = require(`./commands/${bpl[i]}`)
|
||||
if (cmds[commandName].level === undefined) {
|
||||
cmds[commandName].level = 0
|
||||
}
|
||||
console.log('Loaded command ' + commandName)
|
||||
if (cmds[commandName].aliases) {
|
||||
for (const j in cmds[commandName].aliases) {
|
||||
cmds[cmds[commandName].aliases[j]] = {
|
||||
execute: cmds[commandName].execute,
|
||||
desc: 'Alias to ' + commandName,
|
||||
usage: cmds[commandName].usage,
|
||||
level: cmds[commandName].level,
|
||||
hidden: true,
|
||||
consoleIndex: cmds[commandName].consoleIndex
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) { console.log(e) }
|
||||
}
|
||||
},
|
||||
cmds
|
||||
}
|
106
plugins/commandblock.js
Executable file
106
plugins/commandblock.js
Executable file
|
@ -0,0 +1,106 @@
|
|||
const uuidToInt = require('../util/uuidtoint.js')
|
||||
module.exports = {
|
||||
cs: 4,
|
||||
cs_v: 6,
|
||||
load: function () {
|
||||
|
||||
},
|
||||
loadBot: function (b) {
|
||||
b.interval.commandFill = setInterval(() => { if (b.sc_tasks.cc) b.sc_tasks.cc.failed = 1 }, 60000)
|
||||
b.ccq = []
|
||||
b.blocknoX = 0
|
||||
b.blocknoZ = 0
|
||||
b.ccStarted = 0
|
||||
b.blocknoY = 0
|
||||
b.pos = { x: 0, y: 0, z: 0, correct: 0 }
|
||||
|
||||
b.advanceccq = function () {
|
||||
if (b.ccq[0] && b.ccq[0].length !== 0) {
|
||||
b._client.write('update_command_block', {
|
||||
command: b.ccq[0],
|
||||
location: {
|
||||
x: b.commandPos.x1 + b.blocknoX,
|
||||
y: b.commandPos.y1 + b.blocknoY,
|
||||
z: b.commandPos.z1 + b.blocknoZ
|
||||
},
|
||||
mode: 2,
|
||||
flags: 1
|
||||
})
|
||||
b._client.write('update_command_block', {
|
||||
command: b.ccq[0],
|
||||
location: {
|
||||
x: b.commandPos.x1 + b.blocknoX,
|
||||
y: b.commandPos.y1 + b.blocknoY,
|
||||
z: b.commandPos.z1 + b.blocknoZ
|
||||
},
|
||||
mode: 2,
|
||||
flags: 5
|
||||
})
|
||||
b.blocknoX++
|
||||
if (b.blocknoX === module.exports.cs) {
|
||||
b.blocknoY++
|
||||
b.blocknoX = 0
|
||||
if (b.blocknoY === module.exports.cs_v) {
|
||||
b.blocknoZ++
|
||||
b.blocknoY = 0
|
||||
if (b.blocknoZ === module.exports.cs) {
|
||||
b.blocknoZ = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
b.ccq.splice(0, 1)
|
||||
}
|
||||
b._client.on('login', () => {
|
||||
b.add_sc_task('cc', '/fill ~ 55 ~ ~3 60 ~3 command_block{CustomName:\'{"translate":"%s %s","with":[{"translate":"entity.minecraft.ender_dragon"},{"translate":"language.region"}],"color":"#FFAAEE"}\'}', true, true)
|
||||
b.add_sc_task('cc_size', '/gamerule commandModificationBlockLimit 32767', true, false, true)
|
||||
})
|
||||
b.on('ccstart', () => {
|
||||
setTimeout(() => { b.interval.ccqi = setInterval(b.advanceccq, 3) }, 1000) // 1 Second and 3 Milliseconds
|
||||
b.ccStarted = true
|
||||
})
|
||||
b.on('chat', (data) => {
|
||||
if (data.json.translate === 'commands.fill.failed' || (data.json.extra && data.json.extra[0] && data.json.extra[0].translate === 'commands.fill.failed') ||
|
||||
data.json.translate === 'commands.fill.success' || (data.json.extra && data.json.extra[0] && data.json.extra[0].translate === 'commands.fill.success')) {
|
||||
if (!b.ccStarted) {
|
||||
b.emit('ccstart')
|
||||
}
|
||||
b.sc_tasks.cc.failed = 0
|
||||
b.sc_tasks.cc_size.failed = 0
|
||||
} else if (data.json.translate === 'commands.fill.toobig' || (data.json.extra && data.json.extra[0] && data.json.extra[0].translate === 'commands.fill.toobig')) {
|
||||
b.sc_tasks.cc_size.failed = 1
|
||||
}
|
||||
})
|
||||
b._client.on('position', function (a) {
|
||||
if (!b.ccStarted) {
|
||||
b.original_pos = { x: a.x, y: a.y, z: a.z }
|
||||
b.pos = { x: a.x, y: a.y, z: a.z, correct: 1 }
|
||||
} else {
|
||||
b.pos = { x: a.x, y: a.y, z: a.z, correct: 1 }
|
||||
if (a.x !== b.original_pos.x || a.z !== b.original_pos.z) {
|
||||
b.original_pos = { x: a.x, y: a.y, z: a.z }
|
||||
b.pos.correct = 0
|
||||
b.sc_tasks.cc.failed = 1
|
||||
}
|
||||
}
|
||||
|
||||
b.commandPos = {
|
||||
x1: Math.floor(a.x),
|
||||
z1: Math.floor(a.z),
|
||||
y1: 55
|
||||
}
|
||||
b._client.write('teleport_confirm', { teleportId: a.teleportId })
|
||||
})
|
||||
b.tellraw = (uuid, message) => {
|
||||
let finalname = ''
|
||||
if (uuid === '@a') {
|
||||
finalname = '@a'
|
||||
} else if (uuid.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/)) {
|
||||
finalname = `@a[nbt={UUID:[I;${uuidToInt(uuid)}]}]`
|
||||
} else {
|
||||
finalname = uuid
|
||||
}
|
||||
b.ccq.push(`/minecraft:tellraw ${finalname} ${JSON.stringify(message)}`)
|
||||
}
|
||||
}
|
||||
}
|
79
plugins/commands/about.js
Normal file
79
plugins/commands/about.js
Normal file
|
@ -0,0 +1,79 @@
|
|||
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: '' })
|
||||
const 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']
|
||||
}
|
7
plugins/commands/cb.js
Normal file
7
plugins/commands/cb.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
module.exports = {
|
||||
execute: (c) => {
|
||||
c.bot.ccq.push(c.args.join(' '))
|
||||
},
|
||||
consoleIndex: true,
|
||||
aliases: ['commandblock', 'cmdblock']
|
||||
}
|
90
plugins/commands/cloop.js
Normal file
90
plugins/commands/cloop.js
Normal file
|
@ -0,0 +1,90 @@
|
|||
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({
|
||||
translate: getMessage(c.lang, 'command.cloop.error.subcommand'),
|
||||
color: c.colors.secondary,
|
||||
with: [
|
||||
{
|
||||
text: `${c.prefix}help cloop`,
|
||||
color: c.colors.primary
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
},
|
||||
consoleIndex: true,
|
||||
level: 1
|
||||
}
|
11
plugins/commands/eval.js
Normal file
11
plugins/commands/eval.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
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
|
||||
}
|
12
plugins/commands/help.js
Normal file
12
plugins/commands/help.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
module.exports = {
|
||||
execute: (c) => {
|
||||
if (c.args.length > 0) {
|
||||
c.bot.printCmdHelp(c.uuid, c.args[0], c.lang, c.colors)
|
||||
} else {
|
||||
c.bot.printHelp(c.uuid, c.prefix, c.lang, c.colors)
|
||||
}
|
||||
},
|
||||
aliases: [
|
||||
'heko' // Parker2991 request
|
||||
]
|
||||
}
|
7
plugins/commands/logoff.js
Normal file
7
plugins/commands/logoff.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
module.exports = {
|
||||
execute: (c) => {
|
||||
c.bot._client.end()
|
||||
},
|
||||
consoleIndex: true,
|
||||
level: 2
|
||||
}
|
35
plugins/commands/netmsg.js
Normal file
35
plugins/commands/netmsg.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
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)
|
||||
}
|
||||
}
|
||||
}
|
7
plugins/commands/refill.js
Normal file
7
plugins/commands/refill.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
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']
|
||||
}
|
8
plugins/commands/say.js
Normal file
8
plugins/commands/say.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
module.exports = {
|
||||
execute: (c) => {
|
||||
if (c.args[0].startsWith('/') && c.verify < 1) return
|
||||
c.bot.chat(c.args.join(' '))
|
||||
},
|
||||
consoleIndex: true,
|
||||
aliases: ['echo']
|
||||
}
|
96
plugins/commands/serverinfo.js
Executable file
96
plugins/commands/serverinfo.js
Executable file
|
@ -0,0 +1,96 @@
|
|||
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()
|
||||
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'), 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')
|
||||
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'), 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))
|
||||
}
|
||||
}
|
7
plugins/commands/stop.js
Normal file
7
plugins/commands/stop.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
module.exports = {
|
||||
execute: (c) => {
|
||||
process.exit(0)
|
||||
},
|
||||
aliases: ['restart', 'exit'],
|
||||
level: 2
|
||||
}
|
42
plugins/commands/template.js
Normal file
42
plugins/commands/template.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
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)
|
||||
}
|
11
plugins/commands/verify.js
Normal file
11
plugins/commands/verify.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
module.exports = {
|
||||
execute: (c) => {
|
||||
c.reply({
|
||||
text: c.verify + ''
|
||||
})
|
||||
c.reply({
|
||||
text: c.command
|
||||
})
|
||||
},
|
||||
level: 1
|
||||
}
|
53
plugins/console.js
Normal file
53
plugins/console.js
Normal file
|
@ -0,0 +1,53 @@
|
|||
const readln = require('readline')
|
||||
const index = require('../index.js')
|
||||
const ConsoleCommand = require('../util/ConsoleCommand.js')
|
||||
const newercommands = require('./command.js').cmds
|
||||
let rl
|
||||
function consoleWrite (text) {
|
||||
readln.cursorTo(process.stdout, 0)
|
||||
readln.clearLine(process.stdout, 0)
|
||||
process.stdout.write(text + '\n')
|
||||
rl.prompt(true)
|
||||
}
|
||||
module.exports = {
|
||||
load: () => {
|
||||
rl = readln.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
prompt: '\x1b[0m\x1b[38;5;15m> '
|
||||
})
|
||||
rl.on('line', (l) => {
|
||||
try {
|
||||
if (newercommands[l.split(' ')[0].toLowerCase()]) {
|
||||
if (newercommands[l.split(' ')[0].toLowerCase()].consoleIndex) {
|
||||
const tmpcmd = l.split(' ')
|
||||
const index2 = tmpcmd.splice(1, 1)[0]
|
||||
if (index2 === '*') {
|
||||
for (let i = 0; i < index.bot.length; i++) {
|
||||
const cmd = new ConsoleCommand(tmpcmd.join(' '), i)
|
||||
newercommands[l.split(' ')[0].toLowerCase()].execute(cmd)
|
||||
}
|
||||
} else {
|
||||
const cmd = new ConsoleCommand(tmpcmd.join(' '), +index2)
|
||||
newercommands[l.split(' ')[0].toLowerCase()].execute(cmd)
|
||||
}
|
||||
} else {
|
||||
const cmd = new ConsoleCommand(l, -2)
|
||||
newercommands[l.split(' ')[0].toLowerCase()].execute(cmd)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
rl.prompt(false)
|
||||
})
|
||||
rl.prompt()
|
||||
},
|
||||
loadBot: (b) => {
|
||||
b.info = (msg) => {
|
||||
consoleWrite(`[${b.id}] [info] ${msg}`)
|
||||
}
|
||||
},
|
||||
rl,
|
||||
write: consoleWrite
|
||||
}
|
22
plugins/cq.js
Executable file
22
plugins/cq.js
Executable file
|
@ -0,0 +1,22 @@
|
|||
module.exports = {
|
||||
load: () => {
|
||||
|
||||
},
|
||||
loadBot: (b) => {
|
||||
b._client.on('login', () => {
|
||||
b.interval.chatQueue = setInterval(() => {
|
||||
if (b.chatqueue.length !== 0) {
|
||||
b._client.chat(b.chatqueue[0])
|
||||
b.chatqueue.splice(0, 1)
|
||||
}
|
||||
}, 150)
|
||||
})
|
||||
b.chatqueue = []
|
||||
b.chat = function chat (msg) {
|
||||
if (msg.length === 0) return
|
||||
msg.match(/.{1,250}/g).forEach(element => {
|
||||
b.chatqueue.push(element)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
48
plugins/player.js
Normal file
48
plugins/player.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
const parse = require('../util/chatparse.js')
|
||||
const parse1204 = require('../util/chatparse_1204.js')
|
||||
module.exports = {
|
||||
load: () => {
|
||||
},
|
||||
loadBot: (b) => {
|
||||
b.players = {}
|
||||
b._client.on('player_info', (data) => {
|
||||
const buffer2 = {}
|
||||
for (const i in 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 (data.data[i].player && data.data[i].player.name !== undefined) {
|
||||
buffer2[uuid] = { realName: data.data[i].player.name, displayName: parse(parse1204(data.data[i].displayName))[1] }
|
||||
} else if (data.data[i].name !== undefined) {
|
||||
buffer2[uuid] = { realName: data.data[i].name, displayName: parse(parse1204(data.data[i].displayName))[1] }
|
||||
} else if (data.data[i].displayName !== undefined) {
|
||||
buffer2[uuid] = { displayName: parse(parse1204(data.data[i].displayName))[1] }
|
||||
}
|
||||
}
|
||||
for (const uuid in buffer2) {
|
||||
if (!b.players[uuid]) b.players[uuid] = { displayName: '', realName: '' }
|
||||
if (buffer2[uuid].displayName) b.players[uuid].displayName = buffer2[uuid].displayName
|
||||
if (buffer2[uuid].realName) b.players[uuid].realName = buffer2[uuid].realName
|
||||
}
|
||||
})
|
||||
b.findUUID = (name) => {
|
||||
for (const i in b.players) {
|
||||
if (b.players[i].realName === name) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return '00000000-0000-0000-0000-000000000000'
|
||||
}
|
||||
b.findRealName = (name) => {
|
||||
for (const i in b.players) {
|
||||
if (b.players[i].displayName === name) {
|
||||
return b.players[i].realName
|
||||
}
|
||||
}
|
||||
return 'Geometrical Dominator'
|
||||
}
|
||||
}
|
||||
}
|
17
plugins/rejoin.js
Executable file
17
plugins/rejoin.js
Executable file
|
@ -0,0 +1,17 @@
|
|||
const index = require('../index.js')
|
||||
module.exports = {
|
||||
load: () => {
|
||||
},
|
||||
loadBot: (b) => {
|
||||
b._client.on('end', () => {
|
||||
b.info('bot ' + b.id + ' disconnected')
|
||||
for (const i in b.interval) {
|
||||
clearInterval(b.interval[i])
|
||||
}
|
||||
setTimeout(() => {
|
||||
b.info('Re-connecting bot ' + b.id)
|
||||
index.createBot(b.host, b.id)
|
||||
}, 5000)
|
||||
})
|
||||
}
|
||||
}
|
34
plugins/sc.js
Executable file
34
plugins/sc.js
Executable file
|
@ -0,0 +1,34 @@
|
|||
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)
|
||||
}
|
||||
}
|
||||
}
|
15
plugins/sc_cspy.js
Executable file
15
plugins/sc_cspy.js
Executable file
|
@ -0,0 +1,15 @@
|
|||
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
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
15
plugins/sc_gamemode.js
Executable file
15
plugins/sc_gamemode.js
Executable file
|
@ -0,0 +1,15 @@
|
|||
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
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
18
plugins/sc_op.js
Executable file
18
plugins/sc_op.js
Executable file
|
@ -0,0 +1,18 @@
|
|||
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
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
8
plugins/testing.js
Executable file
8
plugins/testing.js
Executable file
|
@ -0,0 +1,8 @@
|
|||
module.exports = {
|
||||
load: () => {
|
||||
|
||||
},
|
||||
loadBot: (b) => {
|
||||
|
||||
}
|
||||
}
|
23
settings2.json
Executable file
23
settings2.json
Executable file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"secret":"./settings_s.json",
|
||||
"name": "Minecraft Bot",
|
||||
"version_mc": "1.20.4",
|
||||
"defaultLang": "en-US",
|
||||
"colors": {
|
||||
"primary": "#FFCCEE",
|
||||
"secondary": "#FF99DD"
|
||||
},
|
||||
"prefix":[
|
||||
"bot:",
|
||||
"\""
|
||||
],
|
||||
"servers":[
|
||||
{
|
||||
"host": "kaboom.pw",
|
||||
"port": 25565,
|
||||
"options":{
|
||||
"name": "kaboom"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
24
util/Command.js
Normal file
24
util/Command.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
// HOW TO WRITE CLASS JS
|
||||
const settings = require('../settings.json')
|
||||
class Command {
|
||||
constructor (uuid, user, nick, cmd, prefix, bot, verify, lang = settings.defaultLang) {
|
||||
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.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.colors = settings.colors
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Command
|
60
util/ConsoleCommand.js
Normal file
60
util/ConsoleCommand.js
Normal file
|
@ -0,0 +1,60 @@
|
|||
// HOW TO WRITE CLASS JS
|
||||
const index = require('../index.js')
|
||||
const { cmds } = require('../plugins/command.js')
|
||||
const parse = require('../util/chatparse.js')
|
||||
const settings = require('../settings.json')
|
||||
const getMessage = require('../util/lang.js')
|
||||
const lang = settings.defaultLang
|
||||
class ConsoleCommand {
|
||||
constructor (cmd, index2) {
|
||||
this.send = () => {} // not needed for console
|
||||
this.reply = text => process.stdout.write(parse(text)[0] + '\n')
|
||||
this.uuid = 'dde5a2a6-ebdd-4bbb-8eac-f75b10c10446_console' // hard-coded because uuid does not exist at console
|
||||
this.username = 'Owner'
|
||||
this.nickname = 'Console'
|
||||
this.command = cmd
|
||||
this.prefix = '' // prefix does not exist at console
|
||||
this.bot = index2 >= 0
|
||||
? index.bot[index2]
|
||||
: {
|
||||
printHelp: () => {
|
||||
const helpCmds = []
|
||||
for (const i in cmds) {
|
||||
// if(cmds[i].hidden) continue;
|
||||
helpCmds.push(i)
|
||||
}
|
||||
console.log(getMessage(lang, 'command.help.cmdList', [helpCmds.join(' ')]))
|
||||
},
|
||||
printCmdHelp: (uuid, cmd) => {
|
||||
let usage = getMessage(lang, `command.${cmd}.usage`).split('||')
|
||||
let desc = getMessage(lang, `command.${cmd}.desc`)
|
||||
if (cmds[cmd].usage) {
|
||||
usage = cmds[cmd].usage.split('||')
|
||||
}
|
||||
if (cmds[cmd].desc) {
|
||||
desc = cmds[cmd].desc
|
||||
}
|
||||
for (const i in usage) {
|
||||
console.log(getMessage(lang, 'command.help.commandUsage', [cmd, usage[i]]))
|
||||
}
|
||||
console.log(getMessage(lang, 'command.help.commandDesc', [desc]))
|
||||
const permsN = getMessage(lang, 'command.help.permsNormal')
|
||||
const permsT = getMessage(lang, 'command.help.permsTrusted')
|
||||
const permsO = getMessage(lang, 'command.help.permsOwner')
|
||||
const permsC = getMessage(lang, 'command.help.permsConsole')
|
||||
const rPerms = cmds[cmd].level ? cmds[cmd].level : 0
|
||||
console.log(getMessage(lang, 'command.help.commandPerms', [[permsN, permsT, permsO, permsC][rPerms]]))
|
||||
}
|
||||
} // bot does not exist at console
|
||||
this.type = 'console'
|
||||
this.index = index2
|
||||
this.args = cmd.split(' ').slice(1)
|
||||
this.verify = 3
|
||||
this.host = ''
|
||||
this.port = '3' // :3
|
||||
this.lang = settings.defaultLang
|
||||
this.colors = settings.colors
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ConsoleCommand
|
133
util/chatparse.js
Normal file
133
util/chatparse.js
Normal file
|
@ -0,0 +1,133 @@
|
|||
const _lang = require('minecraft-data')('1.20.2').language
|
||||
const 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) => {
|
||||
const 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.replaceAll('\x1b', '').replaceAll('\x0e', '') // Remove escape codes and [SO] from console format
|
||||
out[1] += _text
|
||||
out[2] += _text
|
||||
}
|
||||
if (data.translate) {
|
||||
let trans = data.translate.replace(/%%/g, '\ue123').replaceAll('\x1b', '').replaceAll('\x0e', '') // 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) {
|
||||
const 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
|
11
util/chatparse_1204.js
Normal file
11
util/chatparse_1204.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
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
|
19
util/hashcheck.js
Normal file
19
util/hashcheck.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
const crypto = require('crypto')
|
||||
const settings = require('../settings.json')
|
||||
const secret = require(settings.secret)
|
||||
module.exports = function (cmd) {
|
||||
const cmdWithoutHash = cmd.slice(0, cmd.length - 1).join(' ')
|
||||
const _dateString = Date.now().toString()
|
||||
const dateString = _dateString.slice(0, _dateString.length - 4)
|
||||
const hashTrusted = 'babyboom:' + secret.keyTrusted + ':' + cmdWithoutHash + ':' + dateString
|
||||
const hashOwner = 'babyboom:' + secret.keyOwner + ':' + cmdWithoutHash + ':' + dateString
|
||||
const validhashT = crypto.createHash('sha256').update(hashTrusted).digest('hex')
|
||||
const validhashO = crypto.createHash('sha256').update(hashOwner).digest('hex')
|
||||
if (cmd[cmd.length - 1] === validhashT) {
|
||||
return 1
|
||||
}
|
||||
if (cmd[cmd.length - 1] === validhashO) {
|
||||
return 2
|
||||
}
|
||||
return 0
|
||||
}
|
27
util/lang.js
Normal file
27
util/lang.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
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')) {
|
||||
continue
|
||||
}
|
||||
try {
|
||||
languages[bpl[i].split('.')[0]] = require(`./lang/${bpl[i]}`)
|
||||
} catch (e) { console.log(e) }
|
||||
}
|
||||
}
|
||||
loadplug()
|
||||
module.exports = function (l, msg, with2) {
|
||||
let message = msg.replace(/%%/g, '\ue123')
|
||||
if (languages[l][message] !== undefined) {
|
||||
message = languages[l][message].replace(/%%/g, '\ue123')
|
||||
} else if (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'))
|
||||
}
|
||||
return message.replace(/\ue123/g, '%').replace(/\ue124/g, '%s').replace(/\ue125/g, '$s')
|
||||
}
|
72
util/lang/en-US.json
Normal file
72
util/lang/en-US.json
Normal file
|
@ -0,0 +1,72 @@
|
|||
{
|
||||
"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.serverinfo.usage": "",
|
||||
"command.serverinfo.desc": "Get system/bot info",
|
||||
"command.stop.usage": "",
|
||||
"command.stop.desc": "Restart bot",
|
||||
"command.template.usage": " <required> [optional]",
|
||||
"command.template.desc": "Does nothing",
|
||||
"command.verify.usage": " [args...]",
|
||||
"command.verify.desc": "Check the hashing system",
|
||||
"command.about.author": "%s - a Minecraft bot made by 77c8f4699b732c11 / a5a06d596f15c7db",
|
||||
"command.about.version": "Version %s",
|
||||
"command.about.serverinfo": "To view system information, run the command %s.",
|
||||
"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.serverinfo.os.android": "Android",
|
||||
"command.serverinfo.os.freebsd": "FreeBSD",
|
||||
"command.serverinfo.os.linux": "Linux",
|
||||
"command.serverinfo.os.macos": "macOS",
|
||||
"command.serverinfo.os.macos_old": "OS X",
|
||||
"command.serverinfo.os": "Operating system",
|
||||
"command.serverinfo.processor": "CPU",
|
||||
"command.serverinfo.arch": "Architecture",
|
||||
"command.serverinfo.osUsername": "Username",
|
||||
"command.serverinfo.hostName": "Hostname",
|
||||
"command.serverinfo.workingDir": "Working directory",
|
||||
"command.serverinfo.runTime": "Bot uptime",
|
||||
"command.serverinfo.upTime": "System uptime",
|
||||
"command.serverinfo.nodeVersion": "Node.js version",
|
||||
"command.serverinfo.osRelease": "Linux release",
|
||||
"command.serverinfo.osRelease.missing": "/etc/os-release does not exist. Information may be limited.",
|
||||
"command.serverinfo.os.android.version": "Android version",
|
||||
"command.serverinfo.os.android.model": "Device model",
|
||||
"command.serverinfo.botName": "Bot name",
|
||||
"command.serverinfo.botVer": "Bot version",
|
||||
"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!"
|
||||
}
|
72
util/lang/he-IL.json
Normal file
72
util/lang/he-IL.json
Normal file
|
@ -0,0 +1,72 @@
|
|||
{
|
||||
"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",
|
||||
"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.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 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!"
|
||||
}
|
17
util/textformat.js
Normal file
17
util/textformat.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
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,
|
||||
color: 'white'
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
24
util/timeformat.js
Executable file
24
util/timeformat.js
Executable file
|
@ -0,0 +1,24 @@
|
|||
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
|
||||
}
|
22
util/usergen.js
Normal file
22
util/usergen.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
const rsg = function (count) {
|
||||
let output = ''
|
||||
for (let i = 0; i < count; i++) {
|
||||
let rng = Math.floor(Math.random() * 16) + 1
|
||||
if (rng === 7) rng = 17 // No bells
|
||||
if (rng === 10) rng = 18 // No line feeds
|
||||
if (rng === 11) rng = 19 // No vertical tabulations
|
||||
if (rng === 12) rng = 20 // No form feed
|
||||
if (rng === 13) rng = 21 // No carriage returns
|
||||
if (rng === 14) rng = 22 // No shift out
|
||||
if (rng === 15) rng = 23 // No shift in
|
||||
output += String.fromCharCode(rng)
|
||||
}
|
||||
return output
|
||||
}
|
||||
module.exports = function (legal) {
|
||||
if (legal) {
|
||||
return Math.floor(Math.random() * 1000000).toString()
|
||||
} else {
|
||||
return ' \xa7' + rsg(6) + ' ' + rsg(4)
|
||||
}
|
||||
}
|
5
util/uuidtoint.js
Normal file
5
util/uuidtoint.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
module.exports = function (uuid) {
|
||||
const splitUUID = uuid.replace(/[^0-9a-f]/g, '').replace(/.{1,8}/g, a => { return '0x' + a }).match(/.{1,10}/g)
|
||||
const numUUID = [+splitUUID[0] << 0, +splitUUID[1] << 0, +splitUUID[2] << 0, +splitUUID[3] << 0]
|
||||
return numUUID
|
||||
}
|
3
version.json
Normal file
3
version.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"bot": "10.0.0-beta.1"
|
||||
}
|
Loading…
Reference in a new issue