Compare commits

...
4 Commits
42 changed files with 1044 additions and 1089 deletions
+1 -5
View File
@@ -1,8 +1,4 @@
node_modules
config.yml
config.js
.git
src/modules/exploits.js
logs
src/modules/custom_chat.js
src/util/core_util.js
src/data/info.json
+15 -1
View File
@@ -1,3 +1,17 @@
# FNFBoyfriendBot
some things were git ignored from the repo that are needed for some things to work so you gotta recreate them
some things were git ignored from the repo that are needed for some things to work so you gotta recreate them
FNFBoyfriendBot is a minecraft java bot made for the server kaboom.pw
# Setup:
1. make sure to have nodejs npm and git installed
2. run npm i
3. fix some modules and stuff
4. edit the config
5. node src
+391 -15
View File
@@ -5,6 +5,8 @@
"packages": {
"": {
"dependencies": {
"@tonejs/midi": "^2.0.28",
"axios": "^1.8.2",
"discord.js": "^14.17.3",
"js-yaml": "^4.1.0",
"matrix-js-sdk": "^36.2.0",
@@ -12,6 +14,7 @@
"minecraft-protocol": "^1.54.0",
"prismarine-chat": "^1.10.1",
"prismarine-registry": "^1.11.0",
"request": "^2.88.2",
"undici": "^7.3.0",
"wikipedia": "^2.1.2"
}
@@ -235,6 +238,16 @@
"npm": ">=7.0.0"
}
},
"node_modules/@tonejs/midi": {
"version": "2.0.28",
"resolved": "https://registry.npmjs.org/@tonejs/midi/-/midi-2.0.28.tgz",
"integrity": "sha512-RII6YpInPsOZ5t3Si/20QKpNqB1lZ2OCFJSOzJxz38YdY/3zqDr3uaml4JuCWkdixuPqP1/TBnXzhQ39csyoVg==",
"license": "MIT",
"dependencies": {
"array-flatten": "^3.0.0",
"midi-file": "^1.2.2"
}
},
"node_modules/@types/events": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.3.tgz",
@@ -310,6 +323,15 @@
"axios": "^0.21.1"
}
},
"node_modules/@xboxreplay/xboxlive-auth/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/abort-controller": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
@@ -356,25 +378,57 @@
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"license": "Python-2.0"
},
"node_modules/array-flatten": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-3.0.0.tgz",
"integrity": "sha512-zPMVc3ZYlGLNk4mpK1NzP2wg0ml9t7fUgDsayR5Y5rSzxQilzR9FGu/EH2jQOcKSAeAfWeylyW8juy3OkWRvNA==",
"license": "MIT"
},
"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/assert-plus": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
"integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==",
"license": "MIT",
"engines": {
"node": ">=0.8"
}
},
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
"license": "MIT"
},
"node_modules/aws-sign2": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
"integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==",
"license": "Apache-2.0",
"engines": {
"node": "*"
}
},
"node_modules/aws4": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.13.2.tgz",
"integrity": "sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw==",
"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==",
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.8.2.tgz",
"integrity": "sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg==",
"license": "MIT",
"dependencies": {
"follow-redirects": "^1.14.0"
"follow-redirects": "^1.15.6",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
},
"node_modules/base-x": {
@@ -403,6 +457,15 @@
],
"license": "MIT"
},
"node_modules/bcrypt-pbkdf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
"integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==",
"license": "BSD-3-Clause",
"dependencies": {
"tweetnacl": "^0.14.3"
}
},
"node_modules/bs58": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/bs58/-/bs58-6.0.0.tgz",
@@ -463,6 +526,12 @@
"node": ">=4"
}
},
"node_modules/caseless": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
"integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==",
"license": "Apache-2.0"
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
@@ -490,6 +559,24 @@
"node": ">= 0.6"
}
},
"node_modules/core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==",
"license": "MIT"
},
"node_modules/dashdash": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
"integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==",
"license": "MIT",
"dependencies": {
"assert-plus": "^1.0.0"
},
"engines": {
"node": ">=0.10"
}
},
"node_modules/debug": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
@@ -563,6 +650,16 @@
"node": ">=18.17"
}
},
"node_modules/ecc-jsbn": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
"integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==",
"license": "MIT",
"dependencies": {
"jsbn": "~0.1.0",
"safer-buffer": "^2.1.0"
}
},
"node_modules/ecdsa-sig-formatter": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
@@ -596,6 +693,21 @@
"node": ">=0.8.x"
}
},
"node_modules/extend": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
"license": "MIT"
},
"node_modules/extsprintf": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
"integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==",
"engines": [
"node >=0.6.0"
],
"license": "MIT"
},
"node_modules/fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
@@ -628,6 +740,15 @@
}
}
},
"node_modules/forever-agent": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
"integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==",
"license": "Apache-2.0",
"engines": {
"node": "*"
}
},
"node_modules/form-data": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz",
@@ -642,6 +763,53 @@
"node": ">= 6"
}
},
"node_modules/getpass": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
"integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==",
"license": "MIT",
"dependencies": {
"assert-plus": "^1.0.0"
}
},
"node_modules/har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
"integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==",
"license": "ISC",
"engines": {
"node": ">=4"
}
},
"node_modules/har-validator": {
"version": "5.1.5",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz",
"integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==",
"deprecated": "this library is no longer supported",
"license": "MIT",
"dependencies": {
"ajv": "^6.12.3",
"har-schema": "^2.0.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/http-signature": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
"integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==",
"license": "MIT",
"dependencies": {
"assert-plus": "^1.0.0",
"jsprim": "^1.2.2",
"sshpk": "^1.7.0"
},
"engines": {
"node": ">=0.8",
"npm": ">=1.3.7"
}
},
"node_modules/ieee754": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
@@ -675,6 +843,18 @@
"url": "https://www.buymeacoffee.com/2tmRKi9"
}
},
"node_modules/is-typedarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
"integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==",
"license": "MIT"
},
"node_modules/isstream": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==",
"license": "MIT"
},
"node_modules/js-yaml": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
@@ -687,12 +867,30 @@
"js-yaml": "bin/js-yaml.js"
}
},
"node_modules/jsbn": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
"integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==",
"license": "MIT"
},
"node_modules/json-schema": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz",
"integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==",
"license": "(AFL-2.1 OR BSD-3-Clause)"
},
"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/json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
"integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",
"license": "ISC"
},
"node_modules/jsonwebtoken": {
"version": "9.0.2",
"resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz",
@@ -715,6 +913,21 @@
"npm": ">=6"
}
},
"node_modules/jsprim": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz",
"integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==",
"license": "MIT",
"dependencies": {
"assert-plus": "1.0.0",
"extsprintf": "1.3.0",
"json-schema": "0.4.0",
"verror": "1.10.0"
},
"engines": {
"node": ">=0.6.0"
}
},
"node_modules/jwa": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz",
@@ -898,6 +1111,12 @@
"events": "^3.2.0"
}
},
"node_modules/midi-file": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/midi-file/-/midi-file-1.2.4.tgz",
"integrity": "sha512-B5SnBC6i2bwJIXTY9MElIydJwAmnKx+r5eJ1jknTLetzLflEl0GWveuBB6ACrQpecSRkOB6fhTx1PwXk2BVxnA==",
"license": "MIT"
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
@@ -1034,6 +1253,15 @@
"asn1": "0.2.3"
}
},
"node_modules/oauth-sign": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
"integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==",
"license": "Apache-2.0",
"engines": {
"node": "*"
}
},
"node_modules/oidc-client-ts": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/oidc-client-ts/-/oidc-client-ts-3.1.0.tgz",
@@ -1059,6 +1287,12 @@
"node": ">=8"
}
},
"node_modules/performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
"integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==",
"license": "MIT"
},
"node_modules/prismarine-auth": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/prismarine-auth/-/prismarine-auth-2.6.0.tgz",
@@ -1189,6 +1423,18 @@
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
"license": "MIT"
},
"node_modules/psl": {
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.15.0.tgz",
"integrity": "sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==",
"license": "MIT",
"dependencies": {
"punycode": "^2.3.1"
},
"funding": {
"url": "https://github.com/sponsors/lupomontero"
}
},
"node_modules/punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
@@ -1198,6 +1444,15 @@
"node": ">=6"
}
},
"node_modules/qs": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz",
"integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==",
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.6"
}
},
"node_modules/railroad-diagrams": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz",
@@ -1239,6 +1494,62 @@
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==",
"license": "MIT"
},
"node_modules/request": {
"version": "2.88.2",
"resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
"integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==",
"deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142",
"license": "Apache-2.0",
"dependencies": {
"aws-sign2": "~0.7.0",
"aws4": "^1.8.0",
"caseless": "~0.12.0",
"combined-stream": "~1.0.6",
"extend": "~3.0.2",
"forever-agent": "~0.6.1",
"form-data": "~2.3.2",
"har-validator": "~5.1.3",
"http-signature": "~1.2.0",
"is-typedarray": "~1.0.0",
"isstream": "~0.1.2",
"json-stringify-safe": "~5.0.1",
"mime-types": "~2.1.19",
"oauth-sign": "~0.9.0",
"performance-now": "^2.1.0",
"qs": "~6.5.2",
"safe-buffer": "^5.1.2",
"tough-cookie": "~2.5.0",
"tunnel-agent": "^0.6.0",
"uuid": "^3.3.2"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/request/node_modules/form-data": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
"integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
"license": "MIT",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.6",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 0.12"
}
},
"node_modules/request/node_modules/uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
"license": "MIT",
"bin": {
"uuid": "bin/uuid"
}
},
"node_modules/ret": {
"version": "0.1.15",
"resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz",
@@ -1263,6 +1574,12 @@
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"license": "MIT"
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"license": "MIT"
},
"node_modules/sdp-transform": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/sdp-transform/-/sdp-transform-2.15.0.tgz",
@@ -1294,6 +1611,31 @@
"npm": ">= 3.0.0"
}
},
"node_modules/sshpk": {
"version": "1.18.0",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz",
"integrity": "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==",
"license": "MIT",
"dependencies": {
"asn1": "~0.2.3",
"assert-plus": "^1.0.0",
"bcrypt-pbkdf": "^1.0.0",
"dashdash": "^1.12.0",
"ecc-jsbn": "~0.1.1",
"getpass": "^0.1.1",
"jsbn": "~0.1.0",
"safer-buffer": "^2.0.2",
"tweetnacl": "~0.14.0"
},
"bin": {
"sshpk-conv": "bin/sshpk-conv",
"sshpk-sign": "bin/sshpk-sign",
"sshpk-verify": "bin/sshpk-verify"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/string_decoder": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
@@ -1323,6 +1665,19 @@
],
"license": "MIT"
},
"node_modules/tough-cookie": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
"integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
"license": "BSD-3-Clause",
"dependencies": {
"psl": "^1.1.28",
"punycode": "^2.1.1"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
@@ -1341,6 +1696,24 @@
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"license": "0BSD"
},
"node_modules/tunnel-agent": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
"integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
"license": "Apache-2.0",
"dependencies": {
"safe-buffer": "^5.0.1"
},
"engines": {
"node": "*"
}
},
"node_modules/tweetnacl": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
"integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==",
"license": "Unlicense"
},
"node_modules/undici": {
"version": "7.3.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-7.3.0.tgz",
@@ -1389,6 +1762,20 @@
"macaddress": "^0.5.1"
}
},
"node_modules/verror": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
"integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==",
"engines": [
"node >=0.6.0"
],
"license": "MIT",
"dependencies": {
"assert-plus": "^1.0.0",
"core-util-is": "1.0.2",
"extsprintf": "^1.2.0"
}
},
"node_modules/webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
@@ -1418,17 +1805,6 @@
"node": ">=10"
}
},
"node_modules/wikipedia/node_modules/axios": {
"version": "1.7.9",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz",
"integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==",
"license": "MIT",
"dependencies": {
"follow-redirects": "^1.15.6",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
},
"node_modules/ws": {
"version": "8.18.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz",
+3
View File
@@ -1,5 +1,7 @@
{
"dependencies": {
"@tonejs/midi": "^2.0.28",
"axios": "^1.8.2",
"discord.js": "^14.17.3",
"js-yaml": "^4.1.0",
"matrix-js-sdk": "^36.2.0",
@@ -7,6 +9,7 @@
"minecraft-protocol": "^1.54.0",
"prismarine-chat": "^1.10.1",
"prismarine-registry": "^1.11.0",
"request": "^2.88.2",
"undici": "^7.3.0",
"wikipedia": "^2.1.2"
}
+6 -28
View File
@@ -1,10 +1,8 @@
const mc = require('minecraft-protocol');
const { EventEmitter } = require('events');
EventEmitter.defaultMaxListeners = 5e6;
const util = require('util');
const ChatMessage = require('prismarine-chat');
EventEmitter.defaultMaxListeners = 200;
function createBot(options = {}, config) {
let endCount = 0;
const bot = new EventEmitter();
bot.options = {
// Set some default values in options
@@ -26,46 +24,26 @@ function createBot(options = {}, config) {
})
client.on('disconnect', data => {
bot.emit("disconnect", data);
bot.console.warn(`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`)
bot.emit("clientDisconnect", data.reason);
})
client.on('end', reason => {
bot.emit('end', reason);
if (reason === "socketClosed") return;
bot.console.warn(ChatMessage(bot._client.version).fromNotch(`§8[§bClient Reconnect§8]§r ${reason}`)?.toAnsi());
})
client.on('error', error => {
endCount++
if (endCount === 10) {
bot.console.info('stopped logging disconnect messages for now...');
bot?.discord?.channel?.send('stopped logging disconnect messages for now...');
return;
} else if (endCount > 10) {
return;
} else {
bot.console.warn(ChatMessage(bot._client.version).fromNotch('§8[§bClient Reconnect§8]§r ')?.toAnsi() + util.inspect(error.toString()))
bot?.discord?.channel?.send(error.toString());
}
bot.emit('clientDisconnect', error.toString());
})
client.on("keep_alive", ({ keepAliveId }) => {
bot.emit("keep_alive", { keepAliveId })
})
client.on('kick_disconnect', (data) => {
bot.emit("kick_disconnect", data.reason)
bot.console?.warn(`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`)
bot?.discord?.channel?.send(util.inspect(data.reason))
})
client.on('success', (data) => {
endCount = 0;
bot.emit("clientDisconnect", data.reason)
})
process.on("uncaughtException", (e) => {
// console?.warn(e.stack)
});
})
-115
View File
@@ -1,115 +0,0 @@
const CommandError = require('../../util/command_error');
module.exports = {
data: {
name: 'filter',
trustLevel: 2,
aliases: [
"blacklist",
],
description: 'filter players',
usages: [
"add <player>",
"list",
"-ignorecase add <player> / -regex add <player>",
"-regex add <player>",
"clear",
"remove <index>",
],
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
let component = [];
if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4] && !args[5] && !args[6]) return;
switch (args[1]) {
case "add":
bot.filter.add(`${args[2]}`, false, false);
bot.chat.message(`added ${args[2]} to the filter`);
break;
case "list":
if (bot.filter.list().length === 0) {
component.push({
translate: "%s: (%s)",
color: config.colors.commands.tertiary,
with: [
{ text: "Filtered", color: config.colors.commands.primary },
{ text: `${bot.filter.list().length}`, color: config.colors.integer }
]
});
} else {
let index = 0;
let filterList = [];
for (const players of bot.filter.list()) {
filterList.push({
translate: "%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: `${index}`, color: config.colors.integer },
{ text: players.name, color: config.colors.commands.primary }
]
});
filterList.push('\n');
index++;
}
filterList.pop();
component.push({
translate: "%s: (%s)",
color: config.colors.commands.tertiary,
with: [
{ text: "Players", color: config.colors.commands.primary },
{ text: `${bot.filter.list().length}`, color: config.colors.integer }
]
});
component.push('\n');
component.push(filterList);
}
bot.tellraw("@a", component);
break;
case "remove":
bot.filter.remove(args[2]);
bot.chat.message(`removed ${args[2]} from the filter`);
break;
case "-ignorecase":
switch (args[2]) {
case "-regex":
switch (args[3]) {
case "add":
bot.filter.add(`${args[4]}`, true, true);
bot.chat.message(`added ${args[4]} to the filter`);
break;
}
break;
case "add":
bot.filter.add(`${args[3]}`, true, false);
bot.chat.message(`added ${args[3]} to the filter`);
break;
}
break;
case "-regex":
switch (args[2]) {
case "add":
bot.filter.add(`${args[3]}`, false, true);
bot.chat.message(`added ${args[3]} to the filter`);
break;
}
break;
case "clear":
bot.filter.clear();
bot.chat.message('cleared the filter');
break;
default:
throw new CommandError('invalid argument');
}
},
}
+1 -1
View File
@@ -6,7 +6,7 @@ module.exports = {
],
description: "reconnects the bot",
usages: [
""
],
trustLevel: 2,
},
+9 -38
View File
@@ -1,10 +1,12 @@
const CommandError = require('../../util/command_error');
module.exports = {
data: {
name: 'console',
trustLevel: 4,
description: "runs commands made for the bots console",
aliases: [
"c"
],
usages: [
'server/srv <all/servername>',
@@ -38,27 +40,8 @@ module.exports = {
eachBot.console.server = server;
}
break
case 'customchat':
if (args[1] === 'off' || args[1] === 'false' || args[1] === 'disable') {
bot.customChat.enabled = false
bot.console.info('Custom Chat disabled');
} if (args[1] === 'on' || args[1] === 'true' || args[1] === 'enable') {
bot.customChat.enabled = true;
bot.console.info('Custom Chat enabled');
}
break
case 'say':
if (bot.customChat.enabled === false) {
bot.chat.send(args.slice(1).join(' '))
// bot.commandManager.executeString(bot.console.source, `echo ${args.slice(1).join(' ')}`)
} else if (bot.customChat.enabled === true) {
if (args.slice(1).join(' ').startsWith('/')) {
bot.chat.command(`${args.slice(1).join(' ').substring(1)}`)
return;
}
bot.customChat.chat(args.slice(1).join(' '));
}
bot.chat.send(args.slice(1).join(' '));
break
case "validate":
case "validation":
@@ -66,30 +49,18 @@ module.exports = {
switch (args[1]?.toLowerCase()) {
case "owner":
case "o":
if (bot.customChat.enabled === true) {
bot.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
} else if (bot.customChat.enabled === false) {
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
}
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
break
case "admin":
case "a":
if (bot.customChat.enabled === true) {
bot.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
} else if (bot.customChat.enabled === false) {
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
}
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
break
case "trusted":
case "t":
if (bot.customChat.enabled === true) {
bot.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`);
} else if (bot.customChat.enabled === false) {
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`);
}
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`);
break
default:
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" })
}
break
case 'logging':
@@ -121,7 +92,7 @@ module.exports = {
}
break
default:
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" })
}
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
module.exports = {
data: {
name: 'kill',
trustLevel: 3,
trustLevel: 4,
aliases: [
"suicide",
"quit",
+1 -1
View File
@@ -4,7 +4,7 @@ const util = require('util');
module.exports = {
data: {
name: 'servereval',
trustLevel: 3,
trustLevel: 4,
aliases: [
"se"
],
+5 -1
View File
@@ -6,7 +6,11 @@ module.exports = {
"cbrun",
"corerun"
],
trustLevel: 0
trustLevel: 0,
description: "run commands in core",
usages: [
"<message>"
]
},
execute (context) {
const bot = context.bot;
+158 -11
View File
@@ -3,31 +3,161 @@ function commandListComponent (commands, config, public, trusted, admin, owner,
case 0:
public.push({
text: commands.data.name + ' ',
color: config.colors.help.public
color: config.colors.help.public,
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Command Name", color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: "Trust Level", color: config.colors.commands.primary },
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
{ text: "Description", color: config.colors.commands.primary },
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
{ text: "Aliases", color: config.colors.commands.primary },
{ text: `${commands.data.aliases}`, color: config.colors.commands.secondary },
{ text: "Usages", color: config.colors.commands.primary },
{ text: `${commands.data.usages}`, color: config.colors.commands.secondary }
]
}
]
},
clickEvent: {
action: "suggest_command",
value: `${config.prefixes[0]}${commands.data.name}`
}
});
break;
case 1:
trusted.push({
text: commands.data.name + ' ',
color: config.colors.help.trusted
color: config.colors.help.trusted,
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Command Name", color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: "Trust Level", color: config.colors.commands.primary },
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
{ text: "Description", color: config.colors.commands.primary },
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
{ text: "Aliases", color: config.colors.commands.primary },
{ text: `${commands.data.aliases}`, color: config.colors.commands.secondary },
{ text: "Usages", color: config.colors.commands.primary },
{ text: `${commands.data.usages}`, color: config.colors.commands.secondary }
]
}
]
},
clickEvent: {
action: "suggest_command",
value: `${config.prefixes[0]}${commands.data.name}`
}
});
break;
case 2:
admin.push({
text: commands.data.name + ' ',
color: config.colors.help.admin
color: config.colors.help.admin,
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Command Name", color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: "Trust Level", color: config.colors.commands.primary },
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
{ text: "Description", color: config.colors.commands.primary },
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
{ text: "Aliases", color: config.colors.commands.primary },
{ text: `${commands.data.aliases}`, color: config.colors.commands.secondary },
{ text: "Usages", color: config.colors.commands.primary },
{ text: `${commands.data.usages}`, color: config.colors.commands.secondary }
]
}
]
},
clickEvent: {
action: "suggest_command",
value: `${config.prefixes[0]}${commands.data.name}`
}
});
break;
case 3:
owner.push({
text: commands.data.name + ' ',
color: config.colors.help.owner
color: config.colors.help.owner,
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Command Name", color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: "Trust Level", color: config.colors.commands.primary },
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
{ text: "Description", color: config.colors.commands.primary },
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
{ text: "Aliases", color: config.colors.commands.primary },
{ text: `${commands.data.aliases}`, color: config.colors.commands.secondary },
{ text: "Usages", color: config.colors.commands.primary },
{ text: `${commands.data.usages}`, color: config.colors.commands.secondary }
]
}
]
},
clickEvent: {
action: "suggest_command",
value: `${config.prefixes[0]}${commands.data.name}`
}
});
break;
case 4:
Console.push({
text: commands.data.name + ' ',
color: config.colors.help.console
color: config.colors.help.console,
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Command Name", color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: "Trust Level", color: config.colors.commands.primary },
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
{ text: "Description", color: config.colors.commands.primary },
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
{ text: "Aliases", color: config.colors.commands.primary },
{ text: `${commands.data.aliases}`, color: config.colors.commands.secondary },
{ text: "Usages", color: config.colors.commands.primary },
{ text: `${commands.data.usages}`, color: config.colors.commands.secondary }
]
}
]
},
clickEvent: {
action: "suggest_command",
value: `${config.prefixes[0]}${commands.data.name}`
}
});
break;
default:
@@ -37,6 +167,7 @@ function commandListComponent (commands, config, public, trusted, admin, owner,
function infoComponents (commands, config, infoComponent, usagesComponent) {
for (const usages of commands.data.usages) {
usagesComponent.push({
translate: "%s%s %s",
with: [
@@ -89,6 +220,8 @@ module.exports = {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
const source = context.source;
let component = [];
let infoComponent = [];
let usagesComponent = [];
@@ -116,11 +249,26 @@ module.exports = {
}
}
component.push(public);
component.push(trusted);
component.push(admin);
component.push(owner);
component.push(Console);
if (public.length > 0) {
component.push(public);
}
if (trusted.length > 0) {
component.push(trusted);
}
if (admin.length > 0) {
component.push(admin);
}
if (owner.length > 0) {
component.push(owner);
}
if (source.sources.console) {
component.push(Console);
}
bot.tellraw("@a", component);
},
discordExecute (context) {
@@ -160,7 +308,6 @@ module.exports = {
component.push(trusted);
component.push(admin);
component.push(owner);
component.push(Console);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
}
+1 -1
View File
@@ -10,7 +10,7 @@ module.exports = {
description: "check whos online on the server",
trustLevel: 0,
usages: [
""
]
},
execute (context) {
+39 -16
View File
@@ -1,6 +1,24 @@
const mc = require('minecraft-protocol');
const util = require('util');
function componentPush (config, server, host, port, component) {
component.push({
translate: "%s: %s:%s\n%s: (%s/%s)\n%s: %s\n%s",
color: config.colors.commands.tertiary,
with: [
{ text: "ip", color: config.colors.commands.primary },
{ text: `${host}`, color: config.colors.commands.secondary },
{ text: `${Number(port ?? 25565)}`, color: config.colors.commands.secondary },
{ text: "players", color: config.colors.commands.primary },
{ text: `${server.players.online}`, color: config.colors.integer },
{ text: `${server.players.max}`, color: config.colors.integer },
{ text: "server version", color: config.colors.commands.primary },
{ text: `${server.version.name}`, color: config.colors.commands.secondary },
server.description
]
});
}
module.exports = {
data: {
name: "mcserver",
@@ -22,25 +40,30 @@ module.exports = {
let component = [];
try {
component.push({
translate: "%s: %s:%s\n%s: (%s/%s)\n%s: %s\n%s",
color: config.colors.commands.tertiary,
with: [
{ text: "ip", color: config.colors.commands.primary },
{ text: `${host}`, color: config.colors.commands.secondary },
{ text: `${Number(port ?? 25565)}`, color: config.colors.commands.secondary },
{ text: "players", color: config.colors.commands.primary },
{ text: `${server.players.online}`, color: config.colors.integer },
{ text: `${server.players.max}`, color: config.colors.integer },
{ text: "server version", color: config.colors.commands.primary },
{ text: `${server.version.name}`, color: config.colors.commands.secondary },
server.description
]
});
componentPush(config, server, host, port, component);
bot.tellraw("@a", component);
} catch (e) {
bot.chat.message(`${e.toString()}`);
}
},
async discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const fixansi = context.fixansi;
const config = context.config;
const [host, port] = args[0].split(':');
const server = await mc.ping({ host, port: Number(port ?? 25565) });
let component = [];
try {
componentPush(config, server, host, port, component);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
} catch (e) {
bot?.discord?.message?.reply(`${e.toString()}`);
}
}
}
}
+2 -2
View File
@@ -6,9 +6,9 @@ module.exports = {
"netmessage"
],
description: "send a message to other servers",
trustLevel: 0,
trustLevel: 1,
usages: [
"message"
"<message>"
]
},
execute (context) {
-46
View File
@@ -1,46 +0,0 @@
const mc = require('minecraft-protocol');
const util = require('util');
module.exports = {
data: {
name: "mcserver",
aliases: [
"pingserver"
],
description: "pings minecraft servers",
trustLevel: 0,
usages: [
"<ip>"
]
},
async execute (context) {
const bot = context.bot;
const config = context.config;
const args = context.arguments;
const [host, port] = args[0].split(':');
const server = await mc.ping({ host, port: Number(port ?? 25565) });
let component = [];
try {
component.push({
translate: "%s: %s:%s\n%s: (%s/%s)\n%s: %s\n%s",
color: config.colors.commands.tertiary,
with: [
{ text: "ip", color: config.colors.commands.primary },
{ text: `${host}`, color: config.colors.commands.secondary },
{ text: `${Number(port ?? 25565)}`, color: config.colors.commands.secondary },
{ text: "players", color: config.colors.commands.primary },
{ text: `${server.players.online}`, color: config.colors.integer },
{ text: `${server.players.max}`, color: config.colors.integer },
{ text: "server version", color: config.colors.commands.primary },
{ text: `${server.version.name}`, color: config.colors.commands.secondary },
server.description
]
});
bot.tellraw("@a", component);
} catch (e) {
bot.chat.message(`${e.toString()}`);
}
}
}
+1 -1
View File
@@ -8,7 +8,7 @@ module.exports = {
],
description: 'refill the bots core',
usages: [
""
],
},
execute (context) {
+16 -3
View File
@@ -27,9 +27,17 @@ module.exports = {
const query = new URLSearchParams({ term });
const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`);
const { list } = await dictResult.body.json();
if (!list.length) {
bot.tellraw('@a', { text: 'No results found', color: 'dark_red' });
if (bot.options.mode === "savageFriends") {
bot.chat.message('this command is disabled for this server for right now sorry!');
return;
}
if (!list.length) {
bot.tellraw("@a", { text: "No results found", color: "dark_red" });
}
for (definitions of list) {
component.push(prefix, [
{
@@ -70,7 +78,12 @@ module.exports = {
},
])
}
bot.tellraw(`@a`, component)
if (bot.options.mode === "savageFriends") {
bot.core.run(`minecraft:tellraw @a ${JSON.stringify(component)}`);
} else {
bot.tellraw(`@a`, component)
}
},
async discordExecute (context) {
const bot = context.bot;
+1 -1
View File
@@ -70,7 +70,7 @@ module.exports = {
let component = [];
try {
const url = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ').replaceAll(' ','&')}`);
const url = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ').replaceAll(' ','%20')}`);
const info = await url.body.json();
components(config, info, component);
+5 -2
View File
@@ -10,7 +10,10 @@ module.exports = {
description: "loops commands",
trustLevel: 1,
usages: [
"add <interval> <command>",
"remove <index>",
"list",
"clear"
]
},
execute (context) {
@@ -93,4 +96,4 @@ module.exports = {
throw new CommandError('invalid argument')
}
}
}
}
+114
View File
@@ -0,0 +1,114 @@
module.exports = {
prefixes: [
"!",
],
discord: {
token: "discord token here",
prefix: "!",
invite: "discord invite here",
enabled: true,
presence: {
name: "amogus",
status: "dnd"
},
roles: {
trusted: "trusted",
admin: "admin",
fullAccess: "full access",
owner: "FNFBoyfriendBot Owner"
}
},
core: {
name: { text: "FNFBoyfriendBot Core", color: "#00FFFF" },
itemName: { text: "FNFBoyfriendBot core item", color: "#00FFFF" },
itemRefill: true,
refillInterval: 300000,
// refilling core via item is buggy rn i recommend setting itemRefill to false for now
area: {
start: {
x: 0,
y: 0,
z: 0,
},
end: {
x: 15,
y: 0,
z: 15,
}
}
},
weatherApiKey: "weather api token here",
debug: {
commandSetMessage: false
},
keys: {
trusted: "trusted key here",
admin: "admin key here",
owner: "owner key here"
},
colors: {
integer: "gold",
discord: {
embed: "#000000",
error: "#FF0000"
},
commands: {
primary: "blue",
secondary: "aqua",
tertiary: "gray"
},
help: {
public: "blue",
trusted: "dark_aqua",
admin: "aqua",
owner: "light_purple",
console: "dark_purple"
}
},
console: {
prefix: "c."
},
logsFolder: {
path: "../../../",
// this is being loaded from the modules so make sure it starts with ../../
name: "fnfboyfriendbot-logs",
},
bots: [
// usernameGen is for a random username
// if private is set to true then the server ip for the server will be hidden
// channelId is for discord logging
// logging is for console logging
// reconnectDelay is for the delay for reconnecting to a server
// modes:
// kaboom: for the server kaboom.pw
// savageFriends: for the server savage Friends
// creayun for the server creayun
{
host: "localhost",
username: "FNFBoyfriendBot",
usernameGen: true,
version: "1.20.2",
serverName: "localhost",
private: false,
reconnectDelay: 6000,
channelId: "discord channel ip here",
logging: true,
mode: "kaboom",
selfcareInterval: 300
}
]
}
-81
View File
@@ -1,81 +0,0 @@
prefixes:
- "!"
discord:
token: "discord token here"
prefix: "!"
invite: "discord invite here"
enabled: false
presence:
name: "amogus"
status: "dnd"
roles:
trusted: "trusted"
admin: "admin"
fullAccess: "full access"
owner: "FNFBoyfriendBot Owner"
core:
name: { text: "FNFBoyfriendBot Core", color: "#00FFFF" }
itemName: { text: "FNFBoyfriendBot core item", color: "#00FFFF" }
itemRefill: true
# refilling core via item is buggy rn i recommend setting itemRefill to false for now
area:
start:
x: 0
y: 0
z: 0
end:
x: 15
y: 0
z: 15
keys:
trusted: "trusted key here"
admin: "admin key here"
owner: "owner key here"
weatherApiKey: ""
colors:
integer: "gold"
discord:
embed: "#000000"
error: "#FF0000"
commands:
primary: "dark_blue"
secondary: "blue"
tertiary: "gray"
help:
public: "dark_blue"
trusted: "blue"
admin: "aqua"
owner: "light_purple"
console: "dark_purple"
console:
prefix: "c."
logsFolder:
path: "../../"
# this is being loaded from the modules so make sure it starts with ../../
name: "logs"
bots:
# modes: kaboom, savageFriends, creayun
# private is for hiding the server ip in netmsg
# reconnectDelay is for reconnecting the bot to the server on a delay
# serverName is whatever you set the name as for the server
# usernameGen is for generating random usernames
# channelId is for the discord channel
- host: "localhost"
username: "FNFBoyfriendBot"
usernameGen: true
version: "1.20.2"
serverName: "localhost"
private: false
reconnectDelay: 6000
channelId: "discord channel id here"
logging: false
mode: "kaboom"
+3 -3
View File
@@ -1,8 +1,8 @@
{
"buildstring": {
"build": "2120",
"build": "2200",
"codename": "",
"version": "v7.0.3",
"url":"https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot"
"version": "v7.0.5",
"url": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot.git"
}
}
+26 -10
View File
@@ -1,6 +1,5 @@
const createBot = require('./bot.js');
const readline = require('readline');
const js_yaml = require('js-yaml');
const fs = require('fs');
const path = require('path');
const { Client, GatewayIntentBits } = require('discord.js');
@@ -10,19 +9,15 @@ const CommandSource = require('./util/command_source');
console.log('Starting FNFBoyfriendBot');
if (fs.existsSync(path.join(__dirname, "../config.yml")) === false) {
if (!fs.existsSync(path.join(__dirname, "../config.js"))) {
console.warn("Config not found creating config from the default config");
fs.copyFileSync(
path.join(__dirname, "./data/default_config.yml"),
path.join(__dirname, "../config.yml")
path.join(__dirname, "./data/default_config.js"),
path.join(__dirname, "../config.js")
)
}
try {
config = require('js-yaml').load(fs.readFileSync(path.join(__dirname, '../', 'config.yml')))
} catch (e) {
console.log(e.stack);
}
const config = require('../config.js');
const rl = readline.createInterface({
input: process.stdin,
@@ -35,11 +30,32 @@ const bots = [];
let bot;
for (const options of config.bots) {
bot = new createBot(options, config);
bot = createBot(options, config);
bots.push(bot);
bot.bots = bots;
require('./util/loadModules')(bot, options, config, discordClient);
let disconnectCount = 0;
bot.console.readlineInterface(rl);
bot.on('clientDisconnect', (data) => {
try {
disconnectCount++
if (disconnectCount === 10) {
bot.console.info('stopped logging disconnect messages for now...');
bot?.discord?.channel?.send('stopped logging disconnect messages for now...');
return;
} else if (disconnectCount > 10) {
return;
} else {
bot.console.warn(bot.getMessageAsPrismarine(`§8[§bClient Reconnect§8]§r ${data}`)?.toAnsi())
bot?.discord?.channel?.send(data.toString());
}
} catch (e) {
console.log(e.stack);
}
});
}
discordClient.on('messageCreate', (message) => {
-28
View File
@@ -1,28 +0,0 @@
function inject (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
const info = require('../data/info.json');
bot.on("packet.login", (data) => {
if (bot.options.mode === "creayun") return
if (new Date().getDay() === 5) {
bot.chat.message('Gettin\' freaky on a friday night!');
} else {
bot.chat.message('&9FNF&3Boyfriend&1Bot &fcreated by &4Parker&02991');
}
})
process.on('SIGINT', (data) => {
bot.chat.message('Killing bot.....');
process.exit(5);
});
}
module.exports = {
data: {
enabled: true,
name: "boot",
type: "start up"
},
inject
};
+61 -289
View File
@@ -30,142 +30,22 @@ function inject (context) {
bot.on('packet.profileless_chat', packet => {
const message = tryParse(packet.message)
const sender = tryParse(packet.name)
bot.emit('profileless_chat', {
message,
type: packet.type,
sender
})
switch (packet.type) {
case 1:
if (config?.debug?.chat?.profileless?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "1", color: "gold" },
{ translate: "chat.type.emote", with: [ sender, message ]}
]
});
} if (config?.debug?.chat?.profileless?.json === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "1", color: "gold" },
JSON.stringify({
translate: "chat.type.emote", with: [ sender, message ]
})
]
})
} else {
bot.emit('message', { translate: "chat.type.emote", with: [ sender, message ]})
}
bot.emit('message', { translate: "chat.type.emote", with: [ sender, message ]})
break
case 2:
if (config?.debug?.chat?.profileless?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "2", color: "gold" },
{ translate: "commands.message.display.incoming", with: [ sender, message ], color: "gray", italic: true }
]
})
} if (config?.debug?.chat?.profileless?.json === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "2", color: "gold" },
JSON.stringify({
translate: "commands.message.display.incoming", with: [ sender, message ], color: "gray", italic: true
})
]
})
} else {
bot.emit('message', { translate: "commands.message.display.incoming", with: [ sender, message ], color: "gray", italic: true })
}
bot.emit('message', { translate: "commands.message.display.incoming", with: [ sender, message ], color: "gray", italic: true })
break
case 3:
if (config?.debug?.chat?.profileless?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "3", color: "gold" },
{ translate: "commands.message.display.outgoing", with: [ sender, message ], color: "gray", italic: true }
]
})
} if (config?.debug?.chat?.profileless?.json === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "3", color: "gold" },
JSON.stringify({
translate: "commands.message.display.outgoing", with: [ sender, message ], color: "gray", italic: true
})
]
})
} else {
bot.emit('message', [{ translate: "commands.message.display.outgoing", with: [ sender, message ], color: "gray", italic: true }])
}
bot.emit('message', [{ translate: "commands.message.display.outgoing", with: [ sender, message ], color: "gray", italic: true }])
break
case 4:
if (config?.debug?.chat?.profileless?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "4", color: "gold" },
message
]
})
} if (config?.debug?.chat?.profileless?.json === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "4", color: "gold" },
JSON.stringify(message)
]
})
} else {
bot.emit('message', [message]);
}
bot.emit('message', [message]);
break
case 5:
if (config?.debug?.chat?.profileless?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "5", color: "gold" },
{ translate: 'chat.type.announcement', with: [ sender, message ]}
]
})
} if (config?.debug.chat?.profileless?.json === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "5", color: "gold" },
JSON.stringify({ translate: 'chat.type.announcement', with: [ sender, message ]})
]
})
} else {
bot.emit('message', [{ translate: 'chat.type.announcement', with: [ sender, message ]}])
}
bot.emit('message', [{ translate: 'chat.type.announcement', with: [ sender, message ]}])
break
}
tryParsingMessage(message, { senderName: sender, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
@@ -173,132 +53,22 @@ function inject (context) {
bot.on('packet.player_chat', (packet, data) => {
const unsigned = tryParse(packet.unsignedChatContent)
bot.emit('player_chat', { plain: packet.plainMessage, unsigned, senderUuid: packet.senderUuid })
switch (packet.type) {
case 5:
if (config?.debug?.chat?.player?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "5", color: "gold" },
{ translate: "chat.type.announcement", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]}
]
})
} if (config?.debug?.chat?.player?.json === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "5", color: "gold" },
JSON.stringify({ translate: "chat.type.announcement", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
]
})
} else {
bot.emit('message', { translate: "chat.type.announcement", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
}
bot.emit('message', { translate: "chat.type.announcement", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
break
case 4:
if (config?.debug?.chat?.player?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "4", color: "gold" },
unsigned
]
})
} if (config?.debug?.chat?.player?.json === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "4", color: "gold" },
JSON.stringify(unsigned)
]
})
} else {
bot.emit('message', unsigned);
}
bot.emit('message', unsigned);
break
case 3:
if (config?.debug?.chat?.player?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "3", color: "gold" },
{ translate: "commands.message.display.outgoing", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true }
]
})
} if (config?.debug?.chat?.player?.json === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "3", color: "gold" },
JSON.stringify({ translate: "commands.message.display.outgoing", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
]
})
} else {
bot.emit('message', { translate: "commands.message.display.outgoing", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
}
bot.emit('message', { translate: "commands.message.display.outgoing", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true });
break
case 2:
if (config?.debug?.chat?.player?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "2", color: "gold" },
{ translate: "commands.message.display.incoming", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true }
]
})
} if (config?.debug?.chat?.player?.json === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "2", color: "gold" },
JSON.stringify({ translate: "commands.message.display.incoming", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
]
})
} else {
bot.emit('message', { translate: "commands.message.display.incoming", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
}
bot.emit('message', { translate: "commands.message.display.incoming", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
break
case 1:
if (config?.debug?.chat?.player?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "1", color: "gold" },
{ translate: "chat.type.emote", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]}
]
})
} if (config?.debug?.chat?.player?.json) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "1", color: "gold" },
JSON.stringify({ translate: "chat.type.emote", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
]
})
} else {
bot.emit('message', { translate: "chat.type.emote", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
}
bot.emit('message', { translate: "chat.type.emote", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
break
}
tryParsingMessage(unsigned, { senderUuid: packet.senderUuid, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
@@ -308,61 +78,18 @@ function inject (context) {
const message = tryParse(packet.content)
if (message.translate === "advMode.setCommand.success" && config?.debug?.commandSetMessage === false) return;
if (message.translate === 'multiplayer.message_not_delivered') return
bot.emit('system_chat', { message, actionbar: packet.isActionBar })
if (packet.isActionBar) {
return
}
if (message.translate === "advMode.notAllowed") return;
if (message.translate === "advMode.notAllowed" || message?.translate?.startsWith("قيادة المجموعة")) return;
bot.emit('message', message);
if (config?.debug?.chat?.system?.packetType === true) {
bot.emit('message', {
translate: "[%s] %s",
with: [
{ text: "System Chat", color: "dark_blue"},
message
]
})
} if (config?.debug?.chat?.system?.json === true) {
bot.emit('message', {
translate: "[%s] %s",
with: [
{ text: "System Chat", color: "dark_blue"},
JSON.stringify(message)
]
})
} else {
bot.emit('message', message);
}
tryParsingMessage(message, { players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine });
})
bot.on('packet.action_bar', (message) => {
let parsedMessage = tryParse(message.text)
bot.emit('actionBar', {
translate: '[%s] %s',
color: 'dark_gray',
with: [
{ text: "Action Bar", color: "light_purple" },
parsedMessage
]
});
})
bot.on('packet.boss_bar', (data) => {
bot.emit('bossBar', {
translate: '[%s | %s: %s] %s',
color: 'dark_gray',
with: [
{ text: "Boss Bar", color: "dark_aqua" },
{ text: "Action ID", color: "blue" },
{ text: `${data.action}`, color: 'gold' },
tryParse(data.title)
]
})
})
function tryParsingMessage (message, data) {
let parsed
for (const parser of bot.chatParsers) {
@@ -383,7 +110,52 @@ function inject (context) {
return undefined
}
require('../util/chat_util')(bot);
bot.chat = {
message (message) {
const acc = 0;
const bitset = Buffer.allocUnsafe(3);
bitset[0] = acc & 0xFF;
bitset[1] = (acc >> 8) & 0xFF;
bitset[2] = (acc >> 16) & 0xFF;
bot._client.write('chat_message', {
message: message?.substring(0, 256)?.replaceAll('§','&'),
timestamp: BigInt(Date.now()),
salt: 0n,
offset: 0,
acknowledged: bitset
})
},
command (command) {
bot._client.write('chat_command', {
command: command?.substring(0, 256)?.replaceAll('§','&'),
timestamp: BigInt(Date.now()),
salt: 0n,
argumentSignatures: [],
signedPreview: false,
messageCount: 0,
acknowledged: Buffer.alloc(3),
previousMessages: []
})
},
send (message) {
if (message.startsWith('/')) {
bot.chat.command(message.substring(1))
return;
}
bot.chat.message(message)
}
}
bot.tellraw = (selector, message) => {
if (bot.options.mode === "savageFriends") {
bot.core.run(`minecraft:tellraw ${selector} ` + JSON.stringify(bot.getMessageAsPrismarine(message)?.toMotd()))
} else {
bot.core.run(`minecraft:tellraw ${selector} ` + JSON.stringify(message))
}
}
}
module.exports = {
data: {
+75 -11
View File
@@ -1,6 +1,6 @@
const mcData = require('minecraft-data')('1.20.2');
const nbt = require('prismarine-nbt');
const sleep = require('../util/sleep');
function inject (context) {
const bot = context.bot;
const config = context.config;
@@ -48,7 +48,7 @@ function inject (context) {
slot: 36,
item: {
present: true,
itemId: mcData.itemsByName.repeating_command_block.id,
itemId: bot.registry.itemsByName.repeating_command_block.id,
itemCount: 1,
nbtData: nbt.comp({
BlockEntityTag: nbt.comp({
@@ -94,12 +94,12 @@ function inject (context) {
};
bot.core.itemPosition = {
x: pos.x,
y: pos.y -1,
z: pos.z
x: Math.floor(pos.x - 2),
y: Math.floor(pos.y - 2),
z: Math.floor(pos.z - 2)
}
if (config.core.itemRefill) {
if (config.core.itemRefill && bot.options.mode !== "savageFriends") {
bot.core.itemRefill();
} else {
bot.core.chatRefill();
@@ -175,7 +175,7 @@ function inject (context) {
}
},
async runTracked (command) {
async runTracked (command, selector) {
const location = bot.core.itemPosition;
let transactionId = Math.floor(Math.random() * 10000);
@@ -183,7 +183,7 @@ function inject (context) {
slot: 36,
item: {
present: true,
itemId: mcData.itemsByName.repeating_command_block.id,
itemId: bot.registry.itemsByName.repeating_command_block.id,
itemCount: 1,
nbtData: nbt.comp({
BlockEntityTag: nbt.comp({
@@ -231,19 +231,83 @@ function inject (context) {
bot.on('packet.nbt_query_response', (data) => {
try {
if (data.transactionId == transactionId) {
if (data?.nbt?.value?.LastOutput) {
bot.tellraw("@a", JSON.parse(data.nbt.value.LastOutput.value));
bot.tellraw("@a", JSON.parse(data.nbt.value.LastOutput.value).extra);
}
}
} catch (e) {
console.log(e.stack)
}
});
bot._client.removeListener('nbt_query_response');
}
}
require('../util/core_util')(bot, config, options);
if (options.mode === "creayun") return;
let timer;
bot.on('packet.block_change', (data) => {
try {
if (data?.location?.x === bot?.core?.position?.x && data?.location?.y === bot?.core?.position?.y && data?.location?.z === bot?.core?.position?.z && data.type === 0) {
bot.core.move(bot.position);
}
} catch (e) {
bot.console.warn(e.toString());
}
});
bot.on('move', async () => {
try {
if (bot.options.mode === "savageFriends") {
await sleep(2000);
bot.chat.command('/removenear commandblock');
await sleep(2000);
bot.core.move(bot.position);
} else {
bot.core.move(bot.position);
}
} catch (e) {
bot.console.warn(e.toString());
}
});
bot.on('packet.login', () => {
timer = setInterval(() => {
bot.core.move(bot.position)
}, config.core.refillInterval)
});
bot.on('end', () => {
if (timer) clearInterval(timer);
});
bot.on('packet.multi_block_change', (data) => {
try {
if (bot.options.mode !== "kaboom") return;
let broken = true;
if (
data.chunkCoordinates.x === Math.floor(bot.core.position.x / 16)
&&
data.chunkCoordinates.y === Math.floor(bot.core.position.y / 16)
&&
data.chunkCoordinates.z === Math.floor(bot.core.position.z / 16)
) {
for (const state of data.records) {
if ((state >= 7906) && (state >= 7917)) broken = false;
if ((state >= 12527) && (state >= 12538)) broken = false;
if ((state >= 12515) && (state >= 12526)) broken = false;
else broken = true;
}
if (broken === true) bot.core.move(bot.position);
}
} catch (e) {
console.log(e.stack);
}
})
}
module.exports = {
data: {
+2 -1
View File
@@ -5,12 +5,13 @@ function inject (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
bot.on("parsed_message", (data) => {
if (data.type !== "minecraft:chat") return;
const prefixes = config.prefixes;
prefixes.map((prefix) => {
const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString();
if (!plainMessage.startsWith(prefix)) return
const command = plainMessage.substring(prefix.length)
const source = new CommandSource(data.sender, { discord: false, console: false }, true)
+14 -16
View File
@@ -2,7 +2,6 @@ const fs = require('fs');
const path = require('path');
const CommandError = require('../util/command_error.js');
const CommandSource = require('../util/command_source');
const { EmbedBuilder } = require('discord.js');
const fixansi = require('../util/ansi');
const cmdMgrUtil = require('../util/command_manager_util');
const sleep = require('../util/sleep.js');
@@ -32,7 +31,7 @@ async function inject (context) {
]
})?.toAnsi());
} else {
bot.tellraw("@a", {
throw new CommandError({
translate: "%s%s%s %s",
color: "dark_gray",
with: [
@@ -49,20 +48,19 @@ async function inject (context) {
return command?.execute({ bot, source, arguments: args, config, discordClient });
} catch (error) {
console.error(error);
if (error instanceof CommandError) {
if (options.mode !== "kaboom") {
bot.chat.message(`&4${bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&')}`);
} else {
if (error.toString().length > 256) {
bot.tellraw("@a", error._message);
} else if (error.toString().length < 256) {
bot.chat.message(`${bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&')}`);
} else {
bot.tellraw("@a", error._message);
bot.tellraw("@a", error._message);
} else {
bot.tellraw("@a", {
translate: "command.failed",
color: "red",
hoverEvent: {
action: "show_text",
contents: String(error.stack)
}
}
});
bot?.console?.warn(error.stack);
}
}
},
@@ -89,14 +87,14 @@ async function inject (context) {
if (!command?.discordExecute) {
throw new CommandError(`${command.data.name} command is not supported in discord!`);
} else if (source.sources.discord) {
return command?.discordExecute({ bot, source, arguments: args, config, discordClient, EmbedBuilder, fixansi });
return command?.discordExecute({ bot, source, arguments: args, config, discordClient, fixansi });
}
} catch (error) {
console.error(error);
if (error instanceof CommandError) {
bot?.discord?.message?.reply(`${bot.getMessageAsPrismarine(error._message)}`);
} else {
bot?.discord?.message?.reply(`\`\`\`${error}\`\`\``);
bot?.console?.warn(error.stack);
}
}
},
+2 -3
View File
@@ -16,7 +16,7 @@ function inject (context) {
if (args.startsWith(config.console.prefix)) {
return bot.commandManager.executeString(bot.console.source, args.substring(config.console.prefix.length))
} else if (args.startsWith("")) {
return bot.commandManager.executeString(bot.console.source, `console say ${args.substring(0)}`);
bot.chat.send(args);
}
rl.on('close', () => {
this.readline = null;
@@ -56,12 +56,11 @@ function inject (context) {
bot.on('message', (message) => {
if (!options.logging) return;
if (ratelimit > 10) return
if (ratelimit > 10) return;
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
ratelimit++
});
}
module.exports = {
-1
View File
@@ -1,7 +1,6 @@
const fixansi = require('../util/ansi');
const CommandSource = require('../util/command_source');
const util = require('util')
function inject (context) {
const bot = context.bot;
const config = context.config;
+1
View File
@@ -3,6 +3,7 @@ const path = require("path");
const { createGzip } = require("zlib");
const readline = require('readline');
const { Console } = require("console");
function inject (context) {
const bot = context.bot;
const config = context.config;
-154
View File
@@ -1,154 +0,0 @@
const fs = require('fs');
const path = require('path');
function inject (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
if (options.mode !== "kaboom") return;
bot.filter = {
list () {
try {
return JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
} catch (e) {
bot.console.warn(e.toString())
}
},
add (Player, ignoreCase, Regex) {
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
const filterAdd = { name: Player, ignorecase: ignoreCase, regex: Regex };
data.push(filterAdd);
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data));
this.doAll();
},
remove (index) {
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
data.splice(index, 1);
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data));
},
clear () {
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
data = [];
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data));
},
doAll () {
for (const filtered of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
for (const players of bot.players) {
if (filtered.ignorecase === true) {
if (filtered.regex === true) {
let regex = new RegExp(filtered.name.toLowerCase());
if (regex.test(players.profile.name.toLowerCase())) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name.toLowerCase()}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name.toLowerCase()}"]`)
}
} else {
if (filtered.name.toLowerCase() === players.profile.name.toLowerCase()) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name.toLowerCase()}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
}
}
} else if (filtered.regex === true) {
let regex = new RegExp(filtered.name);
if (regex.test(players.profile.name)) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
}
} else {
if (filtered.name === players.profile.name) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
}
}
}
}
}
}
bot.on('parsed_message', (data) => {
try {
for (const filtered of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
if (filtered.ignorecase === true) {
if (filtered.regex === true) {
let regex = new RegExp(filtered.name.toLowerCase());
if (regex.test(data.sender.profile.name.toLowerCase())) {
bot.core.run(`essentials:mute ${data.sender.uuid} 10y`);
}
} else {
if (data.sender.profile.name.toLowerCase() === filtered.name.toLowerCase()) {
bot.core.run(`essentials:mute ${data.sender.uuid} 10y`);
}
}
} else if (filtered.regex === true) {
let regex = new RegExp(filtered.name);
if (regex.test(data.sender.profile.name)) {
bot.core.run(`essentials:mute ${data.sender.uuid} 10y`);
}
} else {
if (data.sender.profile.name === filtered.name) {
bot.core.run(`essentials:mute ${data.sender.uuid} 10y`);
}
}
}
} catch (e) {
console.log(e.stack);
}
});
bot.on('player_info', (data) => {
for (const filtered of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
for (const players of bot.players) {
if (filtered.ignorecase === true) {
if (filtered.regex === true) {
let regex = new RegExp(filtered.name.toLowerCase());
if (regex.test(players.profile.name.toLowerCase())) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
bot.exploits.kicks.item(`@a[name="${players.profile.name}"]`);
}
} else {
if (filtered.name.toLowerCase() === players.profile.name.toLowerCase()) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
bot.exploits.kicks.item(`@a[name="${players.profile.name}"]`);
}
}
} else if (filtered.regex === true) {
let regex = new RegExp(filtered.name);
if (regex.test(players.profile.name)) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
}
} else {
if (players.profile.name === filtered.name) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
bot.exploits.kicks.item(`@a[name="${players.profile.name}"]`);
}
}
}
}
});
}
module.exports = {
data: {
enabled: true,
name: "filter",
type: "blacklist"
},
inject
}
-47
View File
@@ -1,47 +0,0 @@
const os = require('os');
function inject (context) {
const bot = context.bot;
const config = context.config;
let timer;
bot.memUsage = {
enabled: false
}
timer = setInterval(() => {
component = {
translate: "%s%s%s %s | %s: %s%s / %s%s | %s: %s%s / %s%s |",
color: config.colors.commands.tertiary,
with: [
{ text: "FNF", color: "dark_blue" },
{ text: "Boyfriend", color: "dark_aqua" },
{ text: "Bot", color: "blue" },
{ text: "Memory Usage" },
{ text: "Free Server Memory", color: config.colors.commands.primary },
{ text: `${Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: "Bot Memory Usage", color: config.colors.commands.primary },
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576 )}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary }
]
}
if (!bot.memUsage.enabled) return;
bot.core.run(`minecraft:title @a[tag=!memusage] actionbar ${JSON.stringify(component)}`)
}, 100)
bot.on('end', () => {
bot.memUsage.enabled = false;
})
}
module.exports = {
data: {
enabled: true,
name: "memory usage",
type: "extras"
},
inject
};
+1
View File
@@ -31,6 +31,7 @@ function inject (context) {
player.vanished = true;
} else {
bot.players = bot.players.filter(_ => _.uuid != player.uuid);
bot._client.removeListener('tab_complete');
bot.emit("player_left", player);
}
})
-10
View File
@@ -15,16 +15,6 @@ function inject (context) {
bot.emit('move')
})
bot.on('move', () => {
if (config?.debug?.position?.bot === true) {
bot.console.debug(`Bot Position: ${JSON.stringify(bot.position)}`)
} if (config?.debug?.position?.core === true) {
bot.console.debug(`Core Position: ${JSON.stringify(bot.core.position)}`)
} if (config?.debug?.position?.coreItem === true) {
bot.console.debug(`Core Item Position: ${JSON.stringify(bot.core.itemPosition)}`)
}
});
bot.on('end', () => { bot.position = null })
}
-1
View File
@@ -6,7 +6,6 @@ function inject (context) {
const options = context.options;
bot.on('end', () => {
bot._client.removeAllListeners();
if (bot.reconnectDelay < 0) return
setTimeout(() => {
if (options.usernameGen) {
client = options.client ?? mc.createClient(options, options.username = usernameGen(bot))
+10 -10
View File
@@ -19,9 +19,9 @@ function inject (context) {
let register = false;
let positionCount = 0;
bot.vanished = true
bot.on('system_chat', (data) => {
bot.on('message', (data) => {
try {
const stringMessage = bot.getMessageAsPrismarine(data.message)?.toString();
const stringMessage = bot.getMessageAsPrismarine(data)?.toString();
if (options.mode === "savageFriends") {
if (stringMessage === "Please, login with the command: /login <password>") login = true;
else if (stringMessage === "Successful login!") login = false;
@@ -42,8 +42,8 @@ function inject (context) {
else if (stringMessage === "Successfully enabled CommandSpy.") commandSpy = true;
else if (stringMessage === "Successfully disabled CommandSpy") commandSpy = false;
else if (stringMessage === "Successfully disabled CommandSpy.") commandSpy = false;
else if (stringMessage === `Vanish for ${bot.options.username}: enabled`) vanished = true;
else if (stringMessage === `Vanish for ${bot.options.username}: disabled`) vanished = false;
else if (stringMessage === `Vanish for ${bot._client.username}: enabled`) vanished = true;
else if (stringMessage === `Vanish for ${bot._client.username}: disabled`) vanished = false;
else if (stringMessage === `You now have the tag: &8[&bPrefix&8: &3${config.prefixes[0]}&8]` || stringMessage === "Something went wrong while saving the prefix. Please check console.") prefix = true;
else if (stringMessage?.startsWith("You now have the tag: ") || stringMessage === "You no longer have a tag") prefix = false
else if (stringMessage?.startsWith("You have been muted")) unmuted = true;
@@ -53,12 +53,12 @@ function inject (context) {
else if (stringMessage === "God mode enabled.") god = true;
else if (stringMessage === "Teleportation disabled.") teleportToggle = true;
else if (stringMessage === "Teleportation enabled.") teleportToggle = false;
else if (stringMessage === `Successfully set your username to "${bot.username}"`) {
else if (stringMessage === `Successfully set your username to "${bot._client.username}"`) {
username = false
return
}
else if (stringMessage?.startsWith("Successfully set your username to ")) username = true
else if (stringMessage === `You already have the username "${bot.username}"`) username = false
else if (stringMessage === `You already have the username "${bot._client.username}"`) username = false
else if (stringMessage === `You no longer have a nickname.`) nickname = false;
else if (stringMessage?.startsWith('Your nickname is now ')) nickname = true;
}
@@ -115,17 +115,17 @@ function inject (context) {
} else if (bot.options.mode === "kaboom") {
if (permissionLevel < 2) bot.chat.command('op @s[type=player]');
else if (gameMode !== 1) bot.chat.command('minecraft:gamemode creative');
else if (!commandSpy) bot.chat.command('commandspy on');
else if (username) bot.chat.command(`username ${bot.options.username}`)
else if (username) bot.chat.command(`username ${bot._client.username}`)
else if (nickname) bot.chat.command(`nick off`)
else if (!prefix) bot.chat.command(`prefix &8[&bPrefix&8: &3${config.prefixes[0]}&8]`);
else if (!vanished && bot.vanished) bot.chat.command(`essentials:vanish on`);
else if (!vanished && bot.vanished) bot.core.run(`essentials:vanish ${bot._client.username} on`);
else if (!commandSpy) bot.core.run(`commandspy ${bot.uuid} on`);
else if (unmuted) bot.core.run(`essentials:mute ${bot.uuid}`);
else if (!god) bot.core.run(`god ${bot.options.username} enable`);
else if (!teleportToggle) bot.core.run(`tptoggle ${bot.options.username} disable`);
else if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 });
}
}, 1000);
}, options.selfcareInterval);
});
bot.on('end', () => {
if (timer) clearInterval(timer)
-60
View File
@@ -1,60 +0,0 @@
const sleep = require('../util/sleep');
function inject (context) {
const bot = context.bot;
const options = context.options;
const config = context.config;
if (options.mode !== "kaboom" || config.team.enabled === false) return;
bot.on("packet.login", async () => {
if (options.mode === "kaboom") {
await sleep(100);
bot.chat.command(`minecraft:team add ${config.team.name}`);
await sleep(100);
bot.core.run(`minecraft:team join ${config.team.name} @a[name="${bot.options.username}"]`);
}
})
bot.on("packet.teams", async (data) => {
try {
if (data.team === config.team.name) {
data?.players?.map(async (player) => {
if (player !== bot.options.username) {
await sleep(100);
bot.core.run(`minecraft:team empty ${config.team.name}`);
await sleep(100);
bot.core.run(`minecraft:team join ${config.team.name} @a[name="${bot.options.username}"]`);
// this removes players who are not the bot
}
});
if (data.mode == 1) {
// this is checking if the team has been deleted
bot.core.run(`minecraft:team add ${config.team.name}`);
await sleep(100);
bot.core.run(`minecraft:team join ${config.team.name} @a[name="${bot.options.username}"]`);
} if (data.name !== JSON.stringify(config.team.displayName)) {
// this checks if the team displayName matches the one set in the config
bot.core.run(`minecraft:team modify ${config.team.name} displayName ${JSON.stringify(config.team.displayName)}`);
} if (data.prefix !== JSON.stringify(config.team.prefix)) {
// this checks if the team prefix matches the one set in the config
bot.core.run(`minecraft:team modify ${config.team.name} prefix ${JSON.stringify(config.team.prefix)}`);
} if (data.suffix !== JSON.stringify(config.team.suffix)) {
// this checks if the team suffix matches the one set in the config
bot.core.run(`minecraft:team modify ${config.team.name} suffix ${JSON.stringify(config.team.suffix)}`)
}
}
} catch (e) {
console.log(e.stack)
}
})
}
module.exports = {
data: {
enabled: true,
name: "teams",
type: "extras"
},
inject
}
-68
View File
@@ -1,68 +0,0 @@
const sleep = require('./sleep');
module.exports = (bot) => {
bot.chat = {
message (message) {
const acc = 0;
const bitset = Buffer.allocUnsafe(3);
bitset[0] = acc & 0xFF;
bitset[1] = (acc >> 8) & 0xFF;
bitset[2] = (acc >> 16) & 0xFF;
bot._client.write('chat_message', {
message: message?.substring(0, 256),
timestamp: BigInt(Date.now()),
salt: 0n,
offset: 0,
acknowledged: bitset
})
},
command (command) {
bot._client.write('chat_command', {
command: command?.substring(0, 256),
timestamp: BigInt(Date.now()),
salt: 0n,
argumentSignatures: [],
signedPreview: false,
messageCount: 0,
acknowledged: Buffer.alloc(3),
previousMessages: []
})
},
send (message) {
if (message.startsWith('/')) {
bot._client.write('chat_command', {
command: message?.substring(1).substring(0, 256),
timestamp: BigInt(Date.now()),
salt: 0n,
argumentSignatures: [],
signedPreview: false,
messageCount: 0,
acknowledged: Buffer.alloc(3),
previousMessages: []
})
return;
}
const acc = 0;
const bitset = Buffer.allocUnsafe(3);
bitset[0] = acc & 0xFF;
bitset[1] = (acc >> 8) & 0xFF;
bitset[2] = (acc >> 16) & 0xFF;
bot._client.write('chat_message', {
message: message?.substring(0, 256),
timestamp: BigInt(Date.now()),
salt: 0n,
offset: 0,
acknowledged: bitset
})
}
}
bot.tellraw = (selector, message) => {
if (bot.options.mode === "savageFriends") {
bot.core.run(`minecraft:tellraw ${selector} ` + JSON.stringify(bot.getMessageAsPrismarine(message)?.toMotd()))
} else {
bot.core.run(`minecraft:tellraw ${selector} ` + JSON.stringify(message))
}
}
}
+77
View File
@@ -0,0 +1,77 @@
const sleep = require('./sleep');
function coreUtil (bot, config, options) {
if (options.mode === "creayun") return;
let timer;
bot.on('packet.block_change', (data) => {
try {
// if (bot.options.mode === "savageFriends") return;
// type 12521 = repeating_command_block
// type 12533 = chain_command_block
// type 7912 = command_block
// type 0 = air
if (data?.location?.x === bot?.core?.position?.x && data?.location?.y === bot?.core?.position?.y && data?.location?.z === bot?.core?.position?.z && data.type === 0) {
bot.core.move(bot.position);
}
} catch (e) {
bot.console.warn(e.toString());
}
});
bot.on('move', async () => {
try {
if (bot.options.mode === "savageFriends") {
await sleep(2000);
bot.chat.command('/removenear commandblock');
await sleep(2000);
bot.core.move(bot.position);
} else {
bot.core.move(bot.position);
}
} catch (e) {
bot.console.warn(e.toString());
}
});
bot.on('packet.login', () => {
timer = setInterval(() => {
bot.core.move(bot.position)
}, config.core.refillInterval)
});
bot.on('end', () => {
if (timer) clearInterval(timer);
});
bot.on('packet.multi_block_change', (data) => {
try {
if (bot.options.mode !== "kaboom") return;
let broken = true;
if (
data.chunkCoordinates.x === Math.floor(bot.core.position.x / 16)
&&
data.chunkCoordinates.y === Math.floor(bot.core.position.y / 16)
&&
data.chunkCoordinates.z === Math.floor(bot.core.position.z / 16)
) {
for (const state of data.records) {
if ((state >= 7906) && (state >= 7917)) broken = false;
if ((state >= 12527) && (state >= 12538)) broken = false;
if ((state >= 12515) && (state >= 12526)) broken = false;
else broken = true;
}
if (broken === true) bot.core.move(bot.position);
// console.log(broken);
}
} catch (e) {
console.log(e.stack);
}
})
}
module.exports = coreUtil;
+2 -7
View File
@@ -1,10 +1,5 @@
function usernameGen (bot, config) {
// const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
if (bot.options.mode === "savageFriends" || bot.options.mode === "creayun") {
characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
} else {
characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_-+={]}[|\\:;>.<,/?ඞ♋'
}
function usernameGen () {
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
let username = '';
for (let i = 0; i < 3 + Math.floor(Math.random() * 14); i++ ) {
const randomIndex = Math.floor(Math.random() * characters.length);