Compare commits

...
8 Commits
Author SHA1 Message Date
Parker2991 c522270815 v7.0.4, build 2150 2025-03-14 08:05:15 -04:00
Parker2991 e92153bb81 v7.0.4, build 2150 2025-03-14 08:04:33 -04:00
Parker2991 25ee0ce1e4 v7.0.4, build 2150 2025-03-14 08:01:58 -04:00
Parker2991 b9ae2a3bf7 v7.0.3, build: 2120 2025-03-07 11:17:55 -05:00
Parker2991 3a1d335753 v7.0.3, build: 2120 2025-03-07 11:17:17 -05:00
Parker2991 668312461f v7.0.3, build: 2120 2025-03-07 11:14:42 -05:00
Parker2991 18e2278ebd Update src/data/info.json
just realized i put the wrong version its supposed to be v7.0.2 not v7.0.3
2025-02-28 18:17:27 -05:00
Parker2991 1fd50ab7fa v7.0.2, build: 2100 2025-02-25 19:53:19 +00:00
57 changed files with 1651 additions and 1908 deletions
+2 -1
View File
@@ -4,4 +4,5 @@ config.yml
src/modules/exploits.js
logs
src/modules/custom_chat.js
src/util/core_util.js
src/util/core_util.js
src/data/filter.json
+593 -15
View File
@@ -5,12 +5,16 @@
"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",
"minecraft-data": "^3.83.1",
"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"
}
@@ -38,6 +42,18 @@
"node": ">=16"
}
},
"node_modules/@babel/runtime": {
"version": "7.26.9",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.9.tgz",
"integrity": "sha512-aA63XwOkcl4xxQa3HjPMqOP6LiK0ZDv3mUPYEFXkpHbaFjtGggE1A61FjFzJnB+p7/oy2gA8E+rcBNl/zC1tMg==",
"license": "MIT",
"dependencies": {
"regenerator-runtime": "^0.14.0"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@discordjs/builders": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.10.0.tgz",
@@ -174,6 +190,21 @@
"url": "https://github.com/discordjs/discord.js?sponsor"
}
},
"node_modules/@matrix-org/matrix-sdk-crypto-wasm": {
"version": "13.0.0",
"resolved": "https://registry.npmjs.org/@matrix-org/matrix-sdk-crypto-wasm/-/matrix-sdk-crypto-wasm-13.0.0.tgz",
"integrity": "sha512-2gtpjnxL42sdJAgkwitpMMI4cw7Gcjf5sW0MXoe+OAlXPlxIzyM+06F5JJ8ENvBeHkuV2RqtFIRrh8i90HLsMw==",
"license": "Apache-2.0",
"engines": {
"node": ">= 18"
}
},
"node_modules/@matrix-org/olm": {
"version": "3.2.15",
"resolved": "https://registry.npmjs.org/@matrix-org/olm/-/olm-3.2.15.tgz",
"integrity": "sha512-S7lOrndAK9/8qOtaTq/WhttJC/o4GAzdfK0MUPpo8ApzsJEC0QjtwrkC3KBXdFP1cD1MXi/mlKR7aaoVMKgs6Q==",
"license": "Apache-2.0"
},
"node_modules/@sapphire/async-queue": {
"version": "1.5.5",
"resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.5.tgz",
@@ -207,6 +238,22 @@
"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",
"integrity": "sha512-trOc4AAUThEz9hapPtSd7wf5tiQKvTtu5b371UxXdTuqzIh0ArcRspRP0i0Viu+LXstIQ1z96t1nsPxT9ol01g==",
"license": "MIT"
},
"node_modules/@types/node": {
"version": "22.10.10",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.10.tgz",
@@ -235,6 +282,12 @@
"safe-buffer": "~5.1.1"
}
},
"node_modules/@types/retry": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz",
"integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==",
"license": "MIT"
},
"node_modules/@types/ws": {
"version": "8.5.14",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.14.tgz",
@@ -270,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",
@@ -304,33 +366,77 @@
"url": "https://github.com/sponsors/epoberezkin"
}
},
"node_modules/another-json": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/another-json/-/another-json-0.2.0.tgz",
"integrity": "sha512-/Ndrl68UQLhnCdsAzEXLMFuOR546o2qbYRqCglaNHbjXrwG1ayTcdwr3zkSGOGtGXDyR5X9nCFfnyG2AFJIsqg==",
"license": "Apache-2.0"
},
"node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"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": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/base-x/-/base-x-5.0.0.tgz",
"integrity": "sha512-sMW3VGSX1QWVFA6l8U62MLKz29rRfpTlYdCqLdpLo1/Yd4zZwSbnUaDfciIAowAqvq7YFnWq9hrhdg1KYgc1lQ==",
"license": "MIT"
},
"node_modules/base64-js": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
@@ -351,6 +457,24 @@
],
"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",
"integrity": "sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw==",
"license": "MIT",
"dependencies": {
"base-x": "^5.0.0"
}
},
"node_modules/buffer": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
@@ -402,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",
@@ -420,6 +550,33 @@
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"license": "MIT"
},
"node_modules/content-type": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
"license": "MIT",
"engines": {
"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",
@@ -493,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",
@@ -526,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",
@@ -558,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",
@@ -572,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",
@@ -605,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",
@@ -617,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",
@@ -645,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",
@@ -666,6 +949,15 @@
"safe-buffer": "^5.0.1"
}
},
"node_modules/jwt-decode": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-4.0.0.tgz",
"integrity": "sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==",
"license": "MIT",
"engines": {
"node": ">=18"
}
},
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
@@ -739,6 +1031,19 @@
"integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==",
"license": "MIT"
},
"node_modules/loglevel": {
"version": "1.9.2",
"resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.9.2.tgz",
"integrity": "sha512-HgMmCqIJSAKqo68l0rS2AanEWfkxaZ5wNiEFb5ggm08lDs9Xl2KxBlX3PTcaD2chBM1gXAYf491/M2Rv8Jwayg==",
"license": "MIT",
"engines": {
"node": ">= 0.6.0"
},
"funding": {
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/loglevel"
}
},
"node_modules/macaddress": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/macaddress/-/macaddress-0.5.3.tgz",
@@ -751,6 +1056,67 @@
"integrity": "sha512-/k20Lg2q8LE5xiaaSkMXk4sfvI+9EGEykFS4b0CHHGWqDYU0bGUFSwchNOMA56D7TCs9GwVTkqe9als1/ns8UQ==",
"license": "MIT"
},
"node_modules/matrix-events-sdk": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/matrix-events-sdk/-/matrix-events-sdk-0.0.1.tgz",
"integrity": "sha512-1QEOsXO+bhyCroIe2/A5OwaxHvBm7EsSQ46DEDn8RBIfQwN5HWBpFvyWWR4QY0KHPPnnJdI99wgRiAl7Ad5qaA==",
"license": "Apache-2.0"
},
"node_modules/matrix-js-sdk": {
"version": "36.2.0",
"resolved": "https://registry.npmjs.org/matrix-js-sdk/-/matrix-js-sdk-36.2.0.tgz",
"integrity": "sha512-pP44qfqLA9tiJjx5YjxBPPkUmNsA2G0nb04ZUTuPbtQFmfK5cEQgIpvoCq69oqU6aulufeYpxJmd9yNffOvF9g==",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@matrix-org/matrix-sdk-crypto-wasm": "^13.0.0",
"@matrix-org/olm": "3.2.15",
"another-json": "^0.2.0",
"bs58": "^6.0.0",
"content-type": "^1.0.4",
"jwt-decode": "^4.0.0",
"loglevel": "^1.7.1",
"matrix-events-sdk": "0.0.1",
"matrix-widget-api": "^1.10.0",
"oidc-client-ts": "^3.0.1",
"p-retry": "4",
"sdp-transform": "^2.14.1",
"unhomoglyph": "^1.0.6",
"uuid": "11"
},
"engines": {
"node": ">=20.0.0"
}
},
"node_modules/matrix-js-sdk/node_modules/uuid": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz",
"integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==",
"funding": [
"https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan"
],
"license": "MIT",
"bin": {
"uuid": "dist/esm/bin/uuid"
}
},
"node_modules/matrix-widget-api": {
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/matrix-widget-api/-/matrix-widget-api-1.13.1.tgz",
"integrity": "sha512-mkOHUVzaN018TCbObfGOSaMW2GoUxOfcxNNlTVx5/HeMk3OSQPQM0C9oEME5Liiv/dBUoSrEB64V8wF7e/gb1w==",
"license": "Apache-2.0",
"dependencies": {
"@types/events": "^3.0.0",
"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",
@@ -887,6 +1253,46 @@
"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",
"integrity": "sha512-IDopEXjiwjkmJLYZo6BTlvwOtnlSniWZkKZoXforC/oLZHC9wkIxd25Kwtmo5yKFMMVcsp3JY6bhcNJqdYk8+g==",
"license": "Apache-2.0",
"dependencies": {
"jwt-decode": "^4.0.0"
},
"engines": {
"node": ">=18"
}
},
"node_modules/p-retry": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.6.2.tgz",
"integrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==",
"license": "MIT",
"dependencies": {
"@types/retry": "0.12.0",
"retry": "^0.13.1"
},
"engines": {
"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",
@@ -1017,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",
@@ -1026,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",
@@ -1061,6 +1488,68 @@
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"node_modules/regenerator-runtime": {
"version": "0.14.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
"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",
@@ -1070,12 +1559,36 @@
"node": ">=0.12"
}
},
"node_modules/retry": {
"version": "0.13.1",
"resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz",
"integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==",
"license": "MIT",
"engines": {
"node": ">= 4"
}
},
"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/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",
"integrity": "sha512-KrOH82c/W+GYQ0LHqtr3caRpM3ITglq3ljGUIb8LTki7ByacJZ9z+piSGiwZDsRyhQbYBOBJgr2k6X4BZXi3Kw==",
"license": "MIT",
"bin": {
"sdp-verify": "checker.js"
}
},
"node_modules/semver": {
"version": "7.6.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
@@ -1098,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",
@@ -1127,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",
@@ -1145,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",
@@ -1160,6 +1729,12 @@
"integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==",
"license": "MIT"
},
"node_modules/unhomoglyph": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/unhomoglyph/-/unhomoglyph-1.0.6.tgz",
"integrity": "sha512-7uvcWI3hWshSADBu4JpnyYbTVc7YlhF5GDW/oPD5AxIxl34k4wXR3WDkPnzLxkN32LiTCTKMQLtKVZiwki3zGg==",
"license": "MIT"
},
"node_modules/uri-js": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
@@ -1187,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",
@@ -1216,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",
+4
View File
@@ -1,11 +1,15 @@
{
"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",
"minecraft-data": "^3.83.1",
"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"
}
-32
View File
@@ -1,32 +0,0 @@
module.exports = {
data: {
name: 'vanish',
trustLevel: 2,
aliases: [
"vanishtoggle"
],
description: 'toggle the bots vanish selfcare',
usages: [
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;
if (args.slice(1).join('') === 'true') {
bot.vanished = true
bot.chat.message('enabled vanish selfcare')
}
if (args.slice(1).join('') === 'false') {
bot.vanished = false;
bot.chat.message('disabled vanish selfcare')
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
bot.vanished = false;
bot.chat.message('disabling vanish selfcare,...');
bot.chat.command('v off')
}
}
-27
View File
@@ -1,27 +0,0 @@
const CommandError = require('../../util/command_error')
module.exports = {
data: {
name: 'core',
trustLevel: 0,
aliases: [
"cb",
"corerun",
"commandcorerun",
],
description: 'run commands in core!',
usages: [
"<command>",
],
},
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ');
bot.core.run(message);
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
bot.core.run(args.join(' '));
}
}
-81
View File
@@ -1,81 +0,0 @@
const cowsay = require('cowsay2');
const cows = require('cowsay2/cows');
const { EmbedBuilder } = require('discord.js');
const fixansi = require('../../util/ansi');
module.exports = {
data: {
name: 'cowsay',
trustLevel: 0,
aliases: [
],
description: 'cows',
usages: [
"<message>",
"list"
],
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
const source = context.source;
if (args[0]?.toLowerCase() === "list") {
const list = Object.keys(cows);
let content = [];
let color = true;
for (const value of list) {
content.push([
{
text: value + ' ',
color: (!((color = !color)) ? 'blue' : 'dark_blue'),
}
])
}
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, content)
} else if (cows[args[0]]) {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
text: cowsay.say(args.slice(1).join(' '),
{ cow: cows[args[0]] })
})
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: cowsay.say(args.slice(0).join(' ')) })
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
let Embed
if (args[0] === "list") {
const list = Object.keys(cows);
let content = [];
let color = true;
for (const value of list) {
content.push([
{
text: value + ' ',
}
])
}
const ansiList = bot.getMessageAsPrismarine(content)?.toString();
const fixAnsiList = fixansi(ansiList.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.data.name} Command`)
.setDescription(`\`\`\`ansi\n${fixAnsiList}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
} else if (cows[args[0]]) {
const ansiCow1 = bot.getMessageAsPrismarine({ text: cowsay.say(args.slice(1).join(' '), { cow: cows[args[0]] }) })?.toAnsi()
const fixAnsiCow1 = fixansi(ansiCow1.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.data.name} Command`)
.setDescription(`\`\`\`ansi\n${fixAnsiCow1}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
} else {
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${cowsay.say(args.slice(0).join(' '))}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] });
}
}
}
-482
View File
@@ -1,482 +0,0 @@
const CommandError = require('../../util/command_error');
const sleep = require('../../util/sleep.js');
const fixansi = require('../../util/ansi');
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: {
name: 'help',
trustLevel: 0,
aliases: [
"heko",
"?",
"cmds",
"hell",
"hello",
"helo",
"commands",
"commandshelp",
],
description: 'a list of the bots commands',
usages: [
"",
"<command>",
],
},
execute (context) {
const commandList = [];
const bot = context.bot;
const source = context.source;
const args = context.arguments;
const category = {
translate: '(%s%s%s%s%s%s%s) \u203a ',
bold: false,
color: 'gray',
with: [
{ color: "aqua", text: 'Public'},
{ color: "gray", text: ' | '},
{ color: "dark_aqua", text: 'Trusted'},
{ color: 'gray', text: ' | '},
{ color: "blue", text: "Admin" },
{ color: "gray", text: " | " },
{ color: "dark_blue", text: 'Owner'},
]
}
let public = [];
let trusted = [];
let admin = [];
let owner = [];
for (const command of bot.commandManager.commandlist) {
let usagesComponent = [];
let commandComponent = [];
for (const usages of command.data.usages) {
if (command?.data?.trustLevel === 1) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
{ text: `${command.data.name} <trusted/admin/owner hashes>`, color: "blue" },
{ text: `${usages}`, color: "aqua" },
]
})
} else if (command?.data.trustLevel === 2) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
{ text: `${command.data.name} <admin/owner hashes>`, color: "blue" },
{ text: `${usages}`, color: "aqua" },
]
})
} else if (command?.data.trustLevel === 3) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
{ text: `${command.data.name} <owner hash>`, color: "blue" },
{ text: `${usages}`, color: "aqua" },
]
})
} else if (command?.data.trustLevel === 0 || command.data.trustLevel === 4) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
{ text: `${command.data.name}`, color: "blue" },
{ text: `${usages}`, color: "aqua" },
]
})
}
usagesComponent.push('\n');
}
usagesComponent.pop();
commandComponent.push({
translate: "%s %s %s\n%s %s %s\n%s %s %s\n%s %s %s\n%s %s",
color: "dark_gray",
with: [
{ text: "Command Name", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.data.name}`, color: "blue" },
{ text: "Aliases", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.data.aliases.toString().replaceAll(',',' ')}`, color: "blue" },
{ text: "Description", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.data.description}`, color: "blue" },
{ text: "Trust Level", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.data.trustLevel}`, color: "gold" },
{ text: "Usages", color: "dark_blue" },
{ text: "\u203a" }
]
})
commandComponent.push("\n");
commandComponent.push(usagesComponent);
// for (const aliases of command.aliases) {
if (args[0]?.toLowerCase() === command.data.name) {
if (bot.options.isSavage) {
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`);
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, commandComponent)
}
return;
}
/* } if (args[0]?.toLowerCase() === aliases) {
if (bot.options.isSavage) {
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`)
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, commandComponent)
}
return
}
console.log(aliases)*/
// }
// tellraw @p {"text":"this","clickEvent":{"action":"suggest_command","value":"this"}}
if (command.data.trustLevel === 0) {
public.push([
{
text: command.data.name + ' ',
color: "aqua",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: `Command: ${command.data.name}\n`,
color: 'blue'
},
{
text: `Trust Level: `,
color: 'blue'
},
{
text: `${command.data.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.data.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.data.aliases}\n`,
color: 'blue'
},
{
text: 'click on me to use me :)',
color: 'dark_blue',
},
],
},
clickEvent: {
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.data.name}`
}
}
])
} else if (command.data.trustLevel === 1) {
trusted.push([
{
text: command.data.name + ' ',
color: "dark_aqua",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: `Command: ${command.data.name}\n`,
color: 'blue'
},
{
text: `Trust Level: `,
color: 'blue'
},
{
text: `${command.data.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.data.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.data.aliases}\n`,
color: 'blue'
},
{
text: 'click on me to use me :)',
color: 'dark_blue',
},
],
},
clickEvent: {
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.data.name}`
}
}
])
} else if (command.data.trustLevel === 2) {
admin.push([
{
text: command.data.name + ' ',
color: "blue",
translate: "",
hoverEvent: {
action:"show_text",
value: [
{
text: `Command: ${command.data.name}\n`,
color: 'blue'
},
{
text: `Trust Level: `,
color: 'blue'
},
{
text: `${command.data.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.data.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.data.aliases}\n`,
color: 'blue'
},
{
text: 'click on me to use me :)',
color: 'dark_blue',
},
],
},
clickEvent: {
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.data.name}`
}
}
])
} else if (command.data.trustLevel === 3) {
owner.push([
{
text: command.data.name + ' ',
color: "dark_blue",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: `Command: ${command.data.name}\n`,
color: 'blue'
},
{
text: `Trust Level: `,
color: 'blue'
},
{
text: `${command.data.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.data.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.data.aliases}\n`,
color: 'blue'
},
{
text: 'click on me to use me :)',
color: 'dark_blue',
},
],
},
clickEvent: {
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.data.name}`
}
}
])
}
}
const length = bot.commandManager.commandlist.filter(c => c.data.trustLevel != 4).length
if (bot.options.useChat) {
bot.chat.message(bot.getMessageAsPrismarine([
{
text: 'Commands (',
color: 'gray'
},
{
text: length,
color: 'gold'
},
{
text: ') ',
color: 'gray'
},
category,
])?.toMotd().replaceAll('§','&'))
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(public)?.toMotd().replaceAll("§","&"))
}, 300)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
}, 300)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
}, 300)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
}, 300)
} else if (bot.options.isSavage) {
bot.chat.message(bot.getMessageAsPrismarine([
{
text: 'Commands (',
color: 'gray'
},
{
text: length,
color: 'gold'
},
{
text: ') ',
color: 'gray'
},
category,
])?.toMotd().replaceAll('§','&'))
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(public)?.toMotd().replaceAll("§","&"))
}, 400)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
}, 400)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
}, 400)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
}, 400)
} else if (bot.options.isCreayun) {
bot.chat.message(bot.getMessageAsPrismarine([
{
text: 'Commands (',
color: 'gray'
},
{
text: length,
color: 'gold'
},
{
text: ') ',
color: 'gray'
},
category,
])?.toMotd().replaceAll('§','&'))
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(public)?.toMotd().replaceAll("§","&"))
}, 2500)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
}, 2500)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
}, 2500)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
}, 2500)
} else if (admin.length === 0) {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
{ text: 'Commands (', color: 'gray' },
{ text: JSON.stringify(length), color: 'gold' },
{ text: ') ', color: 'gray' },
category,
'\n',
public,
trusted,
owner
])
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
{ text: 'Commands (', color: 'gray' },
{ text: JSON.stringify(length), color: 'gold' },
{ text: ') ', color: 'gray' },
category,
'\n',
public,
trusted,
admin,
owner
])
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const category = {
translate: '(%s%s%s%s%s%s%s) \u203a ',
bold: false,
color: 'gray',
with: [
{ color: "aqua", text: 'Public'},
{ color: "gray", text: ' | '},
{ color: "dark_aqua", text: 'Trusted'},
{ color: 'gray', text: ' | '},
{ color: 'blue', text: 'Admin' },
{ color: 'gray', text: ' | ' },
{ color: "dark_blue", text: 'Owner'},
]
}
let public = [];
let trusted = [];
let admin = [];
let owner = [];
for (const command of bot.commandManager.commandlist) {
if (args[0] === command.data.name) {
const ansi = bot.getMessageAsPrismarine([ { text: `CommandName \u203a ${command.data.name}\n`, color: 'gray', }, { text: `Aliases \u203a ${command.data.aliases}\n`, color: 'gray', }, { text: `Description \u203a ${command.data.description}\n`, color: 'gray', }, { text: `trustLevel \u203a ${command.data.trustLevel}\n`, color: 'gray' }, { text: `Usages \u203a ${command?.data.usages}`, color: "dark_gray" }, ])?.toAnsi().replaceAll('```\u001b[9```' + '```\u001b[3```')
const fix = fixansi(ansi.replaceAll('`', '`\u200b'))
const Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.data.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
return
}
if (command?.data.trustLevel === 0 && command.discordExecute) {
public.push([
{
text: command.data.name + ' ',
color: "aqua",
}
])
} else if (command?.data.trustLevel === 1 && command.discordExecute) {
trusted.push([
{
text: command.data.name + ' ',
color: "dark_aqua"
}
])
} else if (command?.data.trustLevel === 2 && command.discordExecute) {
admin.push([
{
text: command.data.name + ' ',
color: 'blue'
}
])
} else if (command?.data.trustLevel === 3 && command.discordExecute) {
owner.push([
{
text: command.data.name + ' ',
color: "dark_blue",
}
])
}
}
const length = bot.commandManager.commandlist.filter(c => c.data.trustLevel !== 4 && c.discordExecute).length
const ansi1 = bot.getMessageAsPrismarine([ { text: 'Commands (', color: 'gray' }, { text: JSON.stringify(length), color: 'gold' }, { text: ') ', color: 'gray' }, category, '\n', public, trusted, owner ])?.toAnsi();
const fix1 = fixansi(ansi1.replaceAll('`', '`\u200b'))
const Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.data.name} Command`)
.setDescription(`\`\`\`ansi\n${fix1}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
bot?.discord?.message.react('♋')
}
}
-101
View File
@@ -1,101 +0,0 @@
const CommandError = require('../../util/command_error');
const { EmbedBuilder } = require('discord.js');
const fixansi = require('../../util/ansi');
module.exports = {
data: {
name: 'list',
description: 'check the player list',
trustLevel: 0,
aliases: [
'playerlist',
'plist',
'pl'
],
usages: [
""
],
},
execute (context) {
const bot = context.bot
const args = context.arguments
const players = bot.players
const source = context.source
const component = []
for (const player of players) {
component.push({
translate: `%s \u203a %s [%s: %s %s %s: %s]`,
color: 'dark_gray',
with: [
player.displayName ?? player.profile.name,
{
text: `${player.uuid}`,
color: 'dark_blue',
clickEvent: {
action: 'copy_to_clipboard',
value: `${player.uuid}`
},
hoverEvent: {
action: 'show_text',
contents: [{
text: 'click here to copy the player\'s uuid',
color: 'aqua'
}]
}
},
{ text: `Ping`, color: 'dark_blue' },
{ text: `${player.latency}`, color: 'gold' },
{ text: '/', color: 'dark_gray' },
{ text: `Gamemode`, color: 'dark_blue' },
{ text: `${player.gamemode}`, color: 'gold' },
]
})
component.push('\n')
}
component.pop()
if (bot.options.isSavage) {
bot.chat.message(`${bot.getMessageAsPrismarine([{ text: `Players: `, color:'gray' }, { text: '(' , color: 'gray' }, { text: `${JSON.stringify(bot.players.length)}`, color: 'gold' }, { text: ')\n', color: 'gray' }])?.toMotd().replaceAll('§','&')}`)
setTimeout(() => {
for (const player of bot.players) {
bot.chat.message(`${bot.getMessageAsPrismarine([player.displayName ?? player.profile.name, ' &8', player.uuid,` &r&8[&2Ping: &6${player.latency}&8 / &5Gamemode: &6${player.gamemode}&8]`]).toMotd().replaceAll('§', '&')}`)
}
}, 300)
} else if (bot.options.isKaboom) {
bot.tellraw(`@a[name="${source.player.profile.name}"]`, [
{ text: `Players`, color: 'dark_blue' },
{ text: ': ', color: 'dark_gray' },
{ text: '(' , color: 'dark_gray' },
{ text: `${JSON.stringify(bot.players.length)}`, color: 'gold' },
{ text: ')\n', color: 'dark_gray' },
component
])
}
},
discordExecute(context) {
const bot = context.bot
const players = bot.players
const component = []
for (const player of players) {
component.push({
translate: `%s \u203a %s [%s %s %s %s %s]`,
with: [
player.displayName ?? player.profile.name,
player.uuid,
{ text: `Ping:`, color: 'dark_green' },
{ text: `${player.latency}`, color: 'gold' },
{ text: '/', color: 'gray' },
{ text: `Gamemode:`, color: 'dark_purple' },
{ text: `${player.gamemode}`, color: 'gold' },
]
})
component.push('\n')
}
component.pop()
const ansi = bot.getMessageAsPrismarine([{ text: `Players: `, color:'gray' }, { text: '(' , color: 'gray' }, { text: `${JSON.stringify(bot.players.length)}`, color: 'gold' }, { text: ')\n', color: 'gray' }, component])?.toAnsi()
const fix = fixansi(ansi.replaceAll('`', '`\u200b').substring(0, 3080))
const Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.data.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
}
}
-60
View File
@@ -1,60 +0,0 @@
const { request } = require('undici');
const CommandError = require('../../util/command_error.js');
const mc = require('minecraft-protocol');
const util = require('util')
module.exports = {
data: {
name: 'mcserver',
trustLevel: 0,
aliases: [
"pingserver",
"pingsrv",
],
description: 'look up minecraft server info',
usages: [
"<minecraft server ip>",
],
},
async execute (context) {
const bot = context.bot;
const discordClient = context.discordClient;
const args = context.arguments;
const source = context.source;
let component = [];
try {
const [host, port] = args[0].split(':')
const server = await mc.ping({ host, port: Number(port ?? 25565) })
component.push({
translate: '%s %s %s:%s\n%s %s %s / %s\n%s %s %s\n%s %s %s',
color: 'dark_gray',
with: [
{ text: 'Ip', color: 'dark_blue' },
{ text: '\u203a' },
{ text: `${host}`, color: 'dark_blue' },
{ text: `${Number(port ?? 25565)}`, color: 'gold' },
{ text: 'Players', color: 'dark_blue' },
{ text: '\u203a' },
{ text: `${server.players.online}`, color: 'gold' },
{ text: `${server.players.max}`, color: 'gold' },
{ text: 'Version', color: 'dark_blue' },
{ text: '\u203a' },
{ text: `${server.version.name}`, color: 'blue' },
{ text: 'Motd', color: 'dark_blue' },
{ text: '\u203a' },
server.description
]
})
if (bot.options.isSavage) {
bot.chat.message(`Ip \u203a ${host}:${Number(port ?? 25565)}`);
bot.chat.message(`Players \u203a ${server.players.online} / ${server.players.max}`);
bot.chat.message(`Version \u203a ${server.version.name}`);
bot.chat.message(bot.getMessageAsPrismarine(server.description)?.toMotd().replaceAll('§','&'));
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component);
}
} catch (e) {
bot.chat.message(`${e.toString()}`)
}
}
}
-32
View File
@@ -1,32 +0,0 @@
module.exports = {
data: {
name: 'memusage',
trustLevel: 0,
aliases: [
],
description: 'check the bots and the servers ram usage',
usages: [
"on/enable/true",
"off/disable/false",
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;
switch (args[0]?.toLowerCase()) {
case "on":
case "enable":
case "true":
bot.memUsage.enabled = true;
bot.chat.message('enabled memusage');
break;
case "off":
case "enable":
case "false":
bot.memUsage.enabled = false;
bot.chat.message('disabled memusage');
break;
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
}
},
}
-84
View File
@@ -1,84 +0,0 @@
const CommandError = require('../../util/command_error.js')
module.exports = {
data: {
name: 'netmsg',
trustLevel: 0,
aliases: [
],
description: 'netmsg to other servers',
usages: [
"<message>"
],
},
execute (context) {
const args = context.arguments;
const bot = context.bot;
const source = context.source;
const config = context.config;
if (bot.options.private) {
component = {
translate: '[%s] %s \u203a %s',
color: "dark_gray",
with: [
{ text: bot.options.serverName, color: "blue" },
source.player.displayName ?? source.player.profile.name,
{ text: args.join(' '), color: "blue" },
]
}
} else if (!bot.options.private) {
component = {
translate: '[%s:%s] %s \u203a %s',
color: "dark_gray",
with: [
{ text: bot.options.host, color: "blue" },
{ text: `${bot.options.port}`, color: "gold" },
source.player.displayName ?? source.player.profile.name,
{ text: args.join(' '), color: "blue" },
]
}
}
bot.bots.filter((eachBot) => {
if (!eachBot.options.isKaboom || eachBot.options.useChat) {
eachBot.chat.message(`${bot.getMessageAsPrismarine(component)?.toMotd().replaceAll('§','&')}`);
} else if (eachBot.options.isKaboom && !eachBot.options.useChat) {
eachBot.tellraw("@a", component);
}
})
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const source = context.source;
if (bot.options.private) {
component = {
translate: '[%s] %s \u203a %s',
color: "dark_gray",
with: [
{ text: bot.options.serverName, color: "blue" },
source.player.displayName ?? source.player.profile.name,
{ text: args.join(' '), color: "blue" },
]
}
} else if (!bot.options.private) {
component = {
translate: '[%s:%s] %s \u203a %s',
color: "dark_gray",
with: [
{ text: bot.options.host, color: "blue" },
{ text: `${bot.options.port}`, color: "gold" },
source.player.displayName ?? source.player.profile.name,
{ text: args.join(' '), color: "blue" },
]
}
}
bot.bots.filter((eachBot) => {
if (!eachBot.options.isKaboom || eachBot.options.useChat) {
eachBot.chat.message(`${bot.getMessageAsPrismarine(component)?.toMotd().replaceAll('§','&')}`);
} else if (eachBot.options.isKaboom && !eachBot.options.useChat) {
eachBot.tellraw("@a", component);
}
})
}
}
-46
View File
@@ -1,46 +0,0 @@
const CommandError = require('../../util/command_error');
module.exports = {
data: {
name: 'test',
trustLevel: 0,
aliases: [
],
description: 'Make me say something',
usages: [
"error stack <message>",
"error message <message>",
"message <message>"
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;
if (!args && !args[0] && !args[1]) return
switch (args[0]) {
case 'error':
switch (args[1]) {
case 'stack':
throw new Error(args.slice(2).join(' '));
break
case 'message':
throw new CommandError(args.slice(2).join(' '));
break
}
break;
case "message":
bot.tellraw("@a", [
{
text: `Hello, World!, Player: ${bot.getMessageAsPrismarine(context.source.player.displayName ?? context.source.player.profile.name)?.toMotd()}§r`,
color: 'gray',
bold: false
},
{
text: ` Args: ${args.slice(1).join(' ')}`,
color: 'gray',
bold: false,
}
])
break;
}
}
}
-88
View File
@@ -1,88 +0,0 @@
const CommandError = require('../../util/command_error')
const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, SlashCommandBuilder } = require('discord.js');
const { request } = require('undici');
module.exports = {
data: {
name: 'urban',
description: 'urban dictionary',
aliases: [
'urbandictionary'
],
trustLevel: 0,
usages: [
"<definition>",
],
},
async execute (context) {
const source = context.source
const args = context.arguments
const bot = context.bot
const prefix = [
{ text: '[', color: 'dark_gray' },
{ text: 'Urban', color: '#B72A00' },
{ text: '] ', color: 'dark_gray'}
]
let component = [];
let term = `${args.join(' ')}`
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' });
}
for (definitions of list) {
component.push(prefix, [
{
text: `${definitions.definition.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray',
underlined: false,
italic: false,
translate:"",
hoverEvent: {
action:"show_text",
value: [
{
text: `Example \u203a \n ${definitions.example.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray'
},
{
text: `Word \u203a ${definitions.word.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray',
},
{
text: `Author \u203a ${definitions.author.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray'
},
{
text: `written on \u203a ${definitions.written_on.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray'
},
{
text: `Rating \u203a Thumbs-Up ${definitions.thumbs_up} / Thumbs-Down ${definitions.thumbs_down}`,
color: 'gray'
}
]
},
clickEvent: {
action: 'open_url',
value: `${definitions.permalink}`
}
},
])
}
if (bot.options.useChat) {
for (const definitions of list) {
bot.chat.message(bot.getMessageAsPrismarine({ text: `${definitions.example.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`})?.toMotd().replaceAll("§","&"));
// bot.chat.message(definitions.example.replaceAll("\r", ""));
}
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)
}
},
async discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const component = [];
}
}
-170
View File
@@ -1,170 +0,0 @@
const CommandError = require('../../util/command_error');
const { request } = require('undici');
module.exports = {
data: {
name: 'weather',
trustLevel: 0,
aliases: [
],
description: 'check the weather of cities',
usages: [
"<city/zipcode>"
],
},
async execute (context) {
const bot = context.bot
const args = context.arguments;
const config = context.config;
const source = context.source;
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
try {
let component;
const weather = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ').replaceAll(' ','&')}`);
const info = await weather.body.json();
component = new MessageBuilder()
.setTranslate("%s\n%s\n%s: %s (%s)\n%s\n%s\n%s: %s\n%s: %s")
.setColor(config.colors.commands.tertiary)
.addWith(new MessageBuilder()
.setTranslate("%s: %s, %s %s")
.setColor(config.colors.commands.tertiary)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.primary)
.setText("Location")
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText(info.location.name)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText(info.location.region)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText(info.location.country)
)
)
.addWith(new MessageBuilder()
.setTranslate("%s: %s, %s")
.setColor(config.colors.commands.tertiary)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.primary)
.setText("Coords")
)
.addWith(new MessageBuilder()
.setColor(config.colors.integer)
.setText(`${info.location.lat}`)
)
.addWith(new MessageBuilder()
.setColor(config.colors.integer)
.setText(`${info.location.lon}`)
)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.primary)
.setText("Time")
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText(`${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id, })}`)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText(`${info.location.tz_id}`)
)
.addWith(new MessageBuilder()
.setTranslate("%s: %s (%s), %s (%s)")
.setColor(config.colors.commands.tertiary)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.primary)
.setText("Temp")
)
.addWith(new MessageBuilder()
.setColor(config.colors.integer)
.setText(`${Math.floor(info.current.temp_c)}`)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText("\u00b0C")
)
.addWith(new MessageBuilder()
.setColor(config.colors.integer)
.setText(`${Math.floor(info.current.temp_f)}`)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText("\u00b0F")
)
)
.addWith(new MessageBuilder()
.setTranslate("%s: %s (%s, %s), %s (%s, %s)")
.setColor(config.colors.commands.tertiary)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.primary)
.setText("Wind Speed")
)
.addWith(new MessageBuilder()
.setColor(config.colors.integer)
.setText(`${Math.floor(info.current.wind_kph)}`)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText("kph")
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText(info.current.wind_dir)
)
.addWith(new MessageBuilder()
.setColor(config.colors.integer)
.setText(`${Math.floor(info.current.wind_mph)}`)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText("mph")
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText(info.current.wind_dir)
)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.primary)
.setText("Condition")
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText(info.current.condition.text)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.primary)
.setText("Humidity")
)
.addWith(new MessageBuilder()
.setColor(config.colors.integer)
.setText(`${Math.floor(info.current.humidity)}`)
)
if (bot.options.isSavage) {
bot.chat.message(`Location: ${info.location.name}, ${info.location.region}, ${info.location.country}`);
bot.chat.message(`Latitude: ${info.location.lat}`);
bot.chat.message(`Longitude: ${info.location.lon}`);
bot.chat.message(`Time: ${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id, })}(${info.location.tz_id})`);
bot.chat.message(`Temp: ${info.current.temp_c}(\u00b0C), ${info.current.temp_f}(\u00b0F)`);
bot.chat.message(`Wind speed: ${info.current.wind_kph}(KPH), ${info.current.wind_mph}(MPH)`);
bot.chat.message(`Condition: ${info.current.condition.text}`);
bot.chat.message(`Humidity: ${info.current.humidity}`);
} else {
bot.tellraw("@a", component);
}
} catch (e) {
if (e.toString() === "TypeError: Cannot read properties of undefined (reading 'name')" && args.length !== 0) {
bot.chat.message('The location is invalid please try a valid location');
} else if (args.length === 0) {
bot.chat.message('there were no arguments detected')
} else {
bot.chat.message(`${e.toString()}`);
console.warn(e.stack);
}
}
}
}
-39
View File
@@ -1,39 +0,0 @@
const wiki = require('wikipedia');
const CommandError = require('../../util/command_error');
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: {
name: 'wiki',
description: 'wikipedia',
trustLevel: 0,
aliases: [
'wikipedia'
],
usages:[
"<article>"
],
},
async execute (context) {
const source = context.source;
const args = context.arguments;
const bot = context.bot;
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
try {
const page = await wiki.page(args.join(' '))
const summary = await page.intro();
bot.tellraw("@a", new MessageBuilder()
.setText(summary)
.setColor("gray")
)
} catch (error) {
if (error.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')") {
bot.tellraw("@a", new MessageBuilder()
.setText("Article not found!")
.setColor("red")
)
} else {
bot.tellraw(`@a`, `${error.toString()}`)
}
}
}
}
-161
View File
@@ -1,161 +0,0 @@
const { EmbedBuilder } = require('discord.js');
const CommandError = require('../../util/command_error');
module.exports = {
data: {
name: 'cloop',
trustLevel: 1,
aliases: [
"commandloop"
],
description: 'run cloops',
usages: [
"add <interval> <command>",
"remove <index>",
"clear",
"list",
],
},
execute (context) {
const args = context.arguments
const bot = context.bot
const source = context.source
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
switch (args[1]) {
case 'add':
if (isNaN(args[2])) throw new CommandError({ text: 'Invalid interval', color: 'red' })
//bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid interval', color: 'red' })
const interval = parseInt(args[2])
const command = args.slice(3).join(' ');
bot.cloop.add(command, interval)
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
translate: 'Added \'%s\' with interval %s to the cloops',
color: 'gray',
with: [ command, { text: `${interval}`, color: 'gold' } ]
})
break
case 'remove':
if (parseInt(args[2]) === NaN) bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid index', color: 'red' })
const index = parseInt(args[2])
bot.cloop.remove(index)
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
translate: 'Removed cloop %s',
color: 'gray',
with: [ { text: `${index}`, color: 'gold' } ]
})
break
case 'clear':
bot.cloop.clear()
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Cleared all cloops' })
break
case 'list':
const component = []
const listComponent = []
let i = 0
for (const cloop of bot.cloop.list) {
listComponent.push({
translate: '%s \u203a %s (%s)',
color: 'gray',
with: [
{ text: `${i}`, color: 'gold' },
cloop.command,
{ text: `${cloop.interval}`, color: 'gold'},
]
})
listComponent.push('\n')
i++
}
listComponent.pop()
component.push({
translate: 'Cloops (%s):',
with: [ { text: `${bot.cloop.list.length}`, color: 'gold' } ]
})
component.push('\n')
component.push(listComponent)
if (bot.cloop.list.length === 0) {
bot.tellraw(`@a[name="${source?.player.profile?.name}"]`, {
translate: 'Cloops (%s):',
color: 'gray',
with: [ { text: `${bot.cloop.list.length}`, color: 'gold' } ]
})
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)
}
break
default:
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid action', color: 'red' })
break
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
let Embed;
switch (args[0]) {
case "add":
const interval = parseInt(args[1])
const command = args.slice(2).join(' ')
bot.cloop.add(command, interval)
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`Added ${command} with the interval ${interval} to the cloops`)
bot?.discord?.message?.reply({ embeds: [Embed] })
break;
case "remove":
var index = (args[1])
if (parseInt(args[1]) === NaN) throw new CommandError("invalid index");
bot.cloop.remove(index)
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`removed cloop ${index}`)
bot?.discord?.message?.reply({ embeds: [Embed] })
break
case 'clear':
bot.cloop.clear()
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`cleared cloops`)
bot?.discord?.message?.reply({ embeds: [Embed] })
break
case 'list':
const component = []
const listComponent = []
let i = 0
for (const cloop of bot.cloop.list) {
listComponent.push({
translate: '%s \u203a %s (%s)',
with: [
`id ${i}`,
cloop.command,
cloop.interval
]
})
listComponent.push('\n')
i++
}
listComponent.pop()
component.push({
translate: 'Cloops (%s):',
with: [ bot.cloop.list.length ]
})
component.push('\n')
component.push(listComponent)
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(bot.getMessageAsPrismarine(component)?.toString())
bot?.discord?.message?.reply({ embeds: [Embed] })
break
}
}
}
-47
View File
@@ -1,47 +0,0 @@
const CommandError = require('../../util/command_error');
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: {
name: 'kick',
trustLevel: 1,
aliases: [
],
description: 'kick or crash players',
usages: [
"invalidstring <player>",
"item <player>"
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
if (bot.options.useChat || bot.options.isSavage || bot.options.isCreayun) throw new CommandError('Cannot execute command due to smth in the config being enabled');
switch (args[1]) {
case 'invalidstring':
bot.exploits.crashes.invalidString(`${args.slice(2).join(' ')}`);
break
case 'item':
bot.exploits.kicks.item(`${args.slice(2).join(' ')}`)
break
default:
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
if (bot.options.useChat || bot.options.isSavage || bot.options.isCreayun) throw new CommandError('Cannot execute command!');
switch (args[0]) {
case "invalidstring":
bot.exploits.crashes.invalidString(`${args.slice(1).join(' ')}`)
break
case 'item':
bot.exploits.kicks.item(`${args.slice(1).join(' ')}`)
break
default:
throw new CommandError('Invalid argument');
}
}
}
-23
View File
@@ -1,23 +0,0 @@
module.exports = {
data: {
name: 'reconnect',
trustLevel: 1,
aliases: [
"end",
"recon",
],
description: 'reconnect the bot',
usages: [
],
},
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ')
bot._client.end("disconnect :3")
},
discordExecute (context) {
const bot = context.bot;
bot._client.end("disconnect :3")
}
}
-60
View File
@@ -1,60 +0,0 @@
const between = require('../../util/between')
const CommandError = require('../../util/command_error')
module.exports = {
data: {
name: 'tpr',
description: 'teleport to very fucked up coords',
trustLevel: 1,
aliases: [
'rtp',
'teleportrandom',
'randomteleport'
],
usages: [
""
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;
const source = context.source
if (bot.options.isKaboom) {
x = between(-30_000_000, 30_000_000)
y = 100
z = between(-30_000_000, 30_000_000)
} else if (bot.options.isSavage) {
x = between(-4096, 4096);
y = 100
z = between(-4096, 4096);
}
if (args.slice(1).join(' ')) {
bot.tellraw("@a", [
{ text: 'Randomly Teleported: ', color: 'gray' },
{ text: args.slice(1).join(' '), color: 'blue' },
{ text: ' to ', color: 'gray' },
{ text: `${x} `, color: 'gold' },
{ text: `${y} `, color: 'gold' },
{ text: `${z}`, color: 'gold' }
])
if (bot.options.isSavage) {
bot.chat.command(`minecraft:tp ${args.slice(1).join(' ')} ${x} ${y} ${z}`)
} else if (bot.options.isKaboom) {
bot.core.run(`minecraft:tp ${args.slice(1).join(' ')} ${x} ${y} ${z}`);
}
} else {
bot.tellraw("@a", [
{ text: 'Randomly Teleported: ', color: 'gray' },
{ text: source.player.profile.name, color: 'blue' },
{ text: ' to ', color: 'gray' },
{ text: `${x} `, color: 'gold' },
{ text: `${y} `, color: 'gold' },
{ text: `${z}`, color: 'gold' }
])
if (bot.options.isSavage) {
bot.chat.command(`minecraft:tp ${source.player.profile.name} ${x} ${y} ${z}`)
} else if (bot.options.isKaboom) {
bot.core.run(`minecraft:tp ${source.player.profile.name} ${x} ${y} ${z}`);
}
}
}
}
-108
View File
@@ -1,108 +0,0 @@
const http = require('http');
const https = require('https');
const util = require('util');
const fixansi = require('../../util/ansi');
const CommandError = require('../../util/command_error')
module.exports = {
data: {
name: 'website',
trustLevel: 1,
aliases: [
],
description: 'look up website data',
usages: [
"<url>"
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;
if (args.slice(1).join(' ').toLowerCase().startsWith("http://")) {
http.get(args.slice(1).join(' '), (res) => {
const { statusCode } = res;
const contentType = res.headers['content-type'];
res.setEncoding('utf8');
let rawData = '';
res.on('data', (chunk) => { rawData += chunk; });
res.on('end', () => {
try {
bot.tellraw("@a", { text: util.inspect(rawData.toString().substring(0, 32750)), color: "dark_green" })
} catch (e) {
bot.tellraw("@a", e.toString());
}
});
}).on('error', (e) => {
bot.chat.message(`&4${e.toString()}`);
});
} else {
https.get(args.slice(1).join(' '), (res) => {
res.on('data', (d) => {
bot.tellraw("@a", { text: util.inspect(d.toString().substring(0, 32750)), color: "dark_green", })
// console.log(Object.keys(d.toString().length));
});
}).on('error', (e) => {
bot.chat.message(`&4${e.toString()}`);
});
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
let Embed;
let fix;
let ansi;
//bot.discord.message.reply('e');
if (args.join(' ').toLowerCase().startsWith("http://")) {
http.get(args.join(' '), (res) => {
const { statusCode } = res;
const contentType = res.headers['content-type'];
res.setEncoding('utf8');
let rawData = '';
res.on('data', (chunk) => { rawData += chunk; });
res.on('end', () => {
// try {
// bot.tellraw("@a", { text: util.inspect(rawData), color: "dark_green" })
ansi = bot.getMessageAsPrismarine({ text: util.inspect(rawData.toString()), color: 'dark_green'})?.toAnsi()
fix = fixansi(ansi.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.data.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
// } catch (e) {
// bot.tellraw("@a", e.toString());
//throw new CommandError(e.toString())
// }
});
}).on('error', (e) => {
//bot.chat.message(`&4${e.toString()}`);
});
} else {
https.get(args.join(' '), (res) => {
res.on('data', (d) => {
// bot.tellraw("@a", { text: util.inspect(d.toString()), color: "dark_green", })
// console.log(Object.keys(d.toString().length));
ansi = bot.getMessageAsPrismarine({ text: util.inspect(d.toString()), color: 'dark_green'})?.toAnsi()
fix = fixansi(ansi.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.datta.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
// bot.discord.message.reply('e');
});
}).on('error', (e) => {
//bot.chat.message(`&4${e.toString()}`);
//throw new CommandError(e.toString())
});
/*
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${fix1}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
*/
}
}
}
+155
View File
@@ -0,0 +1,155 @@
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":
if (bot.filter.list().find((e) => e.name === args[2])) throw new CommandError('this player is already in the filter!');
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()) {
if (players.regex) {
if (players.ignorecase) {
filterList.push({
translate: "%s: %s (%s %s)",
color: config.colors.commands.tertiary,
with: [
{ text: `${index}`, color: config.colors.integer },
{ text: `${players.name}`, color: config.colors.commands.primary },
{ text: "regexed", color: config.colors.commands.primary },
{ text: "ignorecased", color: config.colors.commands.primary },
]
});
} else {
filterList.push({
translate: "%s: %s (%s)",
color: config.colors.commands.tertiary,
with: [
{ text: `${index}`, color: config.colors.integer },
{ text: `${players.name}`, color: config.colors.commands.primary },
{ text: "regexed", color: config.colors.commands.primary },
]
});
}
} else if (players.ignorecase) {
filterList.push({
translate: "%s: %s (%s)",
color: config.colors.commands.tertiary,
with: [
{ text: `${index}`, color: config.colors.integer },
{ text: `${players.name}`, color: config.colors.commands.primary },
{ text: "ignorecase", color: config.colors.commands.primary },
]
});
} else {
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 the index ${args[2]} from the filter`);
break;
case "-ignorecase":
switch (args[2]) {
case "-regex":
switch (args[3]) {
case "add":
if (bot.filter.list().find((e) => e.name === args[4])) throw new CommandError('this player is already in the filter!');
bot.filter.add(`${args[4]}`, true, true);
bot.chat.message(`added ${args[4]} to the filter`);
break;
}
break;
case "add":
if (bot.filter.list().find((e) => e.name === args[3])) throw new CommandError('this player is already in the filter!');
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":
if (bot.filter.list().find((e) => e.name === args[3])) throw new CommandError('this player is already in the filter!');
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,
},
+1 -1
View File
@@ -4,7 +4,7 @@ module.exports = {
trustLevel: 4,
description: "runs commands made for the bots console",
aliases: [
"c"
],
usages: [
'server/srv <all/servername>',
+3 -1
View File
@@ -25,7 +25,9 @@ module.exports = {
if (source.sources.console) {
bot.console.log(bot.getMessageAsPrismarine({ text: util.inspect(eval(args.join(' ')), { stylize })})?.toAnsi())
} else if (bot.options.mode === "savageFriends") {
bot.chat.message(bot.getMessageAsPrismarine({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })?.toMotd().replaceAll('§','&'))
bot.core.run(`minecraft:tellraw @a ${JSON.stringify(util.inspect(eval(script), { stylize }).substring(0, 32700))}`)
// bot.tellraw('@a', `${util.inspect(eval(script), { stylize }).substring(0, 32700)}`);
// bot.chat.message(bot.getMessageAsPrismarine({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })?.toMotd().replaceAll('§','&'))
} else {
bot.tellraw(`@a[name="${source.player.profile.name}"]`, {
text: `${util.inspect(eval(script), { stylize }).substring(0, 32700)}`
+16 -4
View File
@@ -6,18 +6,30 @@ module.exports = {
"cbrun",
"corerun"
],
trustLevel: 0
trustLevel: 0,
description: "run commands in core",
usages: [
"<message>"
]
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
bot.core.run(args.join(' '));
if (bot.options.mode === "savageFriends") {
bot.core.run(args.join(' '));
} else if (bot.options.mode === "kaboom") {
bot.core.runTracked(args.join(' '));
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
bot.core.run(args.join(' '));
if (bot.options.mode === "savageFriends") {
bot.core.run(args.join(' '));
} else if (bot.options.mode === "kaboom") {
bot.core.runTracked(args.join(' '));
}
}
}
}
+5 -2
View File
@@ -19,7 +19,10 @@ module.exports = {
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
bot.discord.message.channel.send(args.join(' '));
// bot.chat.send(args.join(' '));
if (args.includes("@everyone") || args.includes("@here")) {
bot.discord.message.reply("go fuck yourself");
} else {
bot.discord.message.channel.send(args.join(' '));
}
}
}
+142 -7
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 = [];
@@ -120,7 +253,10 @@ module.exports = {
component.push(trusted);
component.push(admin);
component.push(owner);
component.push(Console);
if (source.sources.console) {
component.push(Console);
}
bot.tellraw("@a", component);
},
discordExecute (context) {
@@ -160,7 +296,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 -5
View File
@@ -377,11 +377,7 @@ module.exports = {
componentPush(bot, args, config, discordClient, source, component);
if (bot.options.mode === "savageFriends") {
bot.chat.message(bot.getMessageAsPrismarine(component)?.toMotd().replaceAll('§','&'));
} else {
bot.tellraw(`@a`, component);
}
bot.tellraw(`@a`, component);
},
discordExecute (context) {
const bot = context.bot;
+1 -1
View File
@@ -10,7 +10,7 @@ module.exports = {
description: "check whos online on the server",
trustLevel: 0,
usages: [
""
]
},
execute (context) {
+69
View File
@@ -0,0 +1,69 @@
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",
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 {
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()}`);
}
}
}
+7 -7
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) {
@@ -25,7 +25,7 @@ module.exports = {
color: config.colors.commands.tertiary,
with: [
{ text: `${bot.options.serverName}`, color: config.colors.commands.primary },
source.player.displayName ?? source.player.profile.name,
source?.player?.displayName ?? source?.player?.profile?.name,
{ text: `${args.join(' ')}`, color: config.colors.commands.secondary }
]
})
@@ -43,11 +43,11 @@ module.exports = {
}
for (const eachBot of bot.bots) {
if (eachBot.options.mode === "savageFriends" || eachBot.options.mode === "creayun") {
/* if (eachBot.options.mode === "savageFriends" || eachBot.options.mode === "creayun") {
eachBot.chat.message(`${bot.getMessageAsPrismarine(component)?.toMotd()?.replaceAll('§','&')}`)
} else {
} else {*/
eachBot.tellraw("@a", component)
}
// }
}
}
}
}
-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()}`);
}
}
}
+11 -3
View File
@@ -8,20 +8,28 @@ module.exports = {
],
description: 'refill the bots core',
usages: [
""
],
},
execute (context) {
const bot = context.bot;
const config = context.config;
bot.core.move();
if (bot.options.mode === "savageFriends") {
bot.core.chatRefill();
} else {
bot.core.move();
}
bot.tellraw("@a", "Refilling core,...")
},
discordExecute (context) {
const bot = context.bot;
const config = context.config;
bot.core.move();
if (bot.options.mode === "savageFriends") {
bot.core.chatRefill();
} else {
bot.core.move();
}
bot.tellraw("@a", "Refilling core,...");
}
}
+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[name="${source?.player?.profile?.name}"]`, 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')
}
}
}
}
+7 -32
View File
@@ -30,34 +30,6 @@ core:
y: 0
z: 15
team:
name: "FNFBoyfriendBot"
suffix: {
color: "dark_gray",
translate: " [ %s ]",
with: [
{ color: "dark_red", text: "https://sus.red" }
]
}
# make sure if nothing is set as the suffix it is set as { text: "" } as the packet reads "" as { text: "" }
prefix: {
color: "dark_gray",
translate: "[%s: %s] ",
with: [
{ color: "aqua", text: "Prefix" },
{ color: "dark_aqua", text: "!" }
]
}
displayName: {
translate: "%s%s%s",
with: [
{ color: "dark_blue", text: "FNF" },
{ color: "dark_aqua", text: "Boyfriend" },
{ color: "blue", text: "Bot" }
]
}
# color HAS to come first before any components or it will break! dont ask why, its because of how nmp parses it
keys:
trusted: "trusted key here"
admin: "admin key here"
@@ -90,6 +62,12 @@ logsFolder:
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
@@ -99,8 +77,5 @@ bots:
reconnectDelay: 6000
channelId: "discord channel id here"
logging: false
useChat: false
isKaboom: true
isSavage: false
isCreayun: false
mode: "kaboom"
+2 -2
View File
@@ -1,8 +1,8 @@
{
"buildstring": {
"build": "2055",
"build": "2150",
"codename": "",
"version": "v7.0.1",
"version": "v7.0.4",
"url":"https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot"
}
}
+2 -3
View File
@@ -9,8 +9,6 @@ const discordClient = new Client({ intents: [Guilds, GuildMessages, MessageConte
const CommandSource = require('./util/command_source');
console.log('Starting FNFBoyfriendBot');
process.stdout.write('\x1b]2;Starting FNFBoyfriendBot please wait,.....\x1b\x5c');
if (fs.existsSync(path.join(__dirname, "../config.yml")) === false) {
console.warn("Config not found creating config from the default config");
@@ -32,6 +30,7 @@ const rl = readline.createInterface({
})
if (config.discord.enabled) discordClient.login(config.discord.token);
const bots = [];
let bot;
@@ -59,7 +58,7 @@ discordClient.on('messageCreate', (message) => {
}
}, {
discord: true,
console: false
console: false,
}, false, message);
bot.commandManager.executeString(source, message.content.substring(prefix.length));
+1 -5
View File
@@ -8,7 +8,7 @@ function inject (context) {
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');
bot.chat.message(`&9FNF&3Boyfriend&1Bot &b${info.buildstring.version} &fcreated by &4Parker&02991`);
}
})
@@ -16,10 +16,6 @@ function inject (context) {
bot.chat.message('Killing bot.....');
process.exit(5);
});
setInterval(() => {
process.stdout.write(`\x1b]2; FNFBoyfriendBot | Time: ${new Date().toLocaleString("en-US",{timeZone: "America/CHICAGO"})} | \x1b\x5c`)
}, 1000)
}
module.exports = {
+3 -27
View File
@@ -5,6 +5,7 @@ const CreayunChatParser = require('../util/ChatParsers/Creayun');
const sayConsoleChatParser = require('../util/ChatParsers/sayConsole');
const VanillaChatParser = require("../util/ChatParsers/VanillaChat");
const yfdCustomChatParser = require('../util/ChatParsers/yfdCustomChat');
function tryParse (json) {
try {
return JSON.parse(json)
@@ -21,7 +22,7 @@ function inject (context) {
bot.on('registry_ready', registry => {
ChatMessage = loadPrismarineChat(registry)
})
if (options.isSavage || options.isCreayun) {
if (options.mode === "savageFriends" || options.mode === "creayun") {
bot.chatParsers = [CreayunChatParser, sayConsoleChatParser]
} else {
bot.chatParsers = [KaboomChatParser, ChipmunkModChatParser, VanillaChatParser, sayConsoleChatParser, yfdCustomChatParser]
@@ -313,7 +314,7 @@ function inject (context) {
return
}
if (message.translate === "advMode.notAllowed") return;
if (message.translate === "advMode.notAllowed" || message?.translate?.startsWith("قيادة المجموعة")) return;
if (config?.debug?.chat?.system?.packetType === true) {
bot.emit('message', {
@@ -337,31 +338,6 @@ function inject (context) {
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) {
+97 -24
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;
@@ -24,17 +24,14 @@ function inject (context) {
const { start, end } = bot.core.area
if (!pos) return
if (bot.options.mode === "creayun" || bot.options.mode === "savageFriends") return;
if (isNaN(pos.x + start.x)) {
bot.chat.command('spawn');
return
if (bot.options.mode === "creayun") return;
if (bot.options.mode === "savageFriends") {
command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} command_block`
} else {
command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'} destroy`
}
/*^^^
for checking is the core pos is null and if so
it will not refill core until the pos is not NaN
instead of tping to a set cords cuz fuck you im not doing that
*/
const command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'} destroy`
bot.chat.command(`${command}`)
},
@@ -44,11 +41,6 @@ function inject (context) {
const itemPosition = bot.core.itemPosition;
if (!pos) return;
if (bot.options.mode === "creayun" || bot.options.mode === "savageFriends") return;
if (isNaN(pos.x + pos.x)) {
bot.chat.command('spawn');
return
}
const command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'} destroy`
@@ -76,9 +68,9 @@ function inject (context) {
hand: 0,
location: itemPosition,
direction: 0,
cursorX: 0.1,
cursorX: 0,
cursorY: 0,
cursorZ: 0.1,
cursorZ: 0,
insideBlock: false
});
@@ -102,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 === true) {
if (config.core.itemRefill && bot.options.mode !== "savageFriends") {
bot.core.itemRefill();
} else {
bot.core.chatRefill();
@@ -149,8 +141,17 @@ function inject (context) {
const itemPosition = bot.core.itemPosition;
if (!location) return;
if (bot.options.mode === "creayun" || bot.options.mode === "savageFriends") {
return
if (bot.options.mode === "creayun") {
return;
} else if (bot.options.mode === "savageFriends") {
bot._client.write('update_command_block', {
command: command.substring(0, 32767),
location: location,
mode: 2,
flags: 0b101,
});
bot.core.incrementCurrentBlock();
} else {
if (bot.core.usePlacedCommandBlock) {
bot._client.write('update_command_block', {
@@ -173,6 +174,78 @@ function inject (context) {
}
}
},
async runTracked (command) {
const location = bot.core.itemPosition;
let transactionId = Math.floor(Math.random() * 10000);
bot._client.write('set_creative_slot', {
slot: 36,
item: {
present: true,
itemId: mcData.itemsByName.repeating_command_block.id,
itemCount: 1,
nbtData: nbt.comp({
BlockEntityTag: nbt.comp({
CustomName: nbt.string(JSON.stringify(config.core.itemName))
})
})
}
});
bot._client.write('block_dig', {
status: 0,
location: {
x: location.x,
y: location.y - 1,
z: location.z
},
face: 0
});
bot._client.write('block_place', {
hand: 0,
location,
direction: 0,
cursorX: 0,
cursorY: 0,
cursorZ: 0,
insideBlock: false
});
bot._client.write('update_command_block', {
command: command.substring(0, 32767),
location: {
x: location.x,
y: location.y,
z: location.z
},
flags: 0b101,
mode: 1
});
await sleep(100);
bot._client.write('query_block_nbt', { location, transactionId });
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).extra);
bot.tellraw(`@a[name="${bot.options.username}"]`, {
translate: "fnfboyfriendbot_command_block_output",
extra: [
JSON.parse(data.nbt.value.LastOutput.value).extra
]
});
}
}
} catch (e) {
console.log(e.stack)
}
});
}
}
require('../util/core_util')(bot, config, options);
+3 -1
View File
@@ -11,6 +11,8 @@ function inject (context) {
const prefixes = config.prefixes;
prefixes.map((prefix) => {
const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString();
// console.log(plainMessage);
if (!plainMessage.startsWith(prefix)) return
const command = plainMessage.substring(prefix.length)
const source = new CommandSource(data.sender, { discord: false, console: false }, true)
@@ -19,7 +21,7 @@ function inject (context) {
ratelimit--
}, 1000)
if (ratelimit > 2) {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'You are using commands too fast!', color: 'dark_red'})
bot.tellraw('@a', { text: 'You are using commands too fast!', color: 'dark_red'})
} else if (command.split(" ")[0].length === 0) {
} else {
bot.commandManager.executeString(source, command)
+17 -5
View File
@@ -5,6 +5,7 @@ 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');
async function inject (context) {
const bot = context.bot;
@@ -48,11 +49,11 @@ async function inject (context) {
return command?.execute({ bot, source, arguments: args, config, discordClient });
} catch (error) {
console.error(error);
// console.error(error);
if (error instanceof CommandError) {
if (options.mode !== "kaboom") {
bot.chat.message(`&4${error._message}`);
bot.chat.message(`&4${bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&')}`);
} else {
if (error.toString().length > 256) {
bot.tellraw("@a", error._message);
@@ -62,6 +63,17 @@ async function inject (context) {
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);
}
}
},
@@ -70,7 +82,7 @@ async function inject (context) {
const [commandName, ...args] = command.split(' ');
if (source?.sources?.discord) {
return this.discordExecute(source, commandName, args);
} else {
} else if (!source?.sources?.discord) {
return this.execute(source, commandName, args);
}
},
@@ -87,15 +99,15 @@ async function inject (context) {
if (!command?.discordExecute) {
throw new CommandError(`${command.data.name} command is not supported in discord!`);
} else {
} else if (source.sources.discord) {
return command?.discordExecute({ bot, source, arguments: args, config, discordClient, EmbedBuilder, 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);
}
}
},
+52
View File
@@ -0,0 +1,52 @@
function inject (context) {
const bot = context.bot
if (bot.options.mode !== "kaboom") return
bot.on('system_chat', (data) => {
try {
const message = data.message;
// console.log(message);
if (message.translate === "fnfboyfriendbot_request_command_suggestion") {
const extra = message.extra;
const uuidString = extra[0].text;
const uuidMatch = bot.players.find((e) => e.uuid === uuidString);
if (Array.isArray(extra) && extra.length > 0) {
const commandSuggestions = {
extra: [
{ text: "fnfboyfriendbot_request_command_suggestion" },
...bot.commandManager.commandlist.map((c) => {
const aliases = c.data.aliases.length > 0 ? c.data.aliases : [];
return {
extra: [
c.data.trustLevel === 0 ? "PUBLIC" :
c.data.trustLevel === 1 ? "TRUSTED" :
c.data.trustLevel === 2 ? "ADMIN" :
c.data.trustLevel === 3 ? "OWNER" :
"OWNER",
"true",
...aliases
],
text: c.data.name
};
})
],
text: ""
};
const jsonString = (commandSuggestions);
bot.tellraw(`@a[name="${uuidMatch.profile.name}"]`, jsonString);
}
}
} catch (e) {
if (e.toString() === "TypeError: Cannot read properties of undefined (reading '0')") return
else console.log(e.stack)
}
})
}
module.exports = {
data: {
enabled: true,
name: "command suggestion",
type: "commands"
},
inject
};
+9 -3
View File
@@ -23,7 +23,13 @@ function inject (context) {
})
})
},
source: new CommandSource(bot._client.username, { console: true, discord: false }),
source: new CommandSource({
profile: {
name: bot._client.username
}, uuid: bot._client.uuid },
{ console: true, discord: false
}),
refreshLine (...args) {
this.readline.output.write("\x1b[2K\r");
console.log.apply(console, arguments);
@@ -49,8 +55,8 @@ function inject (context) {
bot.on('message', (message) => {
if (!options.logging) return;
//if (bot.getMessageAsPrismarine(message)?.toString().includes("https://www.innersloth.com/games/among-us/ › amogus")) return;
// if (ratelimit > 10) return
if (ratelimit > 10 || message?.translate === "fnfboyfriendbot_command_block_output" || message?.translate === "fnfboyfriendbot_request_command_suggestion") 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++
+5 -7
View File
@@ -36,7 +36,6 @@ function inject (context) {
try {
bot?.discord?.channel?.send(`\`\`\`ansi\n${discordQueue.join('\n').substring(0, 1984)}\n\`\`\``)
} catch (error) {
console.error(error.toString())
}
discordQueue = []
}, 2000)
@@ -50,12 +49,13 @@ function inject (context) {
try {
sendDiscordMessage(fixansi(ansi?.replaceAll('`', '`\u200b')))
} catch (e) {
bot.console.error(`Error sending a message to Discord:\n${e.message}`)
bot.console.warn(`Error sending a message to Discord: ${e.message}`)
sendDiscordMessage(e.message)
}
}
bot.on('message', (message) => {
if (message?.translate === "fnfboyfriendbot_command_block_output" || message?.translate === "fnfboyfriendbot_request_command_suggestion") return;
sendComponent(message);
});
@@ -73,11 +73,9 @@ function inject (context) {
}, {
discord: true,
console: false
}, false, message)
}, false, message);
// bot.sendFeedback = message => {
sendComponent(message)
// }
sendComponent(message);
bot.commandManager.executeString(source, message.content.substring(config.discord.prefix.length))
return
@@ -154,7 +152,7 @@ function inject (context) {
} else if (message?.reference?.type === 1) {
// this is for messages that are forwarded
} else {
if (options.mode === "savageFriends" || options.mode === "creayun") {
if (options.mode === "creayun") {
bot.chat.message(bot.getMessageAsPrismarine(`&7[&9FNF&3Boyfriend&1Bot Discord&7] ${message?.member?.displayName} \u203a ${message?.content}`)?.toMotd().replaceAll('§','&'))
} else {
bot.tellraw('@a', [tag, message.content]);
+154
View File
@@ -0,0 +1,154 @@
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
};
+14 -4
View File
@@ -20,6 +20,7 @@ function inject (context) {
let positionCount = 0;
bot.vanished = true
bot.on('system_chat', (data) => {
try {
const stringMessage = bot.getMessageAsPrismarine(data.message)?.toString();
if (options.mode === "savageFriends") {
if (stringMessage === "Please, login with the command: /login <password>") login = true;
@@ -28,11 +29,14 @@ function inject (context) {
else if (stringMessage === "Please, register to the server with the command: /register <password> <ConfirmPassword>") register = true;
else if (stringMessage === "This user isn't registered!") register = true;
else if (stringMessage === "Successfully registered!") register = false;
// else if (stringMessage === "You already have registered this username!") register = false;
else if (stringMessage === "You're already logged in!") register = false;
else if (stringMessage === "Successful login!") register = false;
else if (stringMessage === ` > Prefix for user ${bot.options.username} set to: [Prefix: ${config.prefixes[0]}]`) prefix = true;
else if (stringMessage?.startsWith(` > Prefix for user ${bot.options.username} set to: `) || stringMessage === ` > Prefix for user ${bot.options.username} removed.`) prefix = false;
else if (stringMessage === `You no longer have a nickname.`) nickname = false;
else if (stringMessage?.startsWith('Your nickname is now ')) nickname = true;
else if (stringMessage === `Vanish for ${bot.options.username}: enabled`) vanished = true;
else if (stringMessage === `Vanish for ${bot.options.username}: disabled`) vanished = false;
} else if (options.mode === "kaboom") {
if (stringMessage === "Successfully enabled CommandSpy") commandSpy = true;
else if (stringMessage === "Successfully enabled CommandSpy.") commandSpy = true;
@@ -58,6 +62,9 @@ function inject (context) {
else if (stringMessage === `You no longer have a nickname.`) nickname = false;
else if (stringMessage?.startsWith('Your nickname is now ')) nickname = true;
}
} catch (e) {
console.log(e.stack);
}
})
bot.on('packet.entity_status', packet => {
@@ -76,7 +83,7 @@ function inject (context) {
})
bot.on("packet.position", (packet, position) => {
if (options.isSavage || options.isCreayun) return
if (options.mode === "savageFriends" || options.mode === "creayun") return;
positionCount++
setTimeout(() => {
positionCount--
@@ -99,6 +106,9 @@ function inject (context) {
else if (register) bot.chat.command('register amogusissus amogusissus');
else if (gameMode !== 1) bot.chat.command('minecraft:gamemode creative');
else if (permissionLevel < 2) bot.chat.command(`minecraft:op ${bot.options.username}`);
else if (!prefix) bot.chat.command(`rank ${bot.options.username} &8[&bPrefix&8: &3${config.prefixes[0]}&8]`);
else if (nickname) bot.chat.command('nick off');
else if (!vanished && bot.vanished) bot.chat.command('essentials:vanish on');
else if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 });
} else if (bot.options.isCreayun && !bot.options.isKaboom && !bot.options.isSavage) {
-1
View File
@@ -16,7 +16,6 @@ function inject (context) {
})
bot.on("packet.teams", async (data) => {
// if (options.isSavage || options.isCreayun) return;
try {
if (data.team === config.team.name) {
data?.players?.map(async (player) => {
+9 -5
View File
@@ -8,7 +8,7 @@ module.exports = (bot) => {
bitset[1] = (acc >> 8) & 0xFF;
bitset[2] = (acc >> 16) & 0xFF;
bot._client.write('chat_message', {
message: message?.substring(0, 256),
message: message?.substring(0, 256)?.replaceAll('§','&'),
timestamp: BigInt(Date.now()),
salt: 0n,
offset: 0,
@@ -18,7 +18,7 @@ module.exports = (bot) => {
command (command) {
bot._client.write('chat_command', {
command: command?.substring(0, 256),
command: command?.substring(0, 256)?.replaceAll('§','&'),
timestamp: BigInt(Date.now()),
salt: 0n,
argumentSignatures: [],
@@ -32,7 +32,7 @@ module.exports = (bot) => {
send (message) {
if (message.startsWith('/')) {
bot._client.write('chat_command', {
command: message?.substring(1).substring(0, 256),
command: message?.substring(1).substring(0, 256)?.replaceAll('§','&'),
timestamp: BigInt(Date.now()),
salt: 0n,
argumentSignatures: [],
@@ -49,7 +49,7 @@ module.exports = (bot) => {
bitset[1] = (acc >> 8) & 0xFF;
bitset[2] = (acc >> 16) & 0xFF;
bot._client.write('chat_message', {
message: message?.substring(0, 256),
message: message?.substring(0, 256)?.replaceAll('§','&'),
timestamp: BigInt(Date.now()),
salt: 0n,
offset: 0,
@@ -59,6 +59,10 @@ module.exports = (bot) => {
}
bot.tellraw = (selector, message) => {
bot.core.run(`minecraft:tellraw ${selector} ` + JSON.stringify(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))
}
}
}
-1
View File
@@ -2,7 +2,6 @@ const CommandError = require('./command_error');
module.exports = (bot, command, args, source) => {
const event = bot.discord.message;
const roles = event?.member?.roles?.cache;
switch (command?.data?.trustLevel) {
case 0:
// do nothing since trust level 0 is public
+1
View File
@@ -0,0 +1 @@
chip told me to pull these files from chipmunkbot and add html to matrix relay chat
+28
View File
@@ -0,0 +1,28 @@
{
"colors": [
{"name": "black", "code": "§0", "ansi": "\u001b[0m\u001b[30m", "rgb": 0},
{"name": "dark_blue", "code": "§1", "ansi": "\u001b[0m\u001b[34m", "rgb": 170},
{"name": "dark_green", "code": "§2", "ansi": "\u001b[0m\u001b[32m", "rgb": 43520},
{"name": "dark_aqua", "code": "§3", "ansi": "\u001b[0m\u001b[36m", "rgb": 43690},
{"name": "dark_red", "code": "§4", "ansi": "\u001b[0m\u001b[31m", "rgb": 11141120},
{"name": "dark_purple", "code": "§5", "ansi": "\u001b[0m\u001b[35m", "rgb": 11141290},
{"name": "gold", "code": "§6", "ansi": "\u001b[0m\u001b[33m", "rgb": 16755200},
{"name": "gray", "code": "§7", "ansi": "\u001b[0m\u001b[37m", "rgb": 11184810},
{"name": "dark_gray", "code": "§8", "ansi": "\u001b[0m\u001b[90m", "rgb": 5592405},
{"name": "blue", "code": "§9", "ansi": "\u001b[0m\u001b[94m", "rgb": 5592575},
{"name": "green", "code": "§a", "ansi": "\u001b[0m\u001b[92m", "rgb": 5635925},
{"name": "aqua", "code": "§b", "ansi": "\u001b[0m\u001b[96m", "rgb": 5636095},
{"name": "red", "code": "§c", "ansi": "\u001b[0m\u001b[91m", "rgb": 16733525},
{"name": "light_purple", "code": "§d", "ansi": "\u001b[0m\u001b[95m", "rgb": 16733695},
{"name": "yellow", "code": "§e", "ansi": "\u001b[0m\u001b[93m", "rgb": 16777045},
{"name": "white", "code": "§f", "ansi": "\u001b[0m\u001b[97m", "rgb": 16777215}
],
"formatting": [
{"name": "bold", "code": "§l", "ansi": "\u001b[1m"},
{"name": "italic", "code": "§o", "ansi": "\u001b[3m"},
{"name": "underlined", "code": "§n", "ansi": "\u001b[4m"},
{"name": "strikethrough", "code": "§m", "ansi": "\u001b[9m"},
{"name": "obfuscated", "code": "§k", "ansi": "\u001b[6m"}
],
"reset": {"name": "reset", "code": "§r", "ansi": "\u001b[0m"}
}
+111
View File
@@ -0,0 +1,111 @@
const { colors } = require('./formatting.json')
const { normalize } = require('./utility')
const colormap = Object.fromEntries(colors.map(color => [color.name, color.rgb]))
const colorcodemap = Object.fromEntries(colors.map(color => [color.code, color.rgb]))
const reservedCharacters = {
'"': '&quot;',
"'": '&apos;',
'&': '&amp;',
'<': '&lt;',
'>': '&gt;'
}
function htmlStringify (text, { lang = {} } = {}) {
text = normalize(text)
let string = ''
if (text.text != null) string += preprocessText(text.text)
else if (text.translate != null) {
let format
if (Object.hasOwn(lang, text.translate)) format = lang[text.translate]
else if (text.fallback != null) format = text.fallback
else format = text.translate
const _with = text.with || []
let i = 0
string += preprocessText(format).replace(/%(?:(\d+)\$)?(s|%)/g, (g0, g1) => {
if (g0 === '%%') return '%'
const idx = g1 ? parseInt(g1) : i++
if (_with[idx]) {
return htmlStringify(_with[idx], { lang })
}
return ''
})
}
else if (text.selector != null) string += preprocessText(text.selector)
else if (text.keybind) {
// TODO
}
if (text.extra) {
for (const extra of text.extra) {
string += htmlStringify(extra, { lang })
}
}
if (text.color) {
const rgb = text.color[0] === '#' ? parseInt(text.color.substring(1), 16) : colormap[text.color]
if (rgb) string = `<font color="#${rgb.toString(16).padStart(6, '0')}">${string}</font>`
}
// formatting
if (text.bold) string = `<b>${string}</b>`
if (text.italic) string = `<i>${string}</i>`
if (text.underlined) string = `<u>${string}</u>`
if (text.strikethrough) string = `<strike>${string}</strike>`
if (text.obfuscated) string = `<blink>${string}</blink>`
return string
}
function preprocessText (input) {
let string = ''
let closing = ''
for (let i = 0; i < input.length; i++) {
const c = input[i]
// Emulate Minecraft's section sign escape sequences
if (c === '§') {
if ((i + 1) >= input.length) break // For trailing section signs, append nothing
const code = input.substring(i, i + 2)
i++
const hex = colorcodemap[code]
if (hex) {
string += closing
string += `<font color="${hex.toString(16).padStart(6, '0')}">`
closing = '</font>'
continue
}
if (code === '§r') {
string += closing
closing = ''
continue
}
if (code === '§l') { string += '<b>'; closing += '</b>' }
else if (code === '§o') { string += '<i>'; closing += '</i>' }
else if (code === '§n') { string += '<u>'; closing += '</u>' }
else if (code === '§m') { string += '<strike>'; closing += '</strike>' }
else if (code === '§k') { string += '<blink>'; closing += '</blink>' }
continue // Do not append the escape sequence itself to the string
}
else if (reservedCharacters[c]) string += reservedCharacters[c]
else if (c === '\n') string += '<br>'
else string += c
}
string += closing
return string
}
module.exports = htmlStringify
+103
View File
@@ -0,0 +1,103 @@
const { colors, formatting } = require('./formatting.json')
const formatNames = Object.fromEntries(formatting.map(format => [format.name, true]))
const baseColors = colors.map(color => intToRgb(color.rgb))
function parseJsonText (json) {
try {
return JSON.parse(json)
} catch {
return { text: '' }
}
}
function parseNbtText (data) {
try {
if (data.type === 'byte') return !!data.value
if (typeof data.value !== 'object') return data.value
if (Array.isArray(data.value)) return [...data.value]
if (data.type === 'list') return data.value.value.map(value => parseNbtText({ type: data.value.type, value }))
return Object.fromEntries(Object.entries(data.value).map(([key, value]) => ([key === '' ? 'text' : key, parseNbtText(value)])))
} catch {
return { text: '' }
}
}
function parseText (text) {
const f = text?.type ? parseNbtText : parseJsonText
return f(text)
}
function normalize (text) {
if (typeof text === 'string') return { text }
if (Array.isArray(text)) {
const text2 = [...text]
const text3 = { ...normalize(text2.shift()) }
text3.extra = text2
return text3
}
return text
}
function rgbToInt (r, g, b) {
return (r & 0xff) << 16 | (g & 0xff) << 8 | (b & 0xff)
}
function intToRgb (int) {
const r = (int >> 16) & 0xff
const g = (int >> 8) & 0xff
const b = int & 0xff
return [r, g, b]
}
// skidded from https://github.com/edqx/amongus-experiments/blob/master/index5.js#L34C1-L56C2
function getNearestColor (rgb) {
if (typeof rgb === 'number') rgb = intToRgb(rgb)
const [red, green, blue] = rgb
let nearestDist = Infinity
let nearestColorIdx
for (let i = 0; i < baseColors.length; i++) {
const baseColor = baseColors[i]
const [baseR, baseG, baseB] = baseColor
const diffR = (red - baseR) * (red - baseR)
const diffG = (green - baseG) * (green - baseG)
const diffB = (blue - baseB) * (blue - baseB)
const dist = Math.sqrt(diffR + diffG + diffB)
if (dist < nearestDist) {
nearestDist = dist
nearestColorIdx = i
}
}
return nearestColorIdx
}
function getChangedFormatting (text, previousText, parent = {}) {
// Merge both texts with their parents
text = { ...parent, ...text }
if (previousText) previousText = { ...parent, ...previousText }
const getAllFormatting = () => Object.fromEntries(Object.entries(text).filter(([key, value]) => formatNames[key] || key === 'color'))
if (!previousText || text.color !== previousText.color) return getAllFormatting()
const format = {}
for (const key in formatNames) {
if (text[key] && previousText[key]) continue
if (previousText[key] && !text[key]) return getAllFormatting() // Color codes do not have any way to unset specific formattings
if (text[key] == null) continue
format[key] = format[key]
}
format.color = text.color
return format
}
module.exports = { parseJsonText, parseNbtText, parseText, normalize, rgbToInt, intToRgb, getNearestColor, getChangedFormatting }