v6.0.9 (funni version) build: 1110, too much shit was changed to document, figure it out yourself >:3

This commit is contained in:
Parker2991 2024-10-30 19:07:14 -04:00
parent 3344fc6e2e
commit 0a637e0c8f
21 changed files with 232 additions and 87 deletions

40
package-lock.json generated
View file

@ -86,6 +86,7 @@
"version": "1.9.0", "version": "1.9.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.9.0.tgz", "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.9.0.tgz",
"integrity": "sha512-0zx8DePNVvQibh5ly5kCEei5wtPBIUbSoE9n+91Rlladz4tgtFbJ36PZMxxZrTEOQ7AHMZ/b0crT/0fCy6FTKg==", "integrity": "sha512-0zx8DePNVvQibh5ly5kCEei5wtPBIUbSoE9n+91Rlladz4tgtFbJ36PZMxxZrTEOQ7AHMZ/b0crT/0fCy6FTKg==",
"license": "Apache-2.0",
"dependencies": { "dependencies": {
"@discordjs/formatters": "^0.5.0", "@discordjs/formatters": "^0.5.0",
"@discordjs/util": "^1.1.1", "@discordjs/util": "^1.1.1",
@ -105,12 +106,14 @@
"node_modules/@discordjs/builders/node_modules/discord-api-types": { "node_modules/@discordjs/builders/node_modules/discord-api-types": {
"version": "0.37.97", "version": "0.37.97",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.97.tgz", "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.97.tgz",
"integrity": "sha512-No1BXPcVkyVD4ZVmbNgDKaBoqgeQ+FJpzZ8wqHkfmBnTZig1FcH3iPPersiK1TUIAzgClh2IvOuVUYfcWLQAOA==" "integrity": "sha512-No1BXPcVkyVD4ZVmbNgDKaBoqgeQ+FJpzZ8wqHkfmBnTZig1FcH3iPPersiK1TUIAzgClh2IvOuVUYfcWLQAOA==",
"license": "MIT"
}, },
"node_modules/@discordjs/collection": { "node_modules/@discordjs/collection": {
"version": "1.5.3", "version": "1.5.3",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.5.3.tgz", "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.5.3.tgz",
"integrity": "sha512-SVb428OMd3WO1paV3rm6tSjM4wC+Kecaa1EUGX7vc6/fddvw/6lg90z4QtCqm21zvVe92vMMDt9+DkIvjXImQQ==", "integrity": "sha512-SVb428OMd3WO1paV3rm6tSjM4wC+Kecaa1EUGX7vc6/fddvw/6lg90z4QtCqm21zvVe92vMMDt9+DkIvjXImQQ==",
"license": "Apache-2.0",
"engines": { "engines": {
"node": ">=16.11.0" "node": ">=16.11.0"
} }
@ -119,6 +122,7 @@
"version": "0.5.0", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/@discordjs/formatters/-/formatters-0.5.0.tgz", "resolved": "https://registry.npmjs.org/@discordjs/formatters/-/formatters-0.5.0.tgz",
"integrity": "sha512-98b3i+Y19RFq1Xke4NkVY46x8KjJQjldHUuEbCqMvp1F5Iq9HgnGpu91jOi/Ufazhty32eRsKnnzS8n4c+L93g==", "integrity": "sha512-98b3i+Y19RFq1Xke4NkVY46x8KjJQjldHUuEbCqMvp1F5Iq9HgnGpu91jOi/Ufazhty32eRsKnnzS8n4c+L93g==",
"license": "Apache-2.0",
"dependencies": { "dependencies": {
"discord-api-types": "0.37.97" "discord-api-types": "0.37.97"
}, },
@ -132,12 +136,14 @@
"node_modules/@discordjs/formatters/node_modules/discord-api-types": { "node_modules/@discordjs/formatters/node_modules/discord-api-types": {
"version": "0.37.97", "version": "0.37.97",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.97.tgz", "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.97.tgz",
"integrity": "sha512-No1BXPcVkyVD4ZVmbNgDKaBoqgeQ+FJpzZ8wqHkfmBnTZig1FcH3iPPersiK1TUIAzgClh2IvOuVUYfcWLQAOA==" "integrity": "sha512-No1BXPcVkyVD4ZVmbNgDKaBoqgeQ+FJpzZ8wqHkfmBnTZig1FcH3iPPersiK1TUIAzgClh2IvOuVUYfcWLQAOA==",
"license": "MIT"
}, },
"node_modules/@discordjs/rest": { "node_modules/@discordjs/rest": {
"version": "2.4.0", "version": "2.4.0",
"resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-2.4.0.tgz", "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-2.4.0.tgz",
"integrity": "sha512-Xb2irDqNcq+O8F0/k/NaDp7+t091p+acb51iA4bCKfIn+WFWd6HrNvcsSbMMxIR9NjcMZS6NReTKygqiQN+ntw==", "integrity": "sha512-Xb2irDqNcq+O8F0/k/NaDp7+t091p+acb51iA4bCKfIn+WFWd6HrNvcsSbMMxIR9NjcMZS6NReTKygqiQN+ntw==",
"license": "Apache-2.0",
"dependencies": { "dependencies": {
"@discordjs/collection": "^2.1.1", "@discordjs/collection": "^2.1.1",
"@discordjs/util": "^1.1.1", "@discordjs/util": "^1.1.1",
@ -160,6 +166,7 @@
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-2.1.1.tgz", "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-2.1.1.tgz",
"integrity": "sha512-LiSusze9Tc7qF03sLCujF5iZp7K+vRNEDBZ86FT9aQAv3vxMLihUvKvpsCWiQ2DJq1tVckopKm1rxomgNUc9hg==", "integrity": "sha512-LiSusze9Tc7qF03sLCujF5iZp7K+vRNEDBZ86FT9aQAv3vxMLihUvKvpsCWiQ2DJq1tVckopKm1rxomgNUc9hg==",
"license": "Apache-2.0",
"engines": { "engines": {
"node": ">=18" "node": ">=18"
}, },
@ -170,12 +177,14 @@
"node_modules/@discordjs/rest/node_modules/discord-api-types": { "node_modules/@discordjs/rest/node_modules/discord-api-types": {
"version": "0.37.97", "version": "0.37.97",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.97.tgz", "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.97.tgz",
"integrity": "sha512-No1BXPcVkyVD4ZVmbNgDKaBoqgeQ+FJpzZ8wqHkfmBnTZig1FcH3iPPersiK1TUIAzgClh2IvOuVUYfcWLQAOA==" "integrity": "sha512-No1BXPcVkyVD4ZVmbNgDKaBoqgeQ+FJpzZ8wqHkfmBnTZig1FcH3iPPersiK1TUIAzgClh2IvOuVUYfcWLQAOA==",
"license": "MIT"
}, },
"node_modules/@discordjs/util": { "node_modules/@discordjs/util": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/@discordjs/util/-/util-1.1.1.tgz", "resolved": "https://registry.npmjs.org/@discordjs/util/-/util-1.1.1.tgz",
"integrity": "sha512-eddz6UnOBEB1oITPinyrB2Pttej49M9FZQY8NxgEvc3tq6ZICZ19m70RsmzRdDHk80O9NoYN/25AqJl8vPVf/g==", "integrity": "sha512-eddz6UnOBEB1oITPinyrB2Pttej49M9FZQY8NxgEvc3tq6ZICZ19m70RsmzRdDHk80O9NoYN/25AqJl8vPVf/g==",
"license": "Apache-2.0",
"engines": { "engines": {
"node": ">=18" "node": ">=18"
}, },
@ -187,6 +196,7 @@
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/@discordjs/ws/-/ws-1.1.1.tgz", "resolved": "https://registry.npmjs.org/@discordjs/ws/-/ws-1.1.1.tgz",
"integrity": "sha512-PZ+vLpxGCRtmr2RMkqh8Zp+BenUaJqlS6xhgWKEZcgC/vfHLEzpHtKkB0sl3nZWpwtcKk6YWy+pU3okL2I97FA==", "integrity": "sha512-PZ+vLpxGCRtmr2RMkqh8Zp+BenUaJqlS6xhgWKEZcgC/vfHLEzpHtKkB0sl3nZWpwtcKk6YWy+pU3okL2I97FA==",
"license": "Apache-2.0",
"dependencies": { "dependencies": {
"@discordjs/collection": "^2.1.0", "@discordjs/collection": "^2.1.0",
"@discordjs/rest": "^2.3.0", "@discordjs/rest": "^2.3.0",
@ -209,6 +219,7 @@
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-2.1.1.tgz", "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-2.1.1.tgz",
"integrity": "sha512-LiSusze9Tc7qF03sLCujF5iZp7K+vRNEDBZ86FT9aQAv3vxMLihUvKvpsCWiQ2DJq1tVckopKm1rxomgNUc9hg==", "integrity": "sha512-LiSusze9Tc7qF03sLCujF5iZp7K+vRNEDBZ86FT9aQAv3vxMLihUvKvpsCWiQ2DJq1tVckopKm1rxomgNUc9hg==",
"license": "Apache-2.0",
"engines": { "engines": {
"node": ">=18" "node": ">=18"
}, },
@ -219,7 +230,8 @@
"node_modules/@discordjs/ws/node_modules/discord-api-types": { "node_modules/@discordjs/ws/node_modules/discord-api-types": {
"version": "0.37.83", "version": "0.37.83",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.83.tgz", "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.83.tgz",
"integrity": "sha512-urGGYeWtWNYMKnYlZnOnDHm8fVRffQs3U0SpE8RHeiuLKb/u92APS8HoQnPTFbnXmY1vVnXjXO4dOxcAn3J+DA==" "integrity": "sha512-urGGYeWtWNYMKnYlZnOnDHm8fVRffQs3U0SpE8RHeiuLKb/u92APS8HoQnPTFbnXmY1vVnXjXO4dOxcAn3J+DA==",
"license": "MIT"
}, },
"node_modules/@isaacs/cliui": { "node_modules/@isaacs/cliui": {
"version": "8.0.2", "version": "8.0.2",
@ -436,6 +448,7 @@
"version": "1.5.3", "version": "1.5.3",
"resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.3.tgz", "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.3.tgz",
"integrity": "sha512-x7zadcfJGxFka1Q3f8gCts1F0xMwCKbZweM85xECGI0hBTeIZJGGCrHgLggihBoprlQ/hBmDR5LKfIPqnmHM3w==", "integrity": "sha512-x7zadcfJGxFka1Q3f8gCts1F0xMwCKbZweM85xECGI0hBTeIZJGGCrHgLggihBoprlQ/hBmDR5LKfIPqnmHM3w==",
"license": "MIT",
"engines": { "engines": {
"node": ">=v14.0.0", "node": ">=v14.0.0",
"npm": ">=7.0.0" "npm": ">=7.0.0"
@ -445,6 +458,7 @@
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-4.0.0.tgz", "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-4.0.0.tgz",
"integrity": "sha512-d9dUmWVA7MMiKobL3VpLF8P2aeanRTu6ypG2OIaEv/ZHH/SUQ2iHOVyi5wAPjQ+HmnMuL0whK9ez8I/raWbtIg==", "integrity": "sha512-d9dUmWVA7MMiKobL3VpLF8P2aeanRTu6ypG2OIaEv/ZHH/SUQ2iHOVyi5wAPjQ+HmnMuL0whK9ez8I/raWbtIg==",
"license": "MIT",
"dependencies": { "dependencies": {
"fast-deep-equal": "^3.1.3", "fast-deep-equal": "^3.1.3",
"lodash": "^4.17.21" "lodash": "^4.17.21"
@ -457,6 +471,7 @@
"version": "3.5.3", "version": "3.5.3",
"resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.5.3.tgz", "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.5.3.tgz",
"integrity": "sha512-jjmJywLAFoWeBi1W7994zZyiNWPIiqRRNAmSERxyg93xRGzNYvGjlZ0gR6x0F4gPRi2+0O6S71kOZYyr3cxaIQ==", "integrity": "sha512-jjmJywLAFoWeBi1W7994zZyiNWPIiqRRNAmSERxyg93xRGzNYvGjlZ0gR6x0F4gPRi2+0O6S71kOZYyr3cxaIQ==",
"license": "MIT",
"engines": { "engines": {
"node": ">=v14.0.0", "node": ">=v14.0.0",
"npm": ">=7.0.0" "npm": ">=7.0.0"
@ -486,6 +501,7 @@
"version": "8.5.12", "version": "8.5.12",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.12.tgz", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.12.tgz",
"integrity": "sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==", "integrity": "sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==",
"license": "MIT",
"dependencies": { "dependencies": {
"@types/node": "*" "@types/node": "*"
} }
@ -494,6 +510,7 @@
"version": "2.4.6", "version": "2.4.6",
"resolved": "https://registry.npmjs.org/@vladfrangu/async_event_emitter/-/async_event_emitter-2.4.6.tgz", "resolved": "https://registry.npmjs.org/@vladfrangu/async_event_emitter/-/async_event_emitter-2.4.6.tgz",
"integrity": "sha512-RaI5qZo6D2CVS6sTHFKg1v5Ohq/+Bo2LZ5gzUEwZ/WkHhwtGTCB/sVLw8ijOkAUxasZ+WshN/Rzj4ywsABJ5ZA==", "integrity": "sha512-RaI5qZo6D2CVS6sTHFKg1v5Ohq/+Bo2LZ5gzUEwZ/WkHhwtGTCB/sVLw8ijOkAUxasZ+WshN/Rzj4ywsABJ5ZA==",
"license": "MIT",
"engines": { "engines": {
"node": ">=v14.0.0", "node": ">=v14.0.0",
"npm": ">=7.0.0" "npm": ">=7.0.0"
@ -1045,12 +1062,14 @@
"node_modules/discord-api-types": { "node_modules/discord-api-types": {
"version": "0.37.100", "version": "0.37.100",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.100.tgz", "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.100.tgz",
"integrity": "sha512-a8zvUI0GYYwDtScfRd/TtaNBDTXwP5DiDVX7K5OmE+DRT57gBqKnwtOC5Ol8z0mRW8KQfETIgiB8U0YZ9NXiCA==" "integrity": "sha512-a8zvUI0GYYwDtScfRd/TtaNBDTXwP5DiDVX7K5OmE+DRT57gBqKnwtOC5Ol8z0mRW8KQfETIgiB8U0YZ9NXiCA==",
"license": "MIT"
}, },
"node_modules/discord.js": { "node_modules/discord.js": {
"version": "14.16.3", "version": "14.16.3",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.16.3.tgz", "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.16.3.tgz",
"integrity": "sha512-EPCWE9OkA9DnFFNrO7Kl1WHHDYFXu3CNVFJg63bfU7hVtjZGyhShwZtSBImINQRWxWP2tgo2XI+QhdXx28r0aA==", "integrity": "sha512-EPCWE9OkA9DnFFNrO7Kl1WHHDYFXu3CNVFJg63bfU7hVtjZGyhShwZtSBImINQRWxWP2tgo2XI+QhdXx28r0aA==",
"license": "Apache-2.0",
"dependencies": { "dependencies": {
"@discordjs/builders": "^1.9.0", "@discordjs/builders": "^1.9.0",
"@discordjs/collection": "1.5.3", "@discordjs/collection": "1.5.3",
@ -1706,7 +1725,8 @@
"node_modules/lodash.snakecase": { "node_modules/lodash.snakecase": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz",
"integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==" "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==",
"license": "MIT"
}, },
"node_modules/lru-cache": { "node_modules/lru-cache": {
"version": "10.4.3", "version": "10.4.3",
@ -1721,7 +1741,8 @@
"node_modules/magic-bytes.js": { "node_modules/magic-bytes.js": {
"version": "1.10.0", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/magic-bytes.js/-/magic-bytes.js-1.10.0.tgz", "resolved": "https://registry.npmjs.org/magic-bytes.js/-/magic-bytes.js-1.10.0.tgz",
"integrity": "sha512-/k20Lg2q8LE5xiaaSkMXk4sfvI+9EGEykFS4b0CHHGWqDYU0bGUFSwchNOMA56D7TCs9GwVTkqe9als1/ns8UQ==" "integrity": "sha512-/k20Lg2q8LE5xiaaSkMXk4sfvI+9EGEykFS4b0CHHGWqDYU0bGUFSwchNOMA56D7TCs9GwVTkqe9als1/ns8UQ==",
"license": "MIT"
}, },
"node_modules/make-fetch-happen": { "node_modules/make-fetch-happen": {
"version": "13.0.1", "version": "13.0.1",
@ -2646,7 +2667,8 @@
"node_modules/ts-mixer": { "node_modules/ts-mixer": {
"version": "6.0.4", "version": "6.0.4",
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.4.tgz", "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.4.tgz",
"integrity": "sha512-ufKpbmrugz5Aou4wcr5Wc1UUFWOLhq+Fm6qa6P0w0K5Qw2yhaUoiWszhCVuNQyNwrlGiscHOmqYoAox1PtvgjA==" "integrity": "sha512-ufKpbmrugz5Aou4wcr5Wc1UUFWOLhq+Fm6qa6P0w0K5Qw2yhaUoiWszhCVuNQyNwrlGiscHOmqYoAox1PtvgjA==",
"license": "MIT"
}, },
"node_modules/tslib": { "node_modules/tslib": {
"version": "2.7.0", "version": "2.7.0",
@ -2657,6 +2679,7 @@
"version": "6.19.8", "version": "6.19.8",
"resolved": "https://registry.npmjs.org/undici/-/undici-6.19.8.tgz", "resolved": "https://registry.npmjs.org/undici/-/undici-6.19.8.tgz",
"integrity": "sha512-U8uCCl2x9TK3WANvmBavymRzxbfFYG+tAu+fgx3zxQy3qdagQqBLwJVrdyO1TBfUXvfKveMKJZhpvUYoOjM+4g==", "integrity": "sha512-U8uCCl2x9TK3WANvmBavymRzxbfFYG+tAu+fgx3zxQy3qdagQqBLwJVrdyO1TBfUXvfKveMKJZhpvUYoOjM+4g==",
"license": "MIT",
"engines": { "engines": {
"node": ">=18.17" "node": ">=18.17"
} }
@ -2842,6 +2865,7 @@
"version": "8.18.0", "version": "8.18.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz",
"integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
"license": "MIT",
"engines": { "engines": {
"node": ">=10.0.0" "node": ">=10.0.0"
}, },

View file

@ -1,6 +1,6 @@
const mc = require('minecraft-protocol'); const mc = require('minecraft-protocol');
const { EventEmitter } = require('events'); const { EventEmitter } = require('events');
EventEmitter.defaultMaxListeners = Infinity; EventEmitter.defaultMaxListeners = 5e6;
const util = require('util'); const util = require('util');
const createRegistry = require('prismarine-registry'); const createRegistry = require('prismarine-registry');
const ChatMessage = require('prismarine-chat'); const ChatMessage = require('prismarine-chat');
@ -27,15 +27,18 @@ function createBot(options = {}, config) {
bot.registry.language = require('./data/language.json'); bot.registry.language = require('./data/language.json');
bot.emit('registry_ready', bot.registry) bot.emit('registry_ready', bot.registry)
}) })
client.on('disconnect', data => { client.on('disconnect', data => {
bot.emit("disconnect", data); bot.emit("disconnect", data);
console.log(ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi())
bot.console.warn(`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`) bot.console.warn(`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`)
}) })
client.on('end', reason => { client.on('end', reason => {
bot.emit('end', reason); bot.emit('end', reason);
if (reason === "socketClosed") return; if (reason === "socketClosed") return;
bot.console.warn(ChatMessage(bot._client.version).fromNotch(`§8[§bClient Reconnect§8]§r ${reason}`)?.toAnsi()) bot.console.warn(ChatMessage(bot._client.version).fromNotch(`§8[§bClient Reconnect§8]§r ${reason}`)?.toAnsi())
// bot = undefined;
// config = undefined;
}) })
client.on('error', error => { client.on('error', error => {
@ -64,4 +67,4 @@ function createBot(options = {}, config) {
bot.bots = options.bots ?? [bot] bot.bots = options.bots ?? [bot]
return bot return bot
} }
module.exports = createBot module.exports = createBot;

View file

@ -2,7 +2,7 @@ const bots = require('../data/bots.json');
const CommandError = require('../util/command_error') const CommandError = require('../util/command_error')
module.exports = { module.exports = {
name: "bots", name: "bots",
description: ["shows a list of known bots"], description: "shows a list of known bots",
aliases: ["knownbots"], aliases: ["knownbots"],
trustLevel: 0, trustLevel: 0,
usages:[""], usages:[""],

View file

@ -20,7 +20,8 @@ module.exports = {
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
switch (args[1]) { switch (args[1]) {
case 'add': case 'add':
if (parseInt(args[2]) === NaN) bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid interval', color: 'red' }) 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 interval = parseInt(args[2])
const command = args.slice(3).join(' '); const command = args.slice(3).join(' ');
bot.cloop.add(command, interval) bot.cloop.add(command, interval)

View file

@ -7,9 +7,10 @@ module.exports = {
trustLevel: 0, trustLevel: 0,
aliases: [ aliases: [
], ],
description: 'amogus', description: 'cows',
usages: [ usages: [
"just wait till the command is ready :3" "<message>",
"list"
], ],
execute (context) { execute (context) {
const bot = context.bot; const bot = context.bot;

View file

@ -16,16 +16,20 @@ module.exports = {
bot.chat.command(message.substring(1)) bot.chat.command(message.substring(1))
return return
} }
// if // if
bot.chat.message(message) bot.chat.message(message)
}, },
discordExecute (context) { discordExecute (context) {
const bot = context.bot; const bot = context.bot;
const args = context.arguments; const args = context.arguments;
// const interaction = context.interaction
//interaction.options.getString('input')
if (args.join(' ').startsWith('/')) { if (args.join(' ').startsWith('/')) {
bot.chat.command(args.join(' ').substring(1)) bot.chat.command(args.join(' ').substring(1))
return return
} }
bot.chat.message(args.join(' ')) bot.chat.message(args.join(' '))
// bot.chat.message('e')
} }
} }

View file

@ -129,6 +129,7 @@ module.exports = {
} }
console.log(aliases)*/ console.log(aliases)*/
// } // }
// tellraw @p {"text":"this","clickEvent":{"action":"suggest_command","value":"this"}}
if (command.trustLevel === 0) { if (command.trustLevel === 0) {
public.push([ public.push([
{ {
@ -139,12 +140,12 @@ module.exports = {
action: "show_text", action: "show_text",
value: [ value: [
{ {
text: `Command:${command.name}\n`, text: `Command: ${command.name}\n`,
color: 'gray' color: 'blue'
}, },
{ {
text: `Trust Level: `, text: `Trust Level: `,
color: 'gray' color: 'blue'
}, },
{ {
text: `${command.trustLevel}\n`, text: `${command.trustLevel}\n`,
@ -152,20 +153,20 @@ module.exports = {
}, },
{ {
text: `${command.description}\n`, text: `${command.description}\n`,
color: 'gray' color: 'blue'
}, },
{ {
text: `Command Aliases: ${command.aliases}\n`, text: `Command Aliases: ${command.aliases}\n`,
color: 'gray' color: 'blue'
}, },
{ {
text: 'click on me to use me :)', text: 'click on me to use me :)',
color: 'gray', color: 'dark_blue',
}, },
], ],
}, },
clickEvent: { clickEvent: {
action: 'run_command', action: 'suggest_command',
value: `${config.prefixes[0]}${command?.name}` value: `${config.prefixes[0]}${command?.name}`
} }
} }
@ -181,11 +182,11 @@ module.exports = {
value: [ value: [
{ {
text: `Command:${command.name}\n`, text: `Command:${command.name}\n`,
color: 'gray' color: 'blue'
}, },
{ {
text: `Trust Level: `, text: `Trust Level: `,
color: 'gray' color: 'blue'
}, },
{ {
text: `${command.trustLevel}\n`, text: `${command.trustLevel}\n`,
@ -193,20 +194,20 @@ module.exports = {
}, },
{ {
text: `${command.description}\n`, text: `${command.description}\n`,
color: 'gray' color: 'blue'
}, },
{ {
text: `Command Aliases: ${command.aliases}\n`, text: `Command Aliases: ${command.aliases}\n`,
color: 'gray' color: 'blue'
}, },
{ {
text: 'click on me to use me :)', text: 'click on me to use me :)',
color: 'gray', color: 'dark_blue',
}, },
], ],
}, },
clickEvent: { clickEvent: {
action: 'run_command', action: 'suggest_command',
value: `${config.prefixes[0]}${command?.name}` value: `${config.prefixes[0]}${command?.name}`
} }
} }
@ -222,11 +223,11 @@ module.exports = {
value: [ value: [
{ {
text: `Command:${command.name}\n`, text: `Command:${command.name}\n`,
color: 'gray' color: 'blue'
}, },
{ {
text: `Trust Level: `, text: `Trust Level: `,
color: 'gray' color: 'blue'
}, },
{ {
text: `${command.trustLevel}\n`, text: `${command.trustLevel}\n`,
@ -234,20 +235,20 @@ module.exports = {
}, },
{ {
text: `${command.description}\n`, text: `${command.description}\n`,
color: 'gray' color: 'blue'
}, },
{ {
text: `Command Aliases: ${command.aliases}\n`, text: `Command Aliases: ${command.aliases}\n`,
color: 'gray' color: 'blue'
}, },
{ {
text: 'click on me to use me :)', text: 'click on me to use me :)',
color: 'gray', color: 'dark_blue',
}, },
], ],
}, },
clickEvent: { clickEvent: {
action: 'run_command', action: 'suggest_command',
value: `${config.prefixes[0]}${command?.name}` value: `${config.prefixes[0]}${command?.name}`
} }
} }
@ -263,11 +264,11 @@ module.exports = {
value: [ value: [
{ {
text: `Command:${command.name}\n`, text: `Command:${command.name}\n`,
color: 'gray' color: 'blue'
}, },
{ {
text: `Trust Level: `, text: `Trust Level: `,
color: 'gray' color: 'blue'
}, },
{ {
text: `${command.trustLevel}\n`, text: `${command.trustLevel}\n`,
@ -275,20 +276,20 @@ module.exports = {
}, },
{ {
text: `${command.description}\n`, text: `${command.description}\n`,
color: 'gray' color: 'blue'
}, },
{ {
text: `Command Aliases: ${command.aliases}\n`, text: `Command Aliases: ${command.aliases}\n`,
color: 'gray' color: 'blue'
}, },
{ {
text: 'click on me to use me :)', text: 'click on me to use me :)',
color: 'gray', color: 'dark_blue',
}, },
], ],
}, },
clickEvent: { clickEvent: {
action: 'run_command', action: 'suggest_command',
value: `${config.prefixes[0]}${command?.name}` value: `${config.prefixes[0]}${command?.name}`
} }
} }

View file

@ -3,7 +3,7 @@ const { EmbedBuilder } = require('discord.js');
const fixansi = require('../util/ansi'); const fixansi = require('../util/ansi');
module.exports = { module.exports = {
name: 'list', name: 'list',
description:['check the player list'], description:'check the player list',
trustLevel: 0, trustLevel: 0,
aliases:['playerlist', 'plist', 'pl'], aliases:['playerlist', 'plist', 'pl'],
usages:[""], usages:[""],

View file

@ -2,7 +2,7 @@ const between = require('../util/between')
const CommandError = require('../util/command_error') const CommandError = require('../util/command_error')
module.exports = { module.exports = {
name: 'tpr', name: 'tpr',
description:['teleport to a random place'], description:'teleport to a random place',
trustLevel: 1, trustLevel: 1,
aliases:['rtp', 'teleportrandom', 'randomteleport'], aliases:['rtp', 'teleportrandom', 'randomteleport'],
usages:[""], usages:[""],

View file

@ -3,7 +3,7 @@ const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder, StringSelect
const { request } = require('undici'); const { request } = require('undici');
module.exports = { module.exports = {
name: 'urban', name: 'urban',
description:['urban dictionary'], description:'urban dictionary',
aliases:['urbandictionary'], aliases:['urbandictionary'],
trustLevel: 0, trustLevel: 0,
usages: [ usages: [

View file

@ -3,7 +3,7 @@ const CommandError = require('../util/command_error')
const { EmbedBuilder } = require('discord.js') const { EmbedBuilder } = require('discord.js')
module.exports = { module.exports = {
name: 'wiki', name: 'wiki',
description:['wikipedia'], description:'wikipedia',
trustLevel: 0, trustLevel: 0,
aliases:['wikipedia'], aliases:['wikipedia'],
usages:["<definition>"], usages:["<definition>"],

View file

@ -1,8 +1,8 @@
{ {
"bot": { "bot": {
"buildstring": { "buildstring": {
"version": "v6.0.8", "version": "v6.0.9",
"build":"1090", "build":"1110",
"codename":"" "codename":""
}, },
"source": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot/" "source": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot/"

View file

@ -10,15 +10,7 @@ const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits;
const discordClient = new Client({ intents: [Guilds, GuildMessages, MessageContent] }); const discordClient = new Client({ intents: [Guilds, GuildMessages, MessageContent] });
console.log('Starting FNFBoyfriendBot'); console.log('Starting FNFBoyfriendBot');
checks(); checks();
/*
if (!fs.existsSync(path.join(__dirname, "../config.yml"))) {
console.log("Config not found creating config from the default config");
fs.copyFileSync(
path.join(__dirname, "./data/default_config.yml"),
path.join(__dirname, "../config.yml")
)
}
*/
try { try {
config = js_yaml.load(fs.readFileSync(path.join(__dirname, '../', 'config.yml'))) config = js_yaml.load(fs.readFileSync(path.join(__dirname, '../', 'config.yml')))
} catch (e) { } catch (e) {

View file

@ -1,4 +1,3 @@
const readline = require('readline');
function boot (bot, options, discordClient, config) { function boot (bot, options, discordClient, config) {
bot.on("packet.login", (data) => { bot.on("packet.login", (data) => {
if (bot.options.isCreayun) return if (bot.options.isCreayun) return

View file

@ -33,19 +33,19 @@ function chat (bot, options, config) {
}) })
switch (packet.type) { switch (packet.type) {
case 1: case 1:
bot.emit('message', { translate: "chat.type.emote", with: [ sender, message ]}) bot.emit('profilelessChat', { translate: "chat.type.emote", with: [ sender, message ]})
break break
case 2: case 2:
bot.emit('message', { translate: "commands.message.display.incoming", with: [ sender, message], color: "gray", italic: true }) bot.emit('profilelessChat', { translate: "commands.message.display.incoming", with: [ sender, message], color: "gray", italic: true })
break break
case 3: case 3:
bot.emit('message', [{ translate: "commands.message.display.outgoing", with: [ sender, message ], color: "gray", italic: true }]) bot.emit('profilelessChat', [{ translate: "commands.message.display.outgoing", with: [ sender, message ], color: "gray", italic: true }])
break break
case 4: case 4:
bot.emit('message', [message]); bot.emit('profilelessChat', [message]);
break break
case 5: case 5:
bot.emit('message', [{ translate: 'chat.type.announcement', with: [ sender, message ]}]) bot.emit('profilelessChat', [{ translate: 'chat.type.announcement', with: [ sender, message ]}])
break break
} }
tryParsingMessage(message, { senderName: sender, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine }) tryParsingMessage(message, { senderName: sender, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
@ -56,16 +56,20 @@ function chat (bot, options, config) {
bot.emit('player_chat', { plain: packet.plainMessage, unsigned, senderUuid: packet.senderUuid }) bot.emit('player_chat', { plain: packet.plainMessage, unsigned, senderUuid: packet.senderUuid })
switch (packet.type) { switch (packet.type) {
case 5: case 5:
bot.emit('message', { translate: "chat.type.announcement", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]}) bot.emit('playerChat', { translate: "chat.type.announcement", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
break
case 4:
bot.emit('playerChat', unsigned);
break break
case 3: case 3:
bot.emit('message', { translate: "commands.message.display.outgoing", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true }) bot.emit('playerChat', { translate: "commands.message.display.outgoing", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
break break
case 2: case 2:
bot.emit('message', { translate: "commands.message.display.incoming", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true }) bot.emit('playerChat', { translate: "commands.message.display.incoming", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
break
case 1:
bot.emit('playerChat', { translate: "chat.type.emote", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
break break
default:
bot.emit('message', unsigned)
} }
tryParsingMessage(unsigned, { senderUuid: packet.senderUuid, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine }) tryParsingMessage(unsigned, { senderUuid: packet.senderUuid, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
}) })
@ -82,11 +86,36 @@ function chat (bot, options, config) {
return return
} }
bot.emit('message', message) bot.emit('systemChat', message)
tryParsingMessage(message, { players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine }) 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) { function tryParsingMessage (message, data) {
let parsed let parsed
for (const parser of bot.chatParsers) { for (const parser of bot.chatParsers) {
@ -140,3 +169,4 @@ function chat (bot, options, config) {
} }
} }
module.exports = chat; module.exports = chat;

View file

@ -7,6 +7,7 @@ async function command_manager (bot, options, config, discordClient) {
bot.commandManager = { bot.commandManager = {
commands: {}, commands: {},
commandlist: [], commandlist: [],
collection: new Collection(),
execute (source, commandName, args) { execute (source, commandName, args) {
const command = this.getCommand(commandName.toLowerCase()); const command = this.getCommand(commandName.toLowerCase());
try { try {
@ -20,7 +21,7 @@ async function command_manager (bot, options, config, discordClient) {
} }
} else if (!source?.sources?.discord && !source?.sources?.console) { } else if (!source?.sources?.discord && !source?.sources?.console) {
if (!command || !command.execute) if (!command || !command.execute)
throw new CommandError({ bot.tellraw("@a", {
translate: "%s%s%s %s", translate: "%s%s%s %s",
color: "dark_gray", color: "dark_gray",
with: [ with: [
@ -50,6 +51,7 @@ async function command_manager (bot, options, config, discordClient) {
} }
]) ])
} }
if (command?.trustLevel > 0) { if (command?.trustLevel > 0) {
const event = bot.discord.message; const event = bot.discord.message;
const roles = event?.member?.roles?.cache; const roles = event?.member?.roles?.cache;
@ -84,7 +86,7 @@ async function command_manager (bot, options, config, discordClient) {
return command?.execute({ bot, source, arguments: args, config, discordClient }); return command?.execute({ bot, source, arguments: args, config, discordClient });
} }
} catch (error) { } catch (error) {
console.error(error.stack) console.error(error)
if (source?.sources?.discord && !source?.sources?.console) { if (source?.sources?.discord && !source?.sources?.console) {
const Embed = new EmbedBuilder() const Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.error}`) .setColor(`${config.colors.discord.error}`)
@ -100,7 +102,17 @@ async function command_manager (bot, options, config, discordClient) {
if (bot.options.isSavage || bot.options.isCreayun) { if (bot.options.isSavage || bot.options.isCreayun) {
bot.chat.message(`&4${error.message}`) bot.chat.message(`&4${error.message}`)
} else { } else {
bot.tellraw("@a", error._message) // console.log(error.toString());
if (error.toString().length > 256) {
bot.tellraw("@a", error._message);
} else if (error.toString().length < 256) {
bot.chat.message(`${bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&')}`)
/*}*else if (error.toString().length < 256 && error._useChat === false) {
bot.tellraw("@a", error._message);*/
} else {
bot.tellraw("@a", error._message);
}
// bot.tellraw("@a", error._message)
} }
} else { } else {
if (bot.options.isSavage || bot.options.isCreayun) { if (bot.options.isSavage || bot.options.isCreayun) {
@ -120,9 +132,9 @@ async function command_manager (bot, options, config, discordClient) {
discordExecute(source, command) { discordExecute(source, command) {
const [commandName, ...args] = command.split(" "); const [commandName, ...args] = command.split(" ");
if (source?.sources?.discord && !source.sources.console) { if (source?.sources?.discord && !source?.sources?.console) {
return this.discordExecute(source, commandName, args) return this.discordExecute(source, commandName, args)
} }
}, },
register (command) { register (command) {
@ -155,6 +167,7 @@ async function command_manager (bot, options, config, discordClient) {
} if (filename.endsWith('.js')) { } if (filename.endsWith('.js')) {
let commands = require(path.join(__dirname, '../commands', filename)); let commands = require(path.join(__dirname, '../commands', filename));
bot.commandManager.register(commands); bot.commandManager.register(commands);
bot.commandManager.collection.set(commands.name, commands)
bot.commandManager.commandlist.push(commands); bot.commandManager.commandlist.push(commands);
} }
} catch (error) { } catch (error) {

View file

@ -1,7 +1,7 @@
const CommandSource = require('../util/command_source'); const CommandSource = require('../util/command_source');
const prismarineChat = require('prismarine-chat')('1.20.2'); const prismarineChat = require('prismarine-chat')('1.20.2');
function Console (bot, options, config) { function Console (bot, options, config) {
let rateLimit = 0; let ratelimit = 0;
bot.console = { bot.console = {
readline: null, readline: null,
server: 'all', server: 'all',
@ -66,17 +66,74 @@ function Console (bot, options, config) {
} }
} }
} }
bot.on('message', (message) => { setInterval(() => ratelimit = 0, 1000 * 2);
bot.on('profilelessChat', (message) => {
if (!options.logging) 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()}`);
})
bot.on('systemChat', (message) => {
if (!options.logging) return;
if (ratelimit > 15) 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++
})
bot.on('playerChat', (message) => {
if (!options.logging) return;
if (ratelimit > 15) 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++
})
// console.log(ratelimit)
bot.on('bossBar', (message) => {
if (!options.logging) return;
if (ratelimit > 10) return;
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
ratelimit++
})
bot.on('actionBar', (message) => {
if (!options.logging) return;
if (ratelimit > 10) return
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
ratelimit++
})
/*
setInterval(() => spamCount = 0, 1000 * 2)
bot.on('message', message => {
if (spamCount > 300) {
console.log('WTF spam detected not logging')
return
}
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi()
const string = bot.getMessageAsPrismarine(message)?.toString()
const now = new Date().toLocaleString()
spamCount++
*/
/* bot.on('message', (message) => {
rateLimit++ rateLimit++
setTimeout(() => { setTimeout(() => {
rateLimit-- rateLimit--
}, 1000) }, 1000)
if (!options.logging) return; if (!options.logging) return;
/* if (rateLimit > 100) { if (rateLimit > 100) {
return return
}*/ }
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi()); 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()}`); 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()}`);
}) })*/
} }
module.exports = Console; module.exports = Console;

View file

@ -1,10 +1,10 @@
// TODO: Maybe move client creation elsepwhere // TODO: Maybe move client creation elsepwhere
const { Client, GatewayIntentBits, interaction } = require('discord.js') //const { Client, GatewayIntentBits, interaction } = require('discord.js')
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits //const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits
const fixansi = require('../util/ansi'); const fixansi = require('../util/ansi');
const CommandSource = require('../util/command_source') const CommandSource = require('../util/command_source')
const client = new Client({ intents: [Guilds, GuildMessages, MessageContent] }) //const client = new Client({ intents: [Guilds, GuildMessages, MessageContent] })
const util = require('util') const util = require('util')
function discord(bot, options, config, discordClient) { function discord(bot, options, config, discordClient) {
@ -57,10 +57,22 @@ function discord(bot, options, config, discordClient) {
sendDiscordMessage(e.message) sendDiscordMessage(e.message)
} }
} }
bot.on('message', message => {
sendComponent(message) bot.on('profilelessChat', (message) => {
sendComponent(message);
}) })
bot.on('systemChat', (message) => {
sendComponent(message);
})
bot.on('playerChat', (message) => {
sendComponent(message);
})
/* bot.on('message', message => {
sendComponent(message)
})*/
function messageCreate(message, source) { function messageCreate(message, source) {
bot.discord.message = message; bot.discord.message = message;
if (message.author.id === bot.discord.client.user.id) return if (message.author.id === bot.discord.client.user.id) return

View file

@ -2,10 +2,15 @@ const mc = require('minecraft-protocol');
const usernameGen = require("../util/usernameGen"); const usernameGen = require("../util/usernameGen");
function reconnect (bot, options, config) { function reconnect (bot, options, config) {
bot.on('end', () => { bot.on('end', () => {
//bot = undefined;
bot._client.removeAllListeners();
//client = undefined;
//bot._client = undefined;
if (bot.reconnectDelay < 0) return if (bot.reconnectDelay < 0) return
setTimeout(() => { setTimeout(() => {
if (options.usernameGen) { if (options.usernameGen) {
client = options.client ?? mc.createClient(options, bot.options.username = usernameGen(bot)) client = options.client ?? mc.createClient(options, options.username = usernameGen(bot))
} else { } else {
client = options.client ?? mc.createClient(options) client = options.client ?? mc.createClient(options)
} }

View file

@ -16,7 +16,7 @@ function selfcare (bot, options, config) {
bot.vanished = true bot.vanished = true
// You now have the tag: &8[&bPrefix&8: &3~&8] // You now have the tag: &8[&bPrefix&8: &3~&8]
// You no longer have a tag // You no longer have a tag
bot.on('message', (message) => { bot.on('systemChat', (message) => {
const stringMessage = bot.getMessageAsPrismarine(message)?.toString(); const stringMessage = bot.getMessageAsPrismarine(message)?.toString();
if (options.isSavage) { if (options.isSavage) {
if (stringMessage === "Please, login with the command: /login <password>") login = true; if (stringMessage === "Please, login with the command: /login <password>") login = true;
@ -82,6 +82,7 @@ You already have registered this username!
}) })
bot.on("packet.position", (packet, position) => { bot.on("packet.position", (packet, position) => {
if (options.isSavage || options.isCreayun) return
positionCount++ positionCount++
setTimeout(() => { setTimeout(() => {
positionCount-- positionCount--

View file

@ -1,12 +1,14 @@
// TODO: Improve how messages are stringified // TODO: Improve how messages are stringified
const ChatMessage = require('prismarine-chat')('1.20.2') const ChatMessage = require('prismarine-chat')('1.20.2')
const stringify = message => new ChatMessage(message).toString() const stringify = message => new ChatMessage(message)?.toString()
class CommandError extends Error { class CommandError extends Error {
constructor (message, filename, lineError) { constructor (message, filename, lineError, useChat) {
super(stringify(message), filename, lineError) super(stringify(message), filename, lineError, useChat)
this.name = 'CommandError' this.name = 'CommandError'
this._message = message this._message = message
return this._useChat = useChat
// this._useChat = useChat
} }
get message () { get message () {