diff --git a/package-lock.json b/package-lock.json index 4c0a1b1..9e4b925 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,8 @@ "packages": { "": { "dependencies": { + "@tonejs/midi": "^2.0.28", + "axios": "^1.8.2", "discord.js": "^14.17.3", "js-yaml": "^4.1.0", "matrix-js-sdk": "^36.2.0", @@ -12,6 +14,7 @@ "minecraft-protocol": "^1.54.0", "prismarine-chat": "^1.10.1", "prismarine-registry": "^1.11.0", + "request": "^2.88.2", "undici": "^7.3.0", "wikipedia": "^2.1.2" } @@ -235,6 +238,16 @@ "npm": ">=7.0.0" } }, + "node_modules/@tonejs/midi": { + "version": "2.0.28", + "resolved": "https://registry.npmjs.org/@tonejs/midi/-/midi-2.0.28.tgz", + "integrity": "sha512-RII6YpInPsOZ5t3Si/20QKpNqB1lZ2OCFJSOzJxz38YdY/3zqDr3uaml4JuCWkdixuPqP1/TBnXzhQ39csyoVg==", + "license": "MIT", + "dependencies": { + "array-flatten": "^3.0.0", + "midi-file": "^1.2.2" + } + }, "node_modules/@types/events": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.3.tgz", @@ -310,6 +323,15 @@ "axios": "^0.21.1" } }, + "node_modules/@xboxreplay/xboxlive-auth/node_modules/axios": { + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.14.0" + } + }, "node_modules/abort-controller": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", @@ -356,25 +378,57 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "license": "Python-2.0" }, + "node_modules/array-flatten": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-3.0.0.tgz", + "integrity": "sha512-zPMVc3ZYlGLNk4mpK1NzP2wg0ml9t7fUgDsayR5Y5rSzxQilzR9FGu/EH2jQOcKSAeAfWeylyW8juy3OkWRvNA==", + "license": "MIT" + }, "node_modules/asn1": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", "integrity": "sha512-6i37w/+EhlWlGUJff3T/Q8u1RGmP5wgbiwYnOnbOqvtrPxT63/sYFyP9RcpxtxGymtfA075IvmOnL7ycNOWl3w==", "license": "MIT" }, + "node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "license": "MIT" }, + "node_modules/aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", + "license": "Apache-2.0", + "engines": { + "node": "*" + } + }, + "node_modules/aws4": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.13.2.tgz", + "integrity": "sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw==", + "license": "MIT" + }, "node_modules/axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.2.tgz", + "integrity": "sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg==", "license": "MIT", "dependencies": { - "follow-redirects": "^1.14.0" + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, "node_modules/base-x": { @@ -403,6 +457,15 @@ ], "license": "MIT" }, + "node_modules/bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", + "license": "BSD-3-Clause", + "dependencies": { + "tweetnacl": "^0.14.3" + } + }, "node_modules/bs58": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/bs58/-/bs58-6.0.0.tgz", @@ -463,6 +526,12 @@ "node": ">=4" } }, + "node_modules/caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", + "license": "Apache-2.0" + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -490,6 +559,24 @@ "node": ">= 0.6" } }, + "node_modules/core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", + "license": "MIT" + }, + "node_modules/dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", + "license": "MIT", + "dependencies": { + "assert-plus": "^1.0.0" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/debug": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", @@ -563,6 +650,16 @@ "node": ">=18.17" } }, + "node_modules/ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", + "license": "MIT", + "dependencies": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, "node_modules/ecdsa-sig-formatter": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", @@ -596,6 +693,21 @@ "node": ">=0.8.x" } }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "license": "MIT" + }, + "node_modules/extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", + "engines": [ + "node >=0.6.0" + ], + "license": "MIT" + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -628,6 +740,15 @@ } } }, + "node_modules/forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", + "license": "Apache-2.0", + "engines": { + "node": "*" + } + }, "node_modules/form-data": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", @@ -642,6 +763,53 @@ "node": ">= 6" } }, + "node_modules/getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", + "license": "MIT", + "dependencies": { + "assert-plus": "^1.0.0" + } + }, + "node_modules/har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", + "license": "ISC", + "engines": { + "node": ">=4" + } + }, + "node_modules/har-validator": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", + "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "deprecated": "this library is no longer supported", + "license": "MIT", + "dependencies": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", + "license": "MIT", + "dependencies": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + }, + "engines": { + "node": ">=0.8", + "npm": ">=1.3.7" + } + }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -675,6 +843,18 @@ "url": "https://www.buymeacoffee.com/2tmRKi9" } }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", + "license": "MIT" + }, + "node_modules/isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==", + "license": "MIT" + }, "node_modules/js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", @@ -687,12 +867,30 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==", + "license": "MIT" + }, + "node_modules/json-schema": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", + "license": "(AFL-2.1 OR BSD-3-Clause)" + }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "license": "MIT" }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "license": "ISC" + }, "node_modules/jsonwebtoken": { "version": "9.0.2", "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", @@ -715,6 +913,21 @@ "npm": ">=6" } }, + "node_modules/jsprim": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", + "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", + "license": "MIT", + "dependencies": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.4.0", + "verror": "1.10.0" + }, + "engines": { + "node": ">=0.6.0" + } + }, "node_modules/jwa": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", @@ -898,6 +1111,12 @@ "events": "^3.2.0" } }, + "node_modules/midi-file": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/midi-file/-/midi-file-1.2.4.tgz", + "integrity": "sha512-B5SnBC6i2bwJIXTY9MElIydJwAmnKx+r5eJ1jknTLetzLflEl0GWveuBB6ACrQpecSRkOB6fhTx1PwXk2BVxnA==", + "license": "MIT" + }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -1034,6 +1253,15 @@ "asn1": "0.2.3" } }, + "node_modules/oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "license": "Apache-2.0", + "engines": { + "node": "*" + } + }, "node_modules/oidc-client-ts": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/oidc-client-ts/-/oidc-client-ts-3.1.0.tgz", @@ -1059,6 +1287,12 @@ "node": ">=8" } }, + "node_modules/performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", + "license": "MIT" + }, "node_modules/prismarine-auth": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/prismarine-auth/-/prismarine-auth-2.6.0.tgz", @@ -1189,6 +1423,18 @@ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", "license": "MIT" }, + "node_modules/psl": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.15.0.tgz", + "integrity": "sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==", + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "funding": { + "url": "https://github.com/sponsors/lupomontero" + } + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -1198,6 +1444,15 @@ "node": ">=6" } }, + "node_modules/qs": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.6" + } + }, "node_modules/railroad-diagrams": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz", @@ -1239,6 +1494,62 @@ "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", "license": "MIT" }, + "node_modules/request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", + "license": "Apache-2.0", + "dependencies": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/request/node_modules/form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/request/node_modules/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "license": "MIT", + "bin": { + "uuid": "bin/uuid" + } + }, "node_modules/ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", @@ -1263,6 +1574,12 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "license": "MIT" }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, "node_modules/sdp-transform": { "version": "2.15.0", "resolved": "https://registry.npmjs.org/sdp-transform/-/sdp-transform-2.15.0.tgz", @@ -1294,6 +1611,31 @@ "npm": ">= 3.0.0" } }, + "node_modules/sshpk": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz", + "integrity": "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==", + "license": "MIT", + "dependencies": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + }, + "bin": { + "sshpk-conv": "bin/sshpk-conv", + "sshpk-sign": "bin/sshpk-sign", + "sshpk-verify": "bin/sshpk-verify" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -1323,6 +1665,19 @@ ], "license": "MIT" }, + "node_modules/tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "license": "BSD-3-Clause", + "dependencies": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=0.8" + } + }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -1341,6 +1696,24 @@ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "license": "0BSD" }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", + "license": "Unlicense" + }, "node_modules/undici": { "version": "7.3.0", "resolved": "https://registry.npmjs.org/undici/-/undici-7.3.0.tgz", @@ -1389,6 +1762,20 @@ "macaddress": "^0.5.1" } }, + "node_modules/verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", + "engines": [ + "node >=0.6.0" + ], + "license": "MIT", + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", @@ -1418,17 +1805,6 @@ "node": ">=10" } }, - "node_modules/wikipedia/node_modules/axios": { - "version": "1.7.9", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz", - "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==", - "license": "MIT", - "dependencies": { - "follow-redirects": "^1.15.6", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, "node_modules/ws": { "version": "8.18.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", diff --git a/package.json b/package.json index 292e480..110c75d 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,7 @@ { "dependencies": { + "@tonejs/midi": "^2.0.28", + "axios": "^1.8.2", "discord.js": "^14.17.3", "js-yaml": "^4.1.0", "matrix-js-sdk": "^36.2.0", @@ -7,6 +9,7 @@ "minecraft-protocol": "^1.54.0", "prismarine-chat": "^1.10.1", "prismarine-registry": "^1.11.0", + "request": "^2.88.2", "undici": "^7.3.0", "wikipedia": "^2.1.2" } diff --git a/src/commands/admin/filter.js b/src/commands/admin/filter.js index 697b872..b180555 100644 --- a/src/commands/admin/filter.js +++ b/src/commands/admin/filter.js @@ -27,6 +27,7 @@ module.exports = { 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; @@ -45,15 +46,50 @@ module.exports = { let filterList = []; for (const players of bot.filter.list()) { - filterList.push({ - translate: "%s: %s", - color: config.colors.commands.tertiary, - with: [ - { text: `${index}`, color: config.colors.integer }, - { text: players.name, color: config.colors.commands.primary } - ] - }); + 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++; } @@ -78,19 +114,22 @@ module.exports = { break; case "remove": bot.filter.remove(args[2]); - bot.chat.message(`removed ${args[2]} from the filter`); + 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; @@ -99,6 +138,7 @@ module.exports = { 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; diff --git a/src/commands/admin/reconnect.js b/src/commands/admin/reconnect.js index 1c5f064..ae72bc9 100644 --- a/src/commands/admin/reconnect.js +++ b/src/commands/admin/reconnect.js @@ -6,7 +6,7 @@ module.exports = { ], description: "reconnects the bot", usages: [ - + "" ], trustLevel: 2, }, diff --git a/src/commands/console/console.js b/src/commands/console/console.js index 987ba44..44bee1d 100644 --- a/src/commands/console/console.js +++ b/src/commands/console/console.js @@ -4,7 +4,7 @@ module.exports = { trustLevel: 4, description: "runs commands made for the bots console", aliases: [ - + "c" ], usages: [ 'server/srv ', diff --git a/src/commands/public/core.js b/src/commands/public/core.js index e6b4719..5aebce4 100644 --- a/src/commands/public/core.js +++ b/src/commands/public/core.js @@ -6,7 +6,11 @@ module.exports = { "cbrun", "corerun" ], - trustLevel: 0 + trustLevel: 0, + description: "run commands in core", + usages: [ + "" + ] }, execute (context) { const bot = context.bot; diff --git a/src/commands/public/help.js b/src/commands/public/help.js index 0c183a2..0e6ce60 100644 --- a/src/commands/public/help.js +++ b/src/commands/public/help.js @@ -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'))}\`\`\``); } diff --git a/src/commands/public/list.js b/src/commands/public/list.js index e352daf..154adfd 100644 --- a/src/commands/public/list.js +++ b/src/commands/public/list.js @@ -10,7 +10,7 @@ module.exports = { description: "check whos online on the server", trustLevel: 0, usages: [ - + "" ] }, execute (context) { diff --git a/src/commands/public/mcserver.js b/src/commands/public/mcserver.js index ce86528..6fada98 100644 --- a/src/commands/public/mcserver.js +++ b/src/commands/public/mcserver.js @@ -1,6 +1,24 @@ const mc = require('minecraft-protocol'); const util = require('util'); +function componentPush (config, server, host, port, component) { + component.push({ + translate: "%s: %s:%s\n%s: (%s/%s)\n%s: %s\n%s", + color: config.colors.commands.tertiary, + with: [ + { text: "ip", color: config.colors.commands.primary }, + { text: `${host}`, color: config.colors.commands.secondary }, + { text: `${Number(port ?? 25565)}`, color: config.colors.commands.secondary }, + { text: "players", color: config.colors.commands.primary }, + { text: `${server.players.online}`, color: config.colors.integer }, + { text: `${server.players.max}`, color: config.colors.integer }, + { text: "server version", color: config.colors.commands.primary }, + { text: `${server.version.name}`, color: config.colors.commands.secondary }, + server.description + ] + }); +} + module.exports = { data: { name: "mcserver", @@ -22,25 +40,30 @@ module.exports = { let component = []; try { - component.push({ - translate: "%s: %s:%s\n%s: (%s/%s)\n%s: %s\n%s", - color: config.colors.commands.tertiary, - with: [ - { text: "ip", color: config.colors.commands.primary }, - { text: `${host}`, color: config.colors.commands.secondary }, - { text: `${Number(port ?? 25565)}`, color: config.colors.commands.secondary }, - { text: "players", color: config.colors.commands.primary }, - { text: `${server.players.online}`, color: config.colors.integer }, - { text: `${server.players.max}`, color: config.colors.integer }, - { text: "server version", color: config.colors.commands.primary }, - { text: `${server.version.name}`, color: config.colors.commands.secondary }, - server.description - ] - }); + + componentPush(config, server, host, port, component); bot.tellraw("@a", component); } catch (e) { bot.chat.message(`${e.toString()}`); } + }, + async discordExecute (context) { + const bot = context.bot; + const args = context.arguments; + const fixansi = context.fixansi; + const config = context.config; + const [host, port] = args[0].split(':'); + const server = await mc.ping({ host, port: Number(port ?? 25565) }); + let component = []; + + try { + + componentPush(config, server, host, port, component); + + bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``); + } catch (e) { + bot?.discord?.message?.reply(`${e.toString()}`); + } } -} \ No newline at end of file +} diff --git a/src/commands/public/netmsg.js b/src/commands/public/netmsg.js index d448ded..bf9c107 100644 --- a/src/commands/public/netmsg.js +++ b/src/commands/public/netmsg.js @@ -6,9 +6,9 @@ module.exports = { "netmessage" ], description: "send a message to other servers", - trustLevel: 0, + trustLevel: 1, usages: [ - "message" + "" ] }, execute (context) { diff --git a/src/commands/public/pingserver.js b/src/commands/public/pingserver.js deleted file mode 100644 index ce86528..0000000 --- a/src/commands/public/pingserver.js +++ /dev/null @@ -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: [ - "" - ] - }, - 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()}`); - } - } -} \ No newline at end of file diff --git a/src/commands/public/refillcore.js b/src/commands/public/refillcore.js index 5d95ec2..b1ea70f 100644 --- a/src/commands/public/refillcore.js +++ b/src/commands/public/refillcore.js @@ -8,7 +8,7 @@ module.exports = { ], description: 'refill the bots core', usages: [ - + "" ], }, execute (context) { diff --git a/src/commands/public/urban.js b/src/commands/public/urban.js index f8276e5..6e889bd 100644 --- a/src/commands/public/urban.js +++ b/src/commands/public/urban.js @@ -27,9 +27,17 @@ module.exports = { const query = new URLSearchParams({ term }); const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`); const { list } = await dictResult.body.json(); - if (!list.length) { - bot.tellraw('@a', { text: 'No results found', color: 'dark_red' }); + + if (bot.options.mode === "savageFriends") { + bot.chat.message('this command is disabled for this server for right now sorry!'); + return; } + + if (!list.length) { + bot.tellraw("@a", { text: "No results found", color: "dark_red" }); + } + + for (definitions of list) { component.push(prefix, [ { @@ -70,7 +78,12 @@ module.exports = { }, ]) } - bot.tellraw(`@a`, component) + + if (bot.options.mode === "savageFriends") { + bot.core.run(`minecraft:tellraw @a ${JSON.stringify(component)}`); + } else { + bot.tellraw(`@a`, component) + } }, async discordExecute (context) { const bot = context.bot; diff --git a/src/commands/public/weather.js b/src/commands/public/weather.js index 3cd704c..7c26dbe 100644 --- a/src/commands/public/weather.js +++ b/src/commands/public/weather.js @@ -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); diff --git a/src/commands/trusted/cloop.js b/src/commands/trusted/cloop.js index cd22053..967b434 100644 --- a/src/commands/trusted/cloop.js +++ b/src/commands/trusted/cloop.js @@ -10,7 +10,10 @@ module.exports = { description: "loops commands", trustLevel: 1, usages: [ - + "add ", + "remove ", + "list", + "clear" ] }, execute (context) { @@ -93,4 +96,4 @@ module.exports = { throw new CommandError('invalid argument') } } -} \ No newline at end of file +} diff --git a/src/data/filter.json b/src/data/filter.json new file mode 100644 index 0000000..50cbf00 --- /dev/null +++ b/src/data/filter.json @@ -0,0 +1 @@ +[{"name":"hego0","ignorecase":false,"regex":false},{"name":"silly_ash","ignorecase":false,"regex":false},{"name":"Fightbot","ignorecase":false,"regex":false},{"name":"GyatMamyIgora","ignorecase":false,"regex":false},{"name":"ZzX","ignorecase":false,"regex":false},{"name":"ZzX_","ignorecase":false,"regex":false},{"name":"ZzX__","ignorecase":false,"regex":false},{"name":"mcrafter138","ignorecase":false,"regex":false},{"name":"spioooooch","ignorecase":false,"regex":false},{"name":"bepi9","ignorecase":false,"regex":false},{"name":"launtherkl","ignorecase":false,"regex":false},{"name":"void777","ignorecase":false,"regex":false}] \ No newline at end of file diff --git a/src/modules/boot.js b/src/modules/boot.js index c7b1cf7..5e0dffb 100644 --- a/src/modules/boot.js +++ b/src/modules/boot.js @@ -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`); } }) diff --git a/src/modules/chat.js b/src/modules/chat.js index 6d7b153..c305d23 100644 --- a/src/modules/chat.js +++ b/src/modules/chat.js @@ -314,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', { @@ -338,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) { diff --git a/src/modules/command_core.js b/src/modules/command_core.js index 7df49be..f24f858 100644 --- a/src/modules/command_core.js +++ b/src/modules/command_core.js @@ -94,12 +94,12 @@ function inject (context) { }; bot.core.itemPosition = { - x: pos.x, - y: pos.y -1, - z: pos.z + x: Math.floor(pos.x - 2), + y: Math.floor(pos.y - 2), + z: Math.floor(pos.z - 2) } - if (config.core.itemRefill) { + if (config.core.itemRefill && bot.options.mode !== "savageFriends") { bot.core.itemRefill(); } else { bot.core.chatRefill(); @@ -231,9 +231,14 @@ function inject (context) { bot.on('packet.nbt_query_response', (data) => { try { if (data.transactionId == transactionId) { - if (data?.nbt?.value?.LastOutput) { - bot.tellraw("@a", JSON.parse(data.nbt.value.LastOutput.value)); + bot.tellraw("@a", JSON.parse(data.nbt.value.LastOutput.value).extra); + bot.tellraw(`@a[name="${bot.options.username}"]`, { + translate: "fnfboyfriendbot_command_block_output", + extra: [ + JSON.parse(data.nbt.value.LastOutput.value).extra + ] + }); } } } catch (e) { diff --git a/src/modules/command_handler.js b/src/modules/command_handler.js index 8e539f6..a842483 100644 --- a/src/modules/command_handler.js +++ b/src/modules/command_handler.js @@ -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) diff --git a/src/modules/command_manager.js b/src/modules/command_manager.js index 3b5805e..75905a5 100644 --- a/src/modules/command_manager.js +++ b/src/modules/command_manager.js @@ -49,7 +49,7 @@ 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") { @@ -63,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); } } }, @@ -92,11 +103,11 @@ async function inject (context) { 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); } } }, diff --git a/src/modules/command_suggestion.js b/src/modules/command_suggestion.js new file mode 100644 index 0000000..e4b919c --- /dev/null +++ b/src/modules/command_suggestion.js @@ -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 +}; + diff --git a/src/modules/console.js b/src/modules/console.js index 9cca843..944b422 100644 --- a/src/modules/console.js +++ b/src/modules/console.js @@ -56,7 +56,7 @@ function inject (context) { bot.on('message', (message) => { if (!options.logging) 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++ diff --git a/src/modules/discord.js b/src/modules/discord.js index 54baa0e..cdc010f 100644 --- a/src/modules/discord.js +++ b/src/modules/discord.js @@ -55,6 +55,7 @@ function inject (context) { } bot.on('message', (message) => { + if (message?.translate === "fnfboyfriendbot_command_block_output" || message?.translate === "fnfboyfriendbot_request_command_suggestion") return; sendComponent(message); }); diff --git a/src/modules/memusage.js b/src/modules/memusage.js deleted file mode 100644 index 29d56f8..0000000 --- a/src/modules/memusage.js +++ /dev/null @@ -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 -}; diff --git a/src/util/chat_util.js b/src/util/chat_util.js index e8f1130..9078bfe 100644 --- a/src/util/chat_util.js +++ b/src/util/chat_util.js @@ -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,