forked from afspiegeling/NitoriBot
Compare commits
16
Commits
dev
..
SkiBot-1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a14c316a3 | ||
|
|
8b6c257b9e | ||
|
|
7302d4ae8a | ||
|
|
d1368aa032 | ||
|
|
1e7548a660 | ||
|
|
95be204185 | ||
|
|
3eca79a66b | ||
|
|
80482759e6 | ||
|
|
a3b4963307 | ||
|
|
710c44f2c0 | ||
|
|
0439a608dd | ||
|
|
4c5b2f0c5f | ||
|
|
74717cabeb | ||
|
|
c8cc38616d | ||
|
|
8d401a0dcf | ||
|
|
6bc1e76e94 |
+9
-2
@@ -1,4 +1,11 @@
|
||||
# you know the usual stuff that needs to be ignored when committing
|
||||
|
||||
node_modules
|
||||
config.js
|
||||
|
||||
config.yml
|
||||
|
||||
src/modules/exploits.js
|
||||
|
||||
.git
|
||||
src/modules/exploits.js
|
||||
|
||||
src/modules/custom_chat.js
|
||||
|
||||
@@ -1,17 +1,26 @@
|
||||
# FNFBoyfriendBot
|
||||
SkiBot is a client chat bot created by Parker2991 using Custom FNFBoyfriendBot source
|
||||
|
||||
some things were git ignored from the repo that are needed for some things to work so you gotta recreate them
|
||||
SkiBot's source can be found at https://code.chipmunk.land/Parker2991/SkiBot.git
|
||||
|
||||
FNFBoyfriendBot's source can be found at https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot.git
|
||||
|
||||
The idea of the bot is to try and make it close to a minecraft java client as much as i can
|
||||
|
||||
Setup:
|
||||
1. run git clone https://code.chipmunk.land/Parker2991/SkiBot
|
||||
|
||||
2. make sure to have node, npm, and git installed
|
||||
|
||||
if those are installed skip step 2
|
||||
|
||||
3. then run npm i to install packages
|
||||
|
||||
4. run node src to start the bot
|
||||
|
||||
note:
|
||||
files config.yml, exploits.js, and custom_chat.js are git ignored and wont be in the source because they contain private stuff such as keys and tokens and ips for private servers
|
||||
|
||||
but the bot will recreate them from src/data/
|
||||
|
||||
|
||||
FNFBoyfriendBot is a minecraft java bot made for the server kaboom.pw
|
||||
|
||||
# Setup:
|
||||
1. make sure to have nodejs npm and git installed
|
||||
|
||||
2. run npm i
|
||||
|
||||
3. fix some modules and stuff
|
||||
|
||||
4. edit the config
|
||||
|
||||
5. node src
|
||||
after setup is done the bot can be configured and ran
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
Note: each time changes are made push them to the dev branch in the bots repo
|
||||
1. Rewrite the version argument of the info command
|
||||
2. Fix arguments for discord
|
||||
3. Try adding a argument limit for commands maybe
|
||||
4. Use the nbt parser that chayapak wrote for the bot for 1.21.5 command block output
|
||||
5. Completely remove tptoggle selfcare since it’s no longer used
|
||||
- 6. Have the bot get output from the actual core instead of a command block it places
|
||||
- 7. Add support for 1.21 and 1.21.1 while keeping support for 1.19.3 to 1.20.2
|
||||
8. Add a server check
|
||||
9. Add source.sendfeedback back maybe
|
||||
10. Add a check to sendFeedback for discord to see if the message length is longer than discord’s max message limit to output it to a file and then reply with the file in discord
|
||||
11. Add a embed function for discord maybe
|
||||
12. Have the bot output errors to a seperate file to make debugging easier
|
||||
- 13. Revert class changes for usernameGen, loadModules, between, and ansi since it wouldn’t make much sense to make them classes instead of functions (chayapaks suggestion)
|
||||
- 14. Have the bot.js class extend the event emitter (chayapak suggestion)
|
||||
15. Maybe parse cspy in the chat module and emit it as a packet maybe
|
||||
16. For the owner check module have the bot send a message to the player username thats in the config if the 18. username name is online and if theres no reply back in discord within 10 seconds (10000 ms) to start deoping, muting, kicking, and changing their gamemode
|
||||
Generated
+269
-373
@@ -1,17 +1,19 @@
|
||||
{
|
||||
"name": "FNFBoyfriendBot-v8",
|
||||
"name": "SkiBot",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"discord.js": "^14.22.1",
|
||||
"minecraft-data": "^3.99.1",
|
||||
"discord.js": "^14.25.1",
|
||||
"js-yaml": "^4.1.1",
|
||||
"minecraft-data": "^3.102.3",
|
||||
"minecraft-protocol": "^1.62.0",
|
||||
"prismarine-chat": "^1.12.0",
|
||||
"prismarine-nbt": "^2.8.0",
|
||||
"prismarine-registry": "^1.11.0",
|
||||
"undici": "^7.16.0",
|
||||
"wikipedia": "^2.1.2"
|
||||
"terminal-kit": "^3.1.2",
|
||||
"undici": "^7.18.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/msal-common": {
|
||||
@@ -37,16 +39,30 @@
|
||||
"node": ">=16"
|
||||
}
|
||||
},
|
||||
"node_modules/@cronvel/get-pixels": {
|
||||
"version": "3.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@cronvel/get-pixels/-/get-pixels-3.4.1.tgz",
|
||||
"integrity": "sha512-gB5C5nDIacLUdsMuW8YsM9SzK3vaFANe4J11CVXpovpy7bZUGrcJKmc6m/0gWG789pKr6XSZY2aEetjFvSRw5g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"jpeg-js": "^0.4.4",
|
||||
"ndarray": "^1.0.19",
|
||||
"ndarray-pack": "^1.1.1",
|
||||
"node-bitmap": "0.0.1",
|
||||
"omggif": "^1.0.10",
|
||||
"pngjs": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/builders": {
|
||||
"version": "1.11.3",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.11.3.tgz",
|
||||
"integrity": "sha512-p3kf5eV49CJiRTfhtutUCeivSyQ/l2JlKodW1ZquRwwvlOWmG9+6jFShX6x8rUiYhnP6wKI96rgN/SXMy5e5aw==",
|
||||
"version": "1.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.13.1.tgz",
|
||||
"integrity": "sha512-cOU0UDHc3lp/5nKByDxkmRiNZBpdp0kx55aarbiAfakfKJHlxv/yFW1zmIqCAmwH5CRlrH9iMFKJMpvW4DPB+w==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@discordjs/formatters": "^0.6.1",
|
||||
"@discordjs/util": "^1.1.1",
|
||||
"@discordjs/formatters": "^0.6.2",
|
||||
"@discordjs/util": "^1.2.0",
|
||||
"@sapphire/shapeshift": "^4.0.0",
|
||||
"discord-api-types": "^0.38.16",
|
||||
"discord-api-types": "^0.38.33",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"ts-mixer": "^6.0.4",
|
||||
"tslib": "^2.6.3"
|
||||
@@ -68,12 +84,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/formatters": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/formatters/-/formatters-0.6.1.tgz",
|
||||
"integrity": "sha512-5cnX+tASiPCqCWtFcFslxBVUaCetB0thvM/JyavhbXInP1HJIEU+Qv/zMrnuwSsX3yWH2lVXNJZeDK3EiP4HHg==",
|
||||
"version": "0.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/formatters/-/formatters-0.6.2.tgz",
|
||||
"integrity": "sha512-y4UPwWhH6vChKRkGdMB4odasUbHOUwy7KL+OVwF86PvT6QVOwElx+TiI1/6kcmcEe+g5YRXJFiXSXUdabqZOvQ==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"discord-api-types": "^0.38.1"
|
||||
"discord-api-types": "^0.38.33"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
@@ -127,10 +143,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/util": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/util/-/util-1.1.1.tgz",
|
||||
"integrity": "sha512-eddz6UnOBEB1oITPinyrB2Pttej49M9FZQY8NxgEvc3tq6ZICZ19m70RsmzRdDHk80O9NoYN/25AqJl8vPVf/g==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/util/-/util-1.2.0.tgz",
|
||||
"integrity": "sha512-3LKP7F2+atl9vJFhaBjn4nOaSWahZ/yWjOvA4e5pnXkt2qyXRCHLxoBQy81GFtLGCq7K9lPm9R517M1U+/90Qg==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"discord-api-types": "^0.38.33"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
@@ -207,12 +226,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "24.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.6.2.tgz",
|
||||
"integrity": "sha512-d2L25Y4j+W3ZlNAeMKcy7yDsK425ibcAOO2t7aPTz6gNMH0z2GThtwENCDc0d/Pw9wgyRqE5Px1wkV7naz8ang==",
|
||||
"version": "25.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.2.0.tgz",
|
||||
"integrity": "sha512-DZ8VwRFUNzuqJ5khrvwMXHmvPe+zGayJhr2CDNiKB1WBE1ST8Djl00D0IC4vvNmHMdj6DlbYRIaFE7WHjlDl5w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~7.13.0"
|
||||
"undici-types": "~7.16.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node-rsa": {
|
||||
@@ -225,9 +244,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@types/readable-stream": {
|
||||
"version": "4.0.21",
|
||||
"resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-4.0.21.tgz",
|
||||
"integrity": "sha512-19eKVv9tugr03IgfXlA9UVUVRbW6IuqRO5B92Dl4a6pT7K8uaGrNS0GkxiZD0BOk6PLuXl5FhWl//eX/pzYdTQ==",
|
||||
"version": "4.0.23",
|
||||
"resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-4.0.23.tgz",
|
||||
"integrity": "sha512-wwXrtQvbMHxCbBgjHaMGEmImFTQxxpfMOR/ZoQnXxB1woqkUbdLGFDgauo00Py9IudiaqSeiBiulSV9i6XIPig==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
@@ -243,9 +262,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@vladfrangu/async_event_emitter": {
|
||||
"version": "2.4.6",
|
||||
"resolved": "https://registry.npmjs.org/@vladfrangu/async_event_emitter/-/async_event_emitter-2.4.6.tgz",
|
||||
"integrity": "sha512-RaI5qZo6D2CVS6sTHFKg1v5Ohq/+Bo2LZ5gzUEwZ/WkHhwtGTCB/sVLw8ijOkAUxasZ+WshN/Rzj4ywsABJ5ZA==",
|
||||
"version": "2.4.7",
|
||||
"resolved": "https://registry.npmjs.org/@vladfrangu/async_event_emitter/-/async_event_emitter-2.4.7.tgz",
|
||||
"integrity": "sha512-Xfe6rpCTxSxfbswi/W/Pz7zp1WWSNn4A0eW4mLkQUewCrXXtMj31lCg+iQyTkh/CkusZSq9eDflu7tjEDXUY6g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=v14.0.0",
|
||||
@@ -302,18 +321,18 @@
|
||||
"url": "https://github.com/sponsors/epoberezkin"
|
||||
}
|
||||
},
|
||||
"node_modules/argparse": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
|
||||
"license": "Python-2.0"
|
||||
},
|
||||
"node_modules/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/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/axios": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
|
||||
@@ -385,39 +404,11 @@
|
||||
"integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==",
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/call-bind-apply-helpers": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
||||
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/camelcase": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
|
||||
"integrity": "sha512-FxAv7HpHrXbh3aPo4o2qxHay2lkLY3x5Mw3KeE4KQE8ysVfziWeRZDwcjauvwBSGEC/nXUPzZy8zeh4HokqOnw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
"node_modules/chroma-js": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.6.0.tgz",
|
||||
"integrity": "sha512-BLHvCB9s8Z1EV4ethr6xnkl/P2YRFOGqfgvuMG/MyCbZPrTA+NeiByY6XvgF0zP4/2deU2CXnWyMa3zu1LqQ3A==",
|
||||
"license": "(BSD-3-Clause AND Apache-2.0)"
|
||||
},
|
||||
"node_modules/commander": {
|
||||
"version": "2.20.3",
|
||||
@@ -425,6 +416,15 @@
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/cwise-compiler": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/cwise-compiler/-/cwise-compiler-1.1.3.tgz",
|
||||
"integrity": "sha512-WXlK/m+Di8DMMcCjcWr4i+XzcQra9eCdXIJrgh4TUgh0pIS/yJduLxS9JgefsHJ/YVLdgPtXm9r62W92MvanEQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"uniq": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.4.3",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
||||
@@ -442,15 +442,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/discontinuous-range": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/discontinuous-range/-/discontinuous-range-1.0.0.tgz",
|
||||
@@ -458,28 +449,28 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/discord-api-types": {
|
||||
"version": "0.38.26",
|
||||
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.38.26.tgz",
|
||||
"integrity": "sha512-xpmPviHjIJ6dFu1eNwNDIGQ3N6qmPUUYFVAx/YZ64h7ZgPkTcKjnciD8bZe8Vbeji7yS5uYljyciunpq0J5NSw==",
|
||||
"version": "0.38.38",
|
||||
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.38.38.tgz",
|
||||
"integrity": "sha512-7qcM5IeZrfb+LXW07HvoI5L+j4PQeMZXEkSm1htHAHh4Y9JSMXBWjy/r7zmUCOj4F7zNjMcm7IMWr131MT2h0Q==",
|
||||
"license": "MIT",
|
||||
"workspaces": [
|
||||
"scripts/actions/documentation"
|
||||
]
|
||||
},
|
||||
"node_modules/discord.js": {
|
||||
"version": "14.22.1",
|
||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.22.1.tgz",
|
||||
"integrity": "sha512-3k+Kisd/v570Jr68A1kNs7qVhNehDwDJAPe4DZ2Syt+/zobf9zEcuYFvsfIaAOgCa0BiHMfOOKQY4eYINl0z7w==",
|
||||
"version": "14.25.1",
|
||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.25.1.tgz",
|
||||
"integrity": "sha512-2l0gsPOLPs5t6GFZfQZKnL1OJNYFcuC/ETWsW4VtKVD/tg4ICa9x+jb9bkPffkMdRpRpuUaO/fKkHCBeiCKh8g==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@discordjs/builders": "^1.11.2",
|
||||
"@discordjs/builders": "^1.13.0",
|
||||
"@discordjs/collection": "1.5.3",
|
||||
"@discordjs/formatters": "^0.6.1",
|
||||
"@discordjs/formatters": "^0.6.2",
|
||||
"@discordjs/rest": "^2.6.0",
|
||||
"@discordjs/util": "^1.1.1",
|
||||
"@discordjs/util": "^1.2.0",
|
||||
"@discordjs/ws": "^1.2.3",
|
||||
"@sapphire/snowflake": "3.5.3",
|
||||
"discord-api-types": "^0.38.16",
|
||||
"discord-api-types": "^0.38.33",
|
||||
"fast-deep-equal": "3.1.3",
|
||||
"lodash.snakecase": "4.1.1",
|
||||
"magic-bytes.js": "^1.10.0",
|
||||
@@ -502,20 +493,6 @@
|
||||
"node": ">=18.17"
|
||||
}
|
||||
},
|
||||
"node_modules/dunder-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"gopd": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/ecdsa-sig-formatter": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
|
||||
@@ -531,51 +508,6 @@
|
||||
"integrity": "sha512-ShfqhXeHRE4TmggSlHXG8CMGIcsOsqDw/GcoPcosToE59Rm9e4aXaMhEQf2kPBsBRrKem1bbOAv5gOKnkliMFQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/es-define-property": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
||||
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-errors": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
||||
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-object-atoms": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
|
||||
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-set-tostringtag": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
|
||||
"integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.6",
|
||||
"has-tostringtag": "^1.0.2",
|
||||
"hasown": "^2.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/event-target-shim": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
||||
@@ -626,119 +558,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/form-data": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz",
|
||||
"integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"es-set-tostringtag": "^2.1.0",
|
||||
"hasown": "^2.0.2",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"es-define-property": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"es-object-atoms": "^1.1.1",
|
||||
"function-bind": "^1.1.2",
|
||||
"get-proto": "^1.0.1",
|
||||
"gopd": "^1.2.0",
|
||||
"has-symbols": "^1.1.0",
|
||||
"hasown": "^2.0.2",
|
||||
"math-intrinsics": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"dunder-proto": "^1.0.1",
|
||||
"es-object-atoms": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/gopd": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
|
||||
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/has-symbols": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
|
||||
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/has-tostringtag": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
|
||||
"integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"has-symbols": "^1.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/hasown": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
|
||||
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/ieee754": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||
@@ -759,17 +578,34 @@
|
||||
],
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/infobox-parser": {
|
||||
"version": "3.6.4",
|
||||
"resolved": "https://registry.npmjs.org/infobox-parser/-/infobox-parser-3.6.4.tgz",
|
||||
"integrity": "sha512-d2lTlxKZX7WsYxk9/UPt51nkmZv5tbC75SSw4hfHqZ3LpRAn6ug0oru9xI2X+S78va3aUAze3xl/UqMuwLmJUw==",
|
||||
"node_modules/iota-array": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/iota-array/-/iota-array-1.0.0.tgz",
|
||||
"integrity": "sha512-pZ2xT+LOHckCatGQ3DcG/a+QuEqvoxqkiL7tvE8nn3uuu+f6i1TtpB5/FtWFbxUuVr5PZCx8KskuGatbJDXOWA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/is-buffer": {
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
|
||||
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/jpeg-js": {
|
||||
"version": "0.4.4",
|
||||
"resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz",
|
||||
"integrity": "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==",
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
|
||||
"integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"camelcase": "^4.1.0"
|
||||
"argparse": "^2.0.1"
|
||||
},
|
||||
"funding": {
|
||||
"type": "individual",
|
||||
"url": "https://www.buymeacoffee.com/2tmRKi9"
|
||||
"bin": {
|
||||
"js-yaml": "bin/js-yaml.js"
|
||||
}
|
||||
},
|
||||
"node_modules/json-schema-traverse": {
|
||||
@@ -779,12 +615,12 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/jsonwebtoken": {
|
||||
"version": "9.0.2",
|
||||
"resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz",
|
||||
"integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==",
|
||||
"version": "9.0.3",
|
||||
"resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz",
|
||||
"integrity": "sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"jws": "^3.2.2",
|
||||
"jws": "^4.0.1",
|
||||
"lodash.includes": "^4.3.0",
|
||||
"lodash.isboolean": "^3.0.3",
|
||||
"lodash.isinteger": "^4.0.4",
|
||||
@@ -801,9 +637,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/jwa": {
|
||||
"version": "1.4.2",
|
||||
"resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.2.tgz",
|
||||
"integrity": "sha512-eeH5JO+21J78qMvTIDdBXidBd6nG2kZjg5Ohz/1fpa28Z4CcsWUzJ1ZZyFq/3z3N17aZy+ZuBoHljASbL1WfOw==",
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz",
|
||||
"integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"buffer-equal-constant-time": "^1.0.1",
|
||||
@@ -812,19 +648,28 @@
|
||||
}
|
||||
},
|
||||
"node_modules/jws": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz",
|
||||
"integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==",
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz",
|
||||
"integrity": "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"jwa": "^1.4.1",
|
||||
"jwa": "^2.0.1",
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/lazyness": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/lazyness/-/lazyness-1.2.0.tgz",
|
||||
"integrity": "sha512-KenL6EFbwxBwRxG93t0gcUyi0Nw0Ub31FJKN1laA4UscdkL1K1AxUd0gYZdcLU3v+x+wcFi4uQKS5hL+fk500g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
||||
"version": "4.17.23",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz",
|
||||
"integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.includes": {
|
||||
@@ -888,53 +733,22 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/macaddress": {
|
||||
"version": "0.5.3",
|
||||
"resolved": "https://registry.npmjs.org/macaddress/-/macaddress-0.5.3.tgz",
|
||||
"integrity": "sha512-vGBKTA+jwM4KgjGZ+S/8/Mkj9rWzePyGY6jManXPGhiWu63RYwW8dKPyk5koP+8qNVhPhHgFa1y/MJ4wrjsNrg==",
|
||||
"version": "0.5.4",
|
||||
"resolved": "https://registry.npmjs.org/macaddress/-/macaddress-0.5.4.tgz",
|
||||
"integrity": "sha512-i8xVWoUjj2woYU8kbpQby86Kq7uF7xl2brtKREXUBWpfgqx1fKXEeYzDiVMVxA/IufC1d3xxwJRHtFCX+9IspA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/magic-bytes.js": {
|
||||
"version": "1.12.1",
|
||||
"resolved": "https://registry.npmjs.org/magic-bytes.js/-/magic-bytes.js-1.12.1.tgz",
|
||||
"integrity": "sha512-ThQLOhN86ZkJ7qemtVRGYM+gRgR8GEXNli9H/PMvpnZsE44Xfh3wx9kGJaldg314v85m+bFW6WBMaVHJc/c3zA==",
|
||||
"version": "1.13.0",
|
||||
"resolved": "https://registry.npmjs.org/magic-bytes.js/-/magic-bytes.js-1.13.0.tgz",
|
||||
"integrity": "sha512-afO2mnxW7GDTXMm5/AoN1WuOcdoKhtgXjIvHmobqTD1grNplhGdv3PFOyjCVmrnOZBIT/gD/koDKpYG+0mvHcg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/math-intrinsics": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "2.1.35",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mime-db": "1.52.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/minecraft-data": {
|
||||
"version": "3.99.1",
|
||||
"resolved": "https://registry.npmjs.org/minecraft-data/-/minecraft-data-3.99.1.tgz",
|
||||
"integrity": "sha512-mI9SNwlrqY2uTTLOT332Hf/QlaLa+AH3V36qu3Y2i9Z2/PjsZlja2ToTDHjazWqDMBtfch+rDTwPB2mHloArHA==",
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
"version": "3.103.0",
|
||||
"resolved": "https://registry.npmjs.org/minecraft-data/-/minecraft-data-3.103.0.tgz",
|
||||
"integrity": "sha512-laUAUiQ1OXPQPSzGFrx+v4M3LldcIiGuUjLAXzBmA3jZxjwwUKfgEr/7da8CvOeWlwkl+t/sMf5Fw7u7GNE2yg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/minecraft-folder-path": {
|
||||
"version": "1.2.0",
|
||||
@@ -943,9 +757,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/minecraft-protocol": {
|
||||
"version": "1.62.0",
|
||||
"resolved": "https://registry.npmjs.org/minecraft-protocol/-/minecraft-protocol-1.62.0.tgz",
|
||||
"integrity": "sha512-+Rm7DdwgDiiq5ASXLNixs6TA7tsNn8zJAlhmOh0ccfuMYnlr/5+FliKacf87ZO6MPs5p/mJitIAwONbfqiX2+A==",
|
||||
"version": "1.63.0",
|
||||
"resolved": "https://registry.npmjs.org/minecraft-protocol/-/minecraft-protocol-1.63.0.tgz",
|
||||
"integrity": "sha512-7siaKT9Up16p8fSgk4MYgH9EDjSZDZjRj0ZillF5vfVDheY2nyskjQ7NFmqucjTsSWSfKqAoBhNnIHut/aa0Nw==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"@types/node-rsa": "^1.1.4",
|
||||
@@ -993,6 +807,26 @@
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/ndarray": {
|
||||
"version": "1.0.19",
|
||||
"resolved": "https://registry.npmjs.org/ndarray/-/ndarray-1.0.19.tgz",
|
||||
"integrity": "sha512-B4JHA4vdyZU30ELBw3g7/p9bZupyew5a7tX1Y/gGeF2hafrPaQZhgrGQfsvgfYbgdFZjYwuEcnaobeM/WMW+HQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"iota-array": "^1.0.0",
|
||||
"is-buffer": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/ndarray-pack": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ndarray-pack/-/ndarray-pack-1.2.1.tgz",
|
||||
"integrity": "sha512-51cECUJMT0rUZNQa09EoKsnFeDL4x2dHRT0VR5U2H5ZgEcm95ZDWcMA5JShroXjHOejmAD/fg8+H+OvUnVXz2g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cwise-compiler": "^1.1.2",
|
||||
"ndarray": "^1.0.13"
|
||||
}
|
||||
},
|
||||
"node_modules/nearley": {
|
||||
"version": "2.20.1",
|
||||
"resolved": "https://registry.npmjs.org/nearley/-/nearley-2.20.1.tgz",
|
||||
@@ -1015,6 +849,23 @@
|
||||
"url": "https://nearley.js.org/#give-to-nearley"
|
||||
}
|
||||
},
|
||||
"node_modules/nextgen-events": {
|
||||
"version": "1.5.3",
|
||||
"resolved": "https://registry.npmjs.org/nextgen-events/-/nextgen-events-1.5.3.tgz",
|
||||
"integrity": "sha512-P6qw6kenNXP+J9XlKJNi/MNHUQ+Lx5K8FEcSfX7/w8KJdZan5+BB5MKzuNgL2RTjHG1Svg8SehfseVEp8zAqwA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-bitmap": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/node-bitmap/-/node-bitmap-0.0.1.tgz",
|
||||
"integrity": "sha512-Jx5lPaaLdIaOsj2mVLWMWulXF6GQVdyLvNSxmiYCvZ8Ma2hfKX0POoR2kgKOqz+oFsRreq0yYZjQ2wjE9VNzCA==",
|
||||
"engines": {
|
||||
"node": ">=v0.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||
@@ -1044,6 +895,21 @@
|
||||
"asn1": "0.2.3"
|
||||
}
|
||||
},
|
||||
"node_modules/omggif": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/omggif/-/omggif-1.0.10.tgz",
|
||||
"integrity": "sha512-LMJTtvgc/nugXj0Vcrrs68Mn2D1r0zf630VNtqtpI1FEO7e+O9FP4gqs9AcnBaSEeoHIPm28u6qgPR0oyEpGSw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/pngjs": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-6.0.0.tgz",
|
||||
"integrity": "sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prismarine-auth": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/prismarine-auth/-/prismarine-auth-2.7.0.tgz",
|
||||
@@ -1103,18 +969,18 @@
|
||||
}
|
||||
},
|
||||
"node_modules/prismarine-nbt": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/prismarine-nbt/-/prismarine-nbt-2.7.0.tgz",
|
||||
"integrity": "sha512-Du9OLQAcCj3y29YtewOJbbV4ARaSUEJiTguw0PPQbPBy83f+eCyDRkyBpnXTi/KPyEpgYCzsjGzElevLpFoYGQ==",
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/prismarine-nbt/-/prismarine-nbt-2.8.0.tgz",
|
||||
"integrity": "sha512-5D6FUZq0PNtf3v/41ImDlwThVesOv5adyqCRMZLzmkUGEmRJNNh5C6AsnvrClBftXs+IF0yqPnZoj8kcNPiMGg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"protodef": "^1.18.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prismarine-realms": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/prismarine-realms/-/prismarine-realms-1.3.2.tgz",
|
||||
"integrity": "sha512-5apl9Ru8veTj5q2OozRc4GZOuSIcs3yY4UEtALiLKHstBe8bRw8vNlaz4Zla3jsQ8yP/ul1b1IJINTRbocuA6g==",
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/prismarine-realms/-/prismarine-realms-1.4.1.tgz",
|
||||
"integrity": "sha512-WmElIrwN4H/f0460HPnNYRJkRMVNjAmnZUOkZC+tn2Hg2IOsxRlHH5yJ/E2go1hEeFj+NlcYrGDOOhldSXnxSA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "^4.3.3",
|
||||
@@ -1126,7 +992,6 @@
|
||||
"resolved": "https://registry.npmjs.org/prismarine-registry/-/prismarine-registry-1.11.0.tgz",
|
||||
"integrity": "sha512-uTvWE+bILxYv4i5MrrlxPQ0KYWINv1DJ3P2570GLC8uCdByDiDLBFfVyk4BrqOZBlDBft9CnaJMeOsC1Ly1iXw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"minecraft-data": "^3.70.0",
|
||||
"prismarine-block": "^1.17.1",
|
||||
@@ -1168,12 +1033,6 @@
|
||||
"protodef-validator": "cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/proxy-from-env": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/punycode": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
||||
@@ -1248,9 +1107,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "7.7.2",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz",
|
||||
"integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==",
|
||||
"version": "7.7.3",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz",
|
||||
"integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==",
|
||||
"license": "ISC",
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
@@ -1259,6 +1118,24 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/setimmediate": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
|
||||
"integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/seventh": {
|
||||
"version": "0.9.4",
|
||||
"resolved": "https://registry.npmjs.org/seventh/-/seventh-0.9.4.tgz",
|
||||
"integrity": "sha512-O85mosi4sOfxG+slvqy0j7zLuFD4ylUgEMt7Pvt9Q/wnwNwG/6MNnHKzV9JkAoPoPM26t/DLFn17p7o7u5kIBA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"setimmediate": "^1.0.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/smart-buffer": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
|
||||
@@ -1278,12 +1155,49 @@
|
||||
"safe-buffer": "~5.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/string-kit": {
|
||||
"version": "0.19.3",
|
||||
"resolved": "https://registry.npmjs.org/string-kit/-/string-kit-0.19.3.tgz",
|
||||
"integrity": "sha512-94p913R6+Ea6656A39bqJeHgt64HM9RSq36oc0F8N8Mz76g5+cLaqEwkouqguEDrJ4rhVQpS+tKz214FdtMoqA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=14.15.0"
|
||||
}
|
||||
},
|
||||
"node_modules/terminal-kit": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/terminal-kit/-/terminal-kit-3.1.2.tgz",
|
||||
"integrity": "sha512-ro2FyU4A+NwA74DLTYTnoCFYuFpgV1aM07IS6MPrJeajoI2hwF44EdUqjoTmKEl6srYDWtbVkc/b1C16iUnxFQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@cronvel/get-pixels": "^3.4.1",
|
||||
"chroma-js": "^2.4.2",
|
||||
"lazyness": "^1.2.0",
|
||||
"ndarray": "^1.0.19",
|
||||
"nextgen-events": "^1.5.3",
|
||||
"seventh": "^0.9.2",
|
||||
"string-kit": "^0.19.0",
|
||||
"tree-kit": "^0.8.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/tree-kit": {
|
||||
"version": "0.8.8",
|
||||
"resolved": "https://registry.npmjs.org/tree-kit/-/tree-kit-0.8.8.tgz",
|
||||
"integrity": "sha512-L7zwpXp0/Nha6mljVcVOnhhxuCkFRWmt26wza3TKnyMBewid4F2vyiVdcSsw41ZoG1Wj+3lM48Er9lhttbxfLA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=16.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ts-mixer": {
|
||||
"version": "6.0.4",
|
||||
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.4.tgz",
|
||||
@@ -1297,18 +1211,24 @@
|
||||
"license": "0BSD"
|
||||
},
|
||||
"node_modules/undici": {
|
||||
"version": "7.16.0",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-7.16.0.tgz",
|
||||
"integrity": "sha512-QEg3HPMll0o3t2ourKwOeUAZ159Kn9mx5pnzHRQO8+Wixmh88YdZRiIwat0iNzNNXn0yoEtXJqFpyW7eM8BV7g==",
|
||||
"version": "7.20.0",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-7.20.0.tgz",
|
||||
"integrity": "sha512-MJZrkjyd7DeC+uPZh+5/YaMDxFiiEEaDgbUSVMXayofAkDWF1088CDo+2RPg7B1BuS1qf1vgNE7xqwPxE0DuSQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=20.18.1"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "7.13.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.13.0.tgz",
|
||||
"integrity": "sha512-Ov2Rr9Sx+fRgagJ5AX0qvItZG/JKKoBRAVITs1zk7IqZGTJUwgUr7qoYBpWwakpWilTZFM98rG/AFRocu10iIQ==",
|
||||
"version": "7.16.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
|
||||
"integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/uniq": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz",
|
||||
"integrity": "sha512-Gw+zz50YNKPDKXs+9d+aKAjVwpjNwqzvNpLigIruT4HA9lMZNdMqs9x07kKHB/L9WRzqp4+DlTU5s4wG2esdoA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/uri-js": {
|
||||
@@ -1354,34 +1274,10 @@
|
||||
"webidl-conversions": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/wikipedia": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/wikipedia/-/wikipedia-2.1.2.tgz",
|
||||
"integrity": "sha512-RAYaMpXC9/E873RaSEtlEa8dXK4e0p5k98GKOd210MtkE5emm6fcnwD+N6ZA4cuffjDWagvhaQKtp/mGp2BOVQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"axios": "^1.4.0",
|
||||
"infobox-parser": "^3.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/wikipedia/node_modules/axios": {
|
||||
"version": "1.12.2",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz",
|
||||
"integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.6",
|
||||
"form-data": "^4.0.4",
|
||||
"proxy-from-env": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "8.18.3",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz",
|
||||
"integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==",
|
||||
"version": "8.19.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz",
|
||||
"integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
|
||||
+6
-4
@@ -1,11 +1,13 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"discord.js": "^14.22.1",
|
||||
"minecraft-data": "^3.99.1",
|
||||
"discord.js": "^14.25.1",
|
||||
"js-yaml": "^4.1.1",
|
||||
"minecraft-data": "^3.102.3",
|
||||
"minecraft-protocol": "^1.62.0",
|
||||
"prismarine-chat": "^1.12.0",
|
||||
"prismarine-nbt": "^2.8.0",
|
||||
"prismarine-registry": "^1.11.0",
|
||||
"undici": "^7.16.0",
|
||||
"wikipedia": "^2.1.2"
|
||||
"terminal-kit": "^3.1.2",
|
||||
"undici": "^7.18.1"
|
||||
}
|
||||
}
|
||||
|
||||
+60
-102
@@ -1,117 +1,75 @@
|
||||
const mc = require("minecraft-protocol");
|
||||
const { EventEmitter } = require("events");
|
||||
const ChatMessage = require("prismarine-chat");
|
||||
const usernameGen = require("./util/usernameGen");
|
||||
let disconnectCount = 0;
|
||||
const mc = require('minecraft-protocol');
|
||||
const { EventEmitter } = require('events');
|
||||
EventEmitter.defaultMaxListeners = 5e6;
|
||||
const util = require('util');
|
||||
const ChatMessage = require('prismarine-chat');
|
||||
function createBot(context) {
|
||||
const bot = new EventEmitter();
|
||||
const config = context.config;
|
||||
bot.server = {
|
||||
// Set some default values in options
|
||||
host: config.server.host ??= 'localhost',
|
||||
username: config.server.username ??= 'Player',
|
||||
hideErrors: config.server.hideErrors ??= true, // HACK: Hide errors by default as a lazy fix to console being spammed with them
|
||||
auth: config.server.auth
|
||||
};
|
||||
|
||||
EventEmitter.defaultMaxListeners = Infinity;
|
||||
bot.server = config.server;
|
||||
const { fromNotch } = require('prismarine-chat')(bot.server.version);
|
||||
// Create our client object, put it on the bot, and register some events
|
||||
bot.on('init_client', client => {
|
||||
client.on('packet', (data, meta) => {
|
||||
bot.emit('packet', data, meta)
|
||||
bot.emit('packet.' + meta.name, data);
|
||||
})
|
||||
|
||||
class Bot {
|
||||
constructor(options = {}, config) {
|
||||
const bot = new EventEmitter();
|
||||
bot.options = {
|
||||
// Set some default values in options
|
||||
host: (options.host ??= "localhost"),
|
||||
username: (options.username ??= usernameGen()),
|
||||
version: (options.version ??= "1.21.8"),
|
||||
hideErrors: (options.hideErrors ??= true), // HACK: Hide errors by default as a lazy fix to console being spammed with them
|
||||
serverName: (options.serverName ??= "localhost"),
|
||||
private: (options.private ??= false),
|
||||
reconnectDelay: (options.reconnectDelay ??= 300),
|
||||
channelId: (options.channelId ??= "0000000000000000000"),
|
||||
logging: {
|
||||
file: (options.logging.file ??= false),
|
||||
console: (options.logging.console ??= false)
|
||||
},
|
||||
mode: (options.mode ??= "kaboom"),
|
||||
selfcareInterval: (options.selfcareInterval ??= 1000),
|
||||
itemRefill: (options.itemRefill ??= false),
|
||||
chatGamemodeChange: (options.chatGamemodeChange ??= false)
|
||||
};
|
||||
client.on('login', (data) => {
|
||||
bot.uuid = client.uuid
|
||||
bot.username = client.username
|
||||
})
|
||||
|
||||
bot.options = options;
|
||||
client.on('disconnect', data => {
|
||||
bot.emit("disconnect", data);
|
||||
bot?.console?.disconnect(data.reason);
|
||||
})
|
||||
|
||||
// Create our client object, put it on the bot, and register some events
|
||||
bot.on("init_client", (client) => {
|
||||
client.on("packet", (data, meta) => {
|
||||
bot.emit("packet", data, meta);
|
||||
bot.emit("packet." + meta.name, data);
|
||||
});
|
||||
client.on('end', reason => {
|
||||
bot.emit('end', reason);
|
||||
if (reason === "socketClosed") return
|
||||
bot?.console?.disconnect(reason);
|
||||
})
|
||||
|
||||
client.once("login", (data) => {
|
||||
bot.uuid = client.uuid;
|
||||
bot.username = client.username;
|
||||
bot.loggedIn = true;
|
||||
disconnectCount = 0
|
||||
bot.reconnectDelay = options.reconnectDelay;
|
||||
});
|
||||
client.on('error', error => {
|
||||
bot.emit('error', error);
|
||||
bot?.console?.disconnect(error);
|
||||
})
|
||||
|
||||
client.on("disconnect", (data) => {
|
||||
try {
|
||||
if (
|
||||
JSON.parse(data.reason) ===
|
||||
"Wait 5 seconds before connecting, thanks! :)"
|
||||
)
|
||||
bot.reconnectDelay = 5000;
|
||||
bot.console.warn(
|
||||
`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`,
|
||||
);
|
||||
bot?.discord?.channel?.send(
|
||||
ChatMessage(bot._client.version).fromNotch(data.reason)?.toString(),
|
||||
);
|
||||
} catch {} // do nothing
|
||||
});
|
||||
client.on("keep_alive", ({ keepAliveId }) => {
|
||||
bot.emit("keep_alive", { keepAliveId })
|
||||
})
|
||||
|
||||
client.on("end", (reason) => {
|
||||
bot.emit("end", reason);
|
||||
bot.loggedIn = false;
|
||||
disconnectCount++;
|
||||
});
|
||||
client.on('kick_disconnect', (data) => {
|
||||
bot.emit("kick_disconnect", data);
|
||||
bot?.console?.disconnect(data.reason);
|
||||
})
|
||||
|
||||
client.on("error", (error) => {
|
||||
try {
|
||||
if (disconnectCount === 10) {
|
||||
bot.console.info("stopped logging disconnect messages for now...");
|
||||
bot?.discord?.channel?.send(
|
||||
"stopped logging disconnect messages for now...",
|
||||
);
|
||||
return;
|
||||
} else if (disconnectCount > 10) {
|
||||
return;
|
||||
} else {
|
||||
bot.console.warn(
|
||||
ChatMessage(bot._client.version)
|
||||
.fromNotch(`§8[§bClient Reconnect§8]§r ${error.stack}`)
|
||||
?.toAnsi(),
|
||||
);
|
||||
bot?.discord?.channel?.send(error.toString());
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
});
|
||||
client.on('success', (data) => {
|
||||
bot?.console?.log(`Successfully logged into ${bot.server.host}:${bot.server.port}`)
|
||||
});
|
||||
|
||||
client.on("kick_disconnect", (data) => {
|
||||
bot.console.warn(
|
||||
`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`,
|
||||
);
|
||||
bot?.discord?.channel?.send(
|
||||
ChatMessage(bot._client.version).fromNotch(data.reason)?.toString(),
|
||||
);
|
||||
});
|
||||
client.on('server_data', (data) => {
|
||||
bot.console.log(require('./util/nbt_parser')(null, data.motd))
|
||||
// bot?.console?.log(data.motd)
|
||||
});
|
||||
|
||||
process.on("uncaughtException", (e) => {
|
||||
//console.log('meow')
|
||||
console.warn(`${e.stack}`);
|
||||
console?.warn(e.stack)
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
const client = options.client ?? new mc.createClient(bot.options);
|
||||
bot._client = client;
|
||||
bot.emit("init_client", client);
|
||||
bot.bots = options.bots ?? [bot];
|
||||
return bot;
|
||||
}
|
||||
const client = mc.createClient(bot.server)
|
||||
bot._client = client
|
||||
bot.emit('init_client', client)
|
||||
return bot;
|
||||
}
|
||||
module.exports = Bot;
|
||||
module.exports = createBot;
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
function chipmunkmod(message, data) {
|
||||
try {
|
||||
if (message === null || typeof message !== "object") return;
|
||||
if (
|
||||
message.with?.length < 3 ||
|
||||
(message.translate !== "[%s] %s › %s" &&
|
||||
message.translate !== "%s %s › %s")
|
||||
)
|
||||
return;
|
||||
|
||||
const senderComponent = message.with[1];
|
||||
const contents = message.with[2];
|
||||
let sender;
|
||||
const hoverEvent = senderComponent.hover_event;
|
||||
// console.log(hoverEvent)
|
||||
if (hoverEvent?.action === "show_entity") {
|
||||
const id = hoverEvent.uuid;
|
||||
|
||||
sender = data.players.find((player) => player.entityUuid[0] === id[0])//.entityUuid //=== hoverEvent.uuid)//.entityUuid;
|
||||
} else {
|
||||
const stringUsername = data
|
||||
.getMessageAsPrismarine(senderComponent)
|
||||
?.toString();
|
||||
|
||||
sender = data.players.find(
|
||||
(player) => player.profile.name === stringUsername,
|
||||
);
|
||||
}
|
||||
|
||||
if (!sender) return null;
|
||||
|
||||
return {
|
||||
sender,
|
||||
contents,
|
||||
type: "minecraft:chat",
|
||||
senderComponent,
|
||||
chatType: data.chatType
|
||||
};
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
module.exports = chipmunkmod;
|
||||
@@ -1,26 +0,0 @@
|
||||
const ChatMessage = require("prismarine-chat")("1.20.2");
|
||||
const util = require("util");
|
||||
function parseMessage(messageobj, data) {
|
||||
try {
|
||||
let match;
|
||||
let sender;
|
||||
const stringify = (message) => new ChatMessage(message).toString();
|
||||
const message = stringify(messageobj);
|
||||
const playerWithPrefix = /^(.*?) (\S*?) » (.*?)$/;
|
||||
const playerWithoutPrefix = /^(\S*?) » (.*?)$/;
|
||||
if (playerWithPrefix.test(message)) {
|
||||
match = message.match(playerWithPrefix);
|
||||
|
||||
sender = data.players.find((player) => player.profile.name === match[2]);
|
||||
return {
|
||||
sender,
|
||||
contents: match[3],
|
||||
type: "minecraft:chat",
|
||||
chatType: data.chatType
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
}
|
||||
module.exports = parseMessage;
|
||||
@@ -1,43 +0,0 @@
|
||||
const util = require('util')
|
||||
|
||||
function kaboom (message, data) {
|
||||
if (message === null || typeof message !== 'object') return
|
||||
|
||||
if (message.text !== '' || !Array.isArray(message.extra) || message.extra.length < 3) return
|
||||
|
||||
const children = message.extra
|
||||
|
||||
const prefix = children[0]
|
||||
let displayName = data.senderName ?? { text: '' }
|
||||
let contents = { text: '' }
|
||||
|
||||
if (isSeparatorAt(children, 1)) { // Missing/blank display name
|
||||
if (children.length > 3) contents = children[3]
|
||||
} else if (isSeparatorAt(children, 2)) {
|
||||
displayName = children[1]
|
||||
if (children.length > 4) contents = children[4]
|
||||
} else {
|
||||
return undefined
|
||||
}
|
||||
|
||||
const playerListDisplayName = { extra: [prefix, displayName], text: '' }
|
||||
|
||||
let sender
|
||||
|
||||
if (data.senderUuid) {
|
||||
sender = data.players.find(player => player.uuid === data.senderUuid)
|
||||
} else {
|
||||
const playerListDisplayName = { extra: [prefix, displayName], text: '' }
|
||||
sender = data.players.find(player => util.isDeepStrictEqual(player.displayName, playerListDisplayName))
|
||||
}
|
||||
|
||||
if (!sender) return undefined
|
||||
|
||||
return { sender, contents, type: "minecraft:chat", displayName, chatType: data.chatType }
|
||||
}
|
||||
|
||||
function isSeparatorAt (children, start) {
|
||||
return (children[start]?.text === ':' || children[start]?.text === '\xa7f:') && children[start + 1]?.text === ' '
|
||||
}
|
||||
|
||||
module.exports = kaboom
|
||||
@@ -1,31 +0,0 @@
|
||||
function me (message, data) {
|
||||
try {
|
||||
if (message === null || typeof message !== "object") return;
|
||||
|
||||
if (message.with?.length > 2 || message.translate !== "chat.type.announcement") return;
|
||||
|
||||
const component = message.with[0];
|
||||
const contents = message.with[1];
|
||||
let sender;
|
||||
const hoverEvent = component.hover_event
|
||||
|
||||
if (hoverEvent?.action === "show_entity") {
|
||||
const name = hoverEvent.name;
|
||||
sender = data.players.find((player) => player.profile.name === name)
|
||||
}
|
||||
|
||||
if (!sender) return;
|
||||
|
||||
return {
|
||||
sender,
|
||||
contents,
|
||||
type: "minecraft:chat",
|
||||
component,
|
||||
chatType: data.chatType
|
||||
};
|
||||
} catch (e) {
|
||||
console.log(e.stack)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = me;
|
||||
@@ -1,5 +0,0 @@
|
||||
function say (message, data) {
|
||||
|
||||
}
|
||||
|
||||
module.exports = say;
|
||||
@@ -1,37 +0,0 @@
|
||||
function vanilla(message, data) {
|
||||
try {
|
||||
if (message === null || typeof message !== "object") return;
|
||||
|
||||
if (
|
||||
message.with?.length < 2 ||
|
||||
(message.translate !== "chat.type.text" && message.translate !== "%s %s")
|
||||
)
|
||||
return;
|
||||
const senderComponent = message.with[0];
|
||||
const contents = message.with[1];
|
||||
let sender;
|
||||
const hoverEvent = senderComponent.hoverEvent;
|
||||
if (hoverEvent?.action === "show_entity") {
|
||||
const id = hoverEvent.contents.id;
|
||||
sender = data.players.find((player) => player.uuid === id);
|
||||
} else {
|
||||
const stringUsername = data
|
||||
.getMessageAsPrismarine(senderComponent)
|
||||
.toString();
|
||||
sender = data.players.find(
|
||||
(player) => player.profile.name === stringUsername,
|
||||
);
|
||||
}
|
||||
if (!sender) return;
|
||||
return {
|
||||
sender,
|
||||
contents,
|
||||
type: "minecraft:chat",
|
||||
senderComponent,
|
||||
chatType: data.chatType
|
||||
};
|
||||
} catch (e) {
|
||||
console.error(`${e.stack}`);
|
||||
}
|
||||
}
|
||||
module.exports = vanilla;
|
||||
@@ -1,38 +0,0 @@
|
||||
const CommandError = require('./CommandError');
|
||||
const translations = require('../data/translations.json');
|
||||
|
||||
class CommandArguments {
|
||||
static getInteger (integer) {
|
||||
if (isNaN(integer)) throw new CommandError({
|
||||
translate: "fnfboyfriendbot.arguments.invalid_integer",
|
||||
fallback: translations["fnfboyfriendbot.arguments.invalid_integer"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: `${integer}` }
|
||||
]
|
||||
})
|
||||
else return String(Number(integer))
|
||||
}
|
||||
|
||||
static getJson (json) {
|
||||
|
||||
}
|
||||
|
||||
static getArguments () {
|
||||
|
||||
}
|
||||
|
||||
static getMaxArguments (commandArgs, args) {
|
||||
if (commandArgs < args) throw new CommandError({
|
||||
translate: "fnfboyfriendbot.arguments.max_exceeded",
|
||||
fallback: translations["fnfboyfriendbot.arguments.max_exceeded"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: `${commandArgs}` },
|
||||
{ text: `${args}` }
|
||||
]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CommandArguments;
|
||||
@@ -1,12 +0,0 @@
|
||||
class CommandContext {
|
||||
constructor(name, aliases, description, trustLevel, usages, playerChatOnly) {
|
||||
this.data = {};
|
||||
this.data.name = name;
|
||||
this.data.aliases = aliases;
|
||||
this.data.description = description;
|
||||
this.data.trustLevel = trustLevel;
|
||||
this.data.usages = usages;
|
||||
this.data.playerChatOnly = playerChatOnly
|
||||
}
|
||||
}
|
||||
module.exports = CommandContext;
|
||||
@@ -1,15 +0,0 @@
|
||||
const ChatMessage = require("prismarine-chat")("1.21.8");
|
||||
const stringify = (message) => new ChatMessage(message)?.toString();
|
||||
|
||||
class CommandError extends Error {
|
||||
constructor(message, filename, lineError) {
|
||||
super(stringify(message), filename, lineError);
|
||||
this.name = "CommandError";
|
||||
this._message = message;
|
||||
}
|
||||
|
||||
get message() {
|
||||
return stringify(this._message);
|
||||
}
|
||||
}
|
||||
module.exports = CommandError;
|
||||
@@ -1,9 +0,0 @@
|
||||
class CommandSource {
|
||||
constructor(player, sources, ChatType) {
|
||||
this.player = player;
|
||||
this.sources = sources;
|
||||
this.ChatType = ChatType;
|
||||
this.player.trustLevel = 0;
|
||||
}
|
||||
}
|
||||
module.exports = CommandSource;
|
||||
@@ -1,10 +0,0 @@
|
||||
class CommandTrustLevel {
|
||||
static public = 0;
|
||||
static trusted = 1;
|
||||
static admin = 2;
|
||||
static owner = 3;
|
||||
static console = 4;
|
||||
static disabled = 5;
|
||||
}
|
||||
|
||||
module.exports = CommandTrustLevel;
|
||||
@@ -1,155 +0,0 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class CoresettingsCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("coresettings", ["cbsettings"], "change the bots core settings", 2, [
|
||||
"useplacedcommandblock <on/off/true/false/enable/disable>",
|
||||
"area start <positions>",
|
||||
"area end <positions>",
|
||||
"refillmethod/rcmethod <item/chat>",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
|
||||
if (
|
||||
!args &&
|
||||
!args[0] &&
|
||||
!args[1] &&
|
||||
!args[2] &&
|
||||
!args[3] &&
|
||||
!args[4] &&
|
||||
!args[5]
|
||||
)
|
||||
return;
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "useplacedcommandblock":
|
||||
switch (args[2]?.toLowerCase()) {
|
||||
case "on":
|
||||
case "true":
|
||||
case "enable":
|
||||
bot.core.usePlacedCommandBlock = true;
|
||||
component.push({
|
||||
text: "now using the placed command block",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
break;
|
||||
case "off":
|
||||
case "false":
|
||||
case "disable":
|
||||
bot.core.usePlacedCommandBlock = false;
|
||||
component.push({
|
||||
text: "no longer using the placed command block",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
if (bot.core.usePlacedCommandBlock) {
|
||||
component.push({
|
||||
text: "the bot is currently using the placed command block to run its commands",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
} else {
|
||||
component.push({
|
||||
text: "the bot is currently using its command block core to run its commands",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "area":
|
||||
switch (args[2]?.toLowerCase()) {
|
||||
case "start":
|
||||
if (isNaN(args[3]) || isNaN(args[4]) || isNaN(args[5])) {
|
||||
bot.core.area.start = config.core.area.start;
|
||||
component.push({
|
||||
text: "arguments were NaN, defaulting to config core start coords",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
} else {
|
||||
bot.core.area.start = {
|
||||
x: Number(args[3]),
|
||||
y: Number(args[4]),
|
||||
z: Number(args[5]),
|
||||
};
|
||||
component.push({
|
||||
text: `setting core start pos to x: ${args[3]}, y: ${args[4]}, z: ${args[5]}`,
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "end":
|
||||
if (isNaN(args[3]) || isNaN(args[4]) || isNaN(args[5])) {
|
||||
bot.core.area.end = config.core.area.end;
|
||||
throw new CommandError(
|
||||
"arguments were NaN, defaulting to config core end coords",
|
||||
);
|
||||
} else {
|
||||
bot.core.area.end = {
|
||||
x: Number(args[3]),
|
||||
y: Number(args[4]),
|
||||
z: Number(args[5]),
|
||||
};
|
||||
|
||||
component.push({
|
||||
text: `setting core end pos to x: ${args[3]}, y: ${args[4]}, z: ${args[5]}`,
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
component.push({
|
||||
text: `core start pos: x: ${bot.core.area.start.x}, y: ${bot.core.area.start.y}, z: ${bot.core.area.start.z}, and end pos: x: ${bot.core.area.end.x}, y: ${bot.core.area.end.y}, z: ${bot.core.area.end.z}`,
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "refillmethod":
|
||||
case "rcmethod":
|
||||
switch (args[2]?.toLowerCase()) {
|
||||
case "item":
|
||||
config.core.itemRefill = true;
|
||||
component.push({
|
||||
text: "now refilling via item",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
break;
|
||||
case "chat":
|
||||
config.core.itemRefill = false;
|
||||
component.push({
|
||||
text: "now refilling via chat",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
if (config.core.itemRefill) {
|
||||
component.push({
|
||||
text: "currently filling core via item",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
} else {
|
||||
component.push({
|
||||
text: "currently filling core via chat",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError("invalid argument");
|
||||
}
|
||||
|
||||
if (source.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CoresettingsCommand;
|
||||
@@ -1,37 +0,0 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class KickCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("kick", [], "kick a player from the server", 2, [
|
||||
"invalidstring",
|
||||
"item",
|
||||
"te",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
|
||||
if (!args && !args[0] && !args[1] && !args[2]) return;
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "invalidstring":
|
||||
bot.exploits.crashes.invalidString(args[2]);
|
||||
bot.tellraw("@a", `crashing ${args[2]}`);
|
||||
break;
|
||||
case "item":
|
||||
bot.exploits.kicks.item(args[2]);
|
||||
bot.tellraw("@a", `kicking ${args[2]}`);
|
||||
break;
|
||||
case "te":
|
||||
bot.exploits.kicks.translateEntity(args[2]);
|
||||
bot.tellraw("@a", `kicking ${args[2]}`);
|
||||
break;
|
||||
default:
|
||||
throw new CommandError("invalid argument");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = KickCommand;
|
||||
@@ -1,13 +0,0 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class ReconnectCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("reconnect", ["end"], "reconnects the bot", 2, [""]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
bot._client.end();
|
||||
bot.chat.message("reconnecting");
|
||||
}
|
||||
}
|
||||
module.exports = ReconnectCommand;
|
||||
@@ -1,118 +0,0 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
|
||||
class ConsoleCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("console", ["c"], "runs commands made for the bots console", 4, [
|
||||
"server/srv <all/servername>",
|
||||
"customchat <on/true/enable/off/false/disable>",
|
||||
"say <message>",
|
||||
"validate/validation/val <owner/o/admin/a/trusted/t>",
|
||||
"logging/togglelogging/logtoconsole <on/true/enable/off/false/disable>",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return;
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "server":
|
||||
case "svr":
|
||||
const servers = bot.bots.map((eachBot) => eachBot.options.serverName);
|
||||
for (const eachBot of bot.bots) {
|
||||
if (args.slice(1).join(" ").toLowerCase() === "all") {
|
||||
eachBot.console.server = "all";
|
||||
bot.console.info("Set the console server to all");
|
||||
continue;
|
||||
}
|
||||
const server = servers.find((server) =>
|
||||
server.toLowerCase().includes(args[1]),
|
||||
);
|
||||
if (!server) {
|
||||
bot.console.info("Invalid server");
|
||||
return;
|
||||
}
|
||||
bot.console.info(`Set the console server to ` + server);
|
||||
eachBot.console.server = server;
|
||||
}
|
||||
break;
|
||||
case "say":
|
||||
bot.chat.send(args.slice(1).join(" "));
|
||||
break;
|
||||
case "validate":
|
||||
case "validation":
|
||||
case "val":
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "owner":
|
||||
case "o":
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
case "admin":
|
||||
case "a":
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
case "trusted":
|
||||
case "t":
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "logging":
|
||||
case "togglelogging":
|
||||
case "logtoconsole":
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "on":
|
||||
case "enable":
|
||||
case "enabled":
|
||||
case "true":
|
||||
if (bot.options.logging === true) {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is already enabled!`,
|
||||
);
|
||||
} else {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is now enabled`,
|
||||
);
|
||||
bot.options.logging = true;
|
||||
}
|
||||
break;
|
||||
case "off":
|
||||
case "disable":
|
||||
case "disabled":
|
||||
case "false":
|
||||
if (bot.options.logging === false) {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is already disabled!`,
|
||||
);
|
||||
} else {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is now disabled`,
|
||||
);
|
||||
bot.options.logging = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ConsoleCommand;
|
||||
@@ -1,12 +0,0 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class KillCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("kill", ["suicide", "quit"], "kill the bots process", 3, [""]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
module.exports = KillCommand;
|
||||
@@ -1,42 +0,0 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const { stylize } = require("../../util/stylizeEval");
|
||||
const util = require("util");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class ServerevalCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("servereval", ["se"], "run code unisolated", 4, ["<code>"]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const args = context.arguments;
|
||||
const script = args.slice(1).join(" ");
|
||||
const { MessageBuilder } = require("prismarine-chat")(bot.options.version);
|
||||
try {
|
||||
if (source.sources.console) {
|
||||
bot.console.log(
|
||||
bot
|
||||
.getMessageAsPrismarine({
|
||||
text: util.inspect(eval(args.join(" ")), { stylize }),
|
||||
})
|
||||
?.toAnsi(),
|
||||
);
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(
|
||||
`minecraft:tellraw @a ${JSON.stringify(util.inspect(eval(script), { stylize }).substring(0, 32700))}`,
|
||||
);
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source.player.profile.name}"]`, {
|
||||
text: `${util.inspect(eval(script), { stylize }).substring(0, 32700)}`,
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
throw new CommandError(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ServerevalCommand;
|
||||
@@ -1,36 +0,0 @@
|
||||
const sleep = require("../../util/sleep");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class core extends CommandContext {
|
||||
constructor() {
|
||||
super("core", ["cb", "cbrun", "corerun"], "run commands in core", 0, [
|
||||
"$username <message>",
|
||||
"$uuid <message>",
|
||||
"<message>",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
|
||||
if (args.includes("$username") || args.includes("$uuid")) {
|
||||
bot.players.forEach((eachPlayer) => {
|
||||
bot.core.runTracked(
|
||||
args
|
||||
.join(" ")
|
||||
.replaceAll("$username", eachPlayer.profile.name)
|
||||
.replaceAll("$uuid", eachPlayer.uuid),
|
||||
source,
|
||||
);
|
||||
// await sleep(1000)
|
||||
});
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(args.join(" "));
|
||||
} else {
|
||||
bot.core.runTracked(args.join(" "), source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = core;
|
||||
@@ -1,18 +0,0 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class EchoCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("echo", ["say", "botsay"], "make me say something!", 0, [
|
||||
"<message>",
|
||||
]);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
|
||||
bot.chat.send(`${args.join(" ")}`);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = EchoCommand;
|
||||
@@ -1,446 +0,0 @@
|
||||
const fixansi = require("../../util/ansi");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class HelpCommand extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"help",
|
||||
["heko", "?", "cmds", "commands", "hell"],
|
||||
"see a list of commands",
|
||||
0,
|
||||
["<command>"],
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
|
||||
let component = [];
|
||||
let infoComponent = [];
|
||||
let usagesComponent = [];
|
||||
let Public = [];
|
||||
let trusted = [];
|
||||
let admin = [];
|
||||
let owner = [];
|
||||
let Console = [];
|
||||
|
||||
let cat = {
|
||||
translate: "(%s | %s | %s | %s)",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Public", color: config.colors.help.public },
|
||||
{ text: "Trusted", color: config.colors.help.trusted },
|
||||
{ text: "Admin", color: config.colors.help.admin },
|
||||
{ text: "Owner", color: config.colors.help.owner },
|
||||
],
|
||||
};
|
||||
|
||||
component.push({
|
||||
translate: "%s: (%s) %s \u203a\n",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Commands", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${bot.commandManager.commandlist.length}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
cat,
|
||||
],
|
||||
});
|
||||
for (const commands of bot.commandManager.commandlist) {
|
||||
switch (commands.data.trustLevel) {
|
||||
case 0:
|
||||
Public.push({
|
||||
text: commands.data.name + " ",
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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:
|
||||
bot.chat.message(
|
||||
`fuck you ${commands.data.name} has a invalid trust level`,
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
args[0]?.toLowerCase() === commands.data.name?.toLowerCase() ||
|
||||
commands.data.aliases.find(
|
||||
(e) => e?.toLowerCase() === args[0]?.toLowerCase(),
|
||||
)
|
||||
) {
|
||||
for (const usages of commands.data.usages) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{
|
||||
text: `${config.prefixes[0]}`,
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: `${usages}`, color: config.colors.commands.secondary },
|
||||
],
|
||||
});
|
||||
|
||||
usagesComponent.push("\n");
|
||||
}
|
||||
|
||||
usagesComponent.pop();
|
||||
|
||||
infoComponent.push({
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s:\n",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Name", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.aliases.toString().replaceAll(",", " ")}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Description", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.description}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Trust Level", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.trustLevel}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
],
|
||||
});
|
||||
|
||||
infoComponent.push(usagesComponent);
|
||||
|
||||
if (source?.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(infoComponent)?.toAnsi());
|
||||
} else if (source.sources.discord) {
|
||||
bot.discord.message.reply(
|
||||
`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(infoComponent)?.toAnsi())}\`\`\``,
|
||||
);
|
||||
} else {
|
||||
bot.tellraw(`@a`, infoComponent);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Public.length > 0) {
|
||||
component.push(Public);
|
||||
if (trusted.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
if (trusted.length > 0) {
|
||||
component.push(trusted);
|
||||
if (admin.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
if (admin.length > 0) {
|
||||
component.push(admin);
|
||||
if (owner.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
if (owner.length > 0) {
|
||||
component.push(owner);
|
||||
}
|
||||
|
||||
if (source.sources.console && Console.length > 0) {
|
||||
component.push(Console);
|
||||
}
|
||||
|
||||
if (source?.sources?.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else if (source.sources.discord) {
|
||||
bot.discord.message.reply(
|
||||
`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi())}\`\`\``,
|
||||
);
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = HelpCommand;
|
||||
@@ -1,608 +0,0 @@
|
||||
const os = require("os");
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const fs = require("fs");
|
||||
const botInfo = require("../../data/info.json");
|
||||
const fixansi = require("../../util/ansi.js");
|
||||
const { execSync } = require("child_process");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
function format(seconds) {
|
||||
function pad(s) {
|
||||
return (s < 10 ? "0" : "") + s;
|
||||
}
|
||||
var hours = Math.floor(seconds / (60 * 60));
|
||||
var minutes = Math.floor((seconds % (60 * 60)) / 60);
|
||||
var seconds = Math.floor(seconds % 60);
|
||||
return (
|
||||
pad(`${hours} Hours`) +
|
||||
" " +
|
||||
pad(`${minutes} Minutes`) +
|
||||
" " +
|
||||
pad(`${seconds} Seconds`)
|
||||
);
|
||||
}
|
||||
|
||||
class InfoCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("info", ["information"], "check the bots info", 0, [
|
||||
"about",
|
||||
"config <client, discord, options, all>",
|
||||
"contributors/credits",
|
||||
"discord",
|
||||
"loaded",
|
||||
"usages <bot, server, all>",
|
||||
"uptimes/uptime <bot, server, all>",
|
||||
"server",
|
||||
"version/ver",
|
||||
]);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "about":
|
||||
component.push({
|
||||
text: `FNFBoyfriendBot is a kaboom bot created by Parker2991\nThe source code and changelog can be found here ${botInfo.buildstring.url}`,
|
||||
color: `${config.colors.commands.primary}`,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "click here to view bots source code",
|
||||
color: `${config.colors.commands.primary}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `${botInfo.buildstring.url}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case "config":
|
||||
if (bot.options.isKaboom) {
|
||||
mode = "Kaboom";
|
||||
}
|
||||
if (bot.options.useChat && bot.options.isKaboom) {
|
||||
mode = "Kaboom/Coreless";
|
||||
}
|
||||
if (bot.options.isSavage) {
|
||||
mode = "Savage";
|
||||
}
|
||||
if (bot.options.isCreayun) {
|
||||
mode = "Creayun";
|
||||
}
|
||||
switch (args.slice(1).join(" ")?.toLowerCase()) {
|
||||
case "client":
|
||||
component.push({
|
||||
translate: "%s: %s:%s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.host}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: `${bot.options.port}`, color: config.colors.integer },
|
||||
{ text: "Server Name", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.serverName}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Minecraft Username",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${bot.options.username}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.version}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "discord":
|
||||
if (!config.discord.enabled || discordClient.user === null) {
|
||||
throw new CommandError(
|
||||
"Token is incorrect or discord isnt enabled!",
|
||||
);
|
||||
} else {
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Discord Username",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${discordClient.user.tag}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Discord Channel",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${bot.discord?.channel?.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "options":
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server Count", color: config.colors.commands.primary },
|
||||
{ text: `${bot.bots.length}`, color: config.colors.integer },
|
||||
{ text: "Prefixes", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${config.prefixes.map((e) => e + " ").join(" ")}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Mode", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.mode}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "all":
|
||||
component.push({
|
||||
translate:
|
||||
"%s: %s:%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.host}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: `${bot.options.port}`, color: config.colors.integer },
|
||||
{ text: "Server Name", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.serverName}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Minecraft Username",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${bot.options.username}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.version}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Discord Username",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${discordClient.user?.tag}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Discord Channel",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${bot.discord.channel?.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Server Count", color: config.colors.commands.primary },
|
||||
{ text: `${bot.bots.length}`, color: config.colors.integer },
|
||||
{ text: "Prefixes", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${config.prefixes.map((e) => e + " ").join(" ")}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Mode", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.mode}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "contributors":
|
||||
case "credits":
|
||||
component.push({
|
||||
translate: "%s%s - %s\n%s:\n%s\n%s\n%s\n%s\n%s %s\n%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Parker", color: "dark_red" },
|
||||
{ text: "2991", color: "black" },
|
||||
{ text: "Owner" },
|
||||
{ text: "Contributors" },
|
||||
{ text: "_ChipMC_", color: "dark_blue" },
|
||||
{ text: "chayapak", color: "yellow" },
|
||||
{ text: "_yfd", color: "light_purple" },
|
||||
{ text: "aaa", color: "gold" },
|
||||
{ text: "Morgan", color: "green" },
|
||||
{ text: "Ankan", color: "dark_green" },
|
||||
{ text: "TurtleKid", color: "green" },
|
||||
{ text: "Ploat/ImGloriz", color: "#cd8ccb" },
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "discord":
|
||||
component.push({
|
||||
text: `the discord server invite is ${config.discord.invite}`,
|
||||
color: config.colors.commands.primary,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "click here to join the discord server!",
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `${config.discord.invite}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case "loaded":
|
||||
component.push({
|
||||
translate: "%s %s\n%s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: `${bot.commandManager.commandlist.length}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "Commands", color: config.colors.commands.primary },
|
||||
{ text: `${bot.modules.length}`, color: config.colors.integer },
|
||||
{ text: "Modules", color: config.colors.commands.primary },
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "usages":
|
||||
case "usage":
|
||||
switch (args.slice(1).join(" ")?.toLowerCase()) {
|
||||
case "bot":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Bot Memory",
|
||||
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 },
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "server":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Server Memory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(os.totalmem() / 1048576) - Math.floor(os.freemem() / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Math.floor(os.totalmem() / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "all":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s\n%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Server Memory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(os.totalmem() / 1048576) - Math.floor(os.freemem() / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Math.floor(os.totalmem() / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: "Bot Memory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Math.floor(process.memoryUsage().heapTotal / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
],
|
||||
});
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "uptimes":
|
||||
switch (args.slice(1).join(" ")?.toLowerCase()) {
|
||||
case "bot":
|
||||
component.push({
|
||||
translate: "%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Bot Uptime", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${format(process.uptime())}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "server":
|
||||
component.push({
|
||||
translate: "%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Server Uptime",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${format(os.uptime())}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "all":
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Bot Uptime", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${format(process.uptime())}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Server Uptime",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${format(os.uptime())}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "server":
|
||||
component.push({
|
||||
translate:
|
||||
"%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Hostname", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${os.hostname()}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "User", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${os.userInfo().username}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Working Directory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${require.main.path}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Arch", color: config.colors.commands.primary },
|
||||
{ text: `${os.arch()}`, color: config.colors.commands.secondary },
|
||||
{ text: "OS", color: config.colors.commands.primary },
|
||||
{ text: `${os.platform}`, color: config.colors.commands.secondary },
|
||||
{ text: "OS Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${os.version()}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Kernel Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${os.release()}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "CPU", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${os.cpus()[0].model}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "CPU cores", color: config.colors.commands.primary },
|
||||
{ text: `${os.cpus().length}`, color: config.colors.integer },
|
||||
{ text: "Processes", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${execSync("ps aux | wc -l").toString().replace("\n", "")}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "Node Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${process.version}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "NPM Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${execSync("npm -v").toString().replaceAll("\n", "")}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "version":
|
||||
case "ver":
|
||||
if (botInfo.buildstring.codename.length > 0) {
|
||||
component.push({
|
||||
translate: "%s %s %s-%s-%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s-%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Friday Night Funkin", color: "dark_blue" },
|
||||
{ text: "Boyfriend", color: "dark_aqua" },
|
||||
{ text: "Bot", color: "blue" },
|
||||
{
|
||||
text: `${botInfo.buildstring.version}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
botInfo.buildstring.codename,
|
||||
{ text: "Build", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${botInfo.buildstring.build}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "Repo Build", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${execSync("git rev-list --count --all").toString().replaceAll("\n", "")}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Version Release Date",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${new Date(execSync("git log -1 --format=%ci").toString()).toLocaleString("en-US", { timeZone: "America/CHICAGO" })}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Commit", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "11/22/22", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
} else {
|
||||
component.push({
|
||||
translate: "%s %s %s-%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s-%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Friday Night Funkin", color: "dark_blue" },
|
||||
{ text: "Boyfriend", color: "dark_aqua" },
|
||||
{ text: "Bot", color: "blue" },
|
||||
{
|
||||
text: `${botInfo.buildstring.version}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "Build", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${botInfo.buildstring.build}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "Repo Build", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${execSync("git rev-list --count --all").toString().replaceAll("\n", "")}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Version Release Date",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${new Date(execSync("git log -1 --format=%ci").toString()).toLocaleString("en-US", { timeZone: "America/CHICAGO" })}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Commit", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "11/22/22", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
|
||||
if (source?.sources?.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else if (source.sources.discord) {
|
||||
bot.discord.message.reply(
|
||||
`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi())}\`\`\``,
|
||||
);
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = InfoCommand;
|
||||
@@ -1,54 +0,0 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class ListCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("list", ["pl", "playerlist"], "check whos online on the server", 0, [
|
||||
"",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
|
||||
let component = [];
|
||||
let infoComponent = [];
|
||||
let playerCount = [];
|
||||
|
||||
playerCount.push({
|
||||
translate: "%s: (%s)\n",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Players", color: config.colors.commands.primary },
|
||||
{ text: `${bot.players.length}`, color: config.colors.integer },
|
||||
],
|
||||
});
|
||||
|
||||
component.push(playerCount);
|
||||
|
||||
for (const player of bot.players) {
|
||||
component.push({
|
||||
translate: "%s \u203a %s [%s: %s]",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
player.displayName ?? player.profile.name,
|
||||
{ text: `${player.uuid}`, color: config.colors.commands.primary },
|
||||
{ text: "Latency", color: config.colors.commands.primary },
|
||||
{ text: `${player.latency}`, color: config.colors.integer },
|
||||
],
|
||||
});
|
||||
component.push("\n");
|
||||
}
|
||||
component.pop();
|
||||
|
||||
if (source.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ListCommand;
|
||||
@@ -1,52 +0,0 @@
|
||||
const mc = require("minecraft-protocol");
|
||||
const util = require("util");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
class McserverCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("mcserver", ["pingserver"], "pings minecraft servers", 0, ["<ip>"]);
|
||||
}
|
||||
|
||||
async execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const [host, port] = args[0].split(":");
|
||||
const source = context.source;
|
||||
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,
|
||||
],
|
||||
});
|
||||
|
||||
if (source.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
bot.chat.message(`${e.toString()}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = McserverCommand;
|
||||
@@ -1,65 +0,0 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class NetmsgCommand extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"netmsg",
|
||||
["networkmessage", "netmessage"],
|
||||
"send a message to other servers",
|
||||
0,
|
||||
["<message>"],
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
|
||||
let component = [];
|
||||
|
||||
if (bot.options.private === true) {
|
||||
component.push({
|
||||
translate: "[%s] %s \u203a %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: `${bot.options.serverName}`,
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
source?.player?.displayName ?? source?.player?.profile?.name,
|
||||
{
|
||||
text: `${args.join(" ")}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
} else {
|
||||
component.push({
|
||||
translate: "[%s:%s] %s \u203a %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: `${bot.options.host}`,
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${bot.options.port}`,
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{
|
||||
text: `${args.join(" ")}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
for (const eachBot of bot.bots) {
|
||||
eachBot.tellraw("@a", component);
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = NetmsgCommand;
|
||||
@@ -1,14 +0,0 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class RefillcoreCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("refillcore", ["rc", "refill"], "refill the bots core", 0, [""]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
bot.core.move(bot.position);
|
||||
bot.tellraw("@a", "Refilling core,...");
|
||||
}
|
||||
}
|
||||
module.exports = RefillcoreCommand;
|
||||
@@ -1,121 +0,0 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const { request } = require("undici");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
const fixansi = require("../../util/ansi");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { AttachmentBuilder } = require("discord.js");
|
||||
|
||||
class UrbanCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("urban", ["urbandictionary"], "urban dictionary", 0, [
|
||||
"<definition>",
|
||||
]);
|
||||
}
|
||||
async execute(context) {
|
||||
const source = context.source;
|
||||
const args = context.arguments;
|
||||
const bot = context.bot;
|
||||
const prefix = [
|
||||
{ text: "[", color: "dark_gray" },
|
||||
{ text: "Urban", color: "#B72A00" },
|
||||
{ text: "] ", color: "dark_gray" },
|
||||
];
|
||||
let component = [];
|
||||
let term = `${args.join(" ")}`;
|
||||
const query = new URLSearchParams({ term });
|
||||
const dictResult = await request(
|
||||
`https://api.urbandictionary.com/v0/define?${query}`,
|
||||
);
|
||||
const { list } = await dictResult.body.json();
|
||||
|
||||
if (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 (const definitions of list) {
|
||||
component.push(prefix, [
|
||||
{
|
||||
text: `${definitions.definition.replaceAll("\r", "").replaceAll("[", "\xa71\xa7n\xa7o").replaceAll("]", "\xa7r\xa77")}\n`,
|
||||
color: "gray",
|
||||
underlined: false,
|
||||
italic: false,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Example \u203a \n ${definitions.example.replaceAll("\r", "").replaceAll("[", "\xa71\xa7n\xa7o").replaceAll("]", "\xa7r\xa77")}\n`,
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: `Word \u203a ${definitions.word.replaceAll("\r", "").replaceAll("[", "\xa71\xa7n\xa7o").replaceAll("]", "\xa7r\xa77")}\n`,
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: `Author \u203a ${definitions.author.replaceAll("\r", "").replaceAll("[", "\xa71\xa7n\xa7o").replaceAll("]", "\xa7r\xa77")}\n`,
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: `written on \u203a ${definitions.written_on.replaceAll("\r", "").replaceAll("[", "\xa71\xa7n\xa7o").replaceAll("]", "\xa7r\xa77")}\n`,
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: `Rating \u203a Thumbs-Up ${definitions.thumbs_up} / Thumbs-Down ${definitions.thumbs_down}`,
|
||||
color: "gray",
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `${definitions.permalink}`,
|
||||
},
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
if (source.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else if (source.sources.discord) {
|
||||
const discordOutput = fixansi(
|
||||
bot.getMessageAsPrismarine(component)?.toAnsi(),
|
||||
);
|
||||
|
||||
if (discordOutput.length > 2000) {
|
||||
const output = fs.writeFileSync(
|
||||
path.join(__dirname, "../../output.txt"),
|
||||
JSON.stringify(bot.getMessageAsPrismarine(component)?.toString()),
|
||||
);
|
||||
|
||||
const file = new AttachmentBuilder(
|
||||
path.join(__dirname, "../../output.txt"),
|
||||
);
|
||||
|
||||
bot.discord.message.reply("output", {
|
||||
files: [file],
|
||||
});
|
||||
// bot.discord.message.reply('meow') //[{
|
||||
// files: path.join(__dirname, '../../output.txt')
|
||||
// }])
|
||||
|
||||
// fs.unlinkSync(path.join(__dirname, '../../output.txt'))
|
||||
} else {
|
||||
bot.discord.message.reply(`\`\`\`ansi\n${discordOutput}\`\`\``);
|
||||
}
|
||||
// console.log(discordOutput.length)
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(`minecraft:tellraw @a ${JSON.stringify(component)}`);
|
||||
} else {
|
||||
bot.tellraw(`@a`, component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = UrbanCommand;
|
||||
@@ -1,122 +0,0 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const { request } = require("undici");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class WeatherCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("weather", [], "check the weather in locations", 0, [
|
||||
"<weather/zip code>",
|
||||
]);
|
||||
}
|
||||
async execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
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();
|
||||
|
||||
component.push({
|
||||
translate: "%s\n%s: %s, %s\n%s: %s (%s)\n%s\n%s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
translate: "%s: %s, %s %s",
|
||||
with: [
|
||||
{ text: "Location", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${info.location.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: `${info.location.region}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: `${info.location.country}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
{ text: "Coords", color: config.colors.commands.primary },
|
||||
{ text: `${info.location.lat}`, color: config.colors.integer },
|
||||
{ text: `${info.location.lon}`, color: config.colors.integer },
|
||||
{ text: "Time", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id })}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: `${info.location.tz_id}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
translate: "%s: %s (%s), %s (%s)",
|
||||
with: [
|
||||
{ text: "Temp", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${Math.floor(info.current.temp_c)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "\u00b0C", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Math.floor(info.current.temp_f)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "\u00b0F", color: config.colors.commands.secondary },
|
||||
],
|
||||
},
|
||||
{
|
||||
translate: "%s: %s (%s, %s), %s (%s, %s)",
|
||||
with: [
|
||||
{ text: "Wind Speed", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${Math.floor(info.current.wind_kph)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "kph", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${info.current.wind_dir}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(info.current.wind_mph)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "mph", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${info.current.wind_dir}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
{ text: "Condition", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${info.current.condition.text}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Humidity", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${Math.floor(info.current.humidity)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
if (source.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
} catch (e) {
|
||||
bot.chat.message(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = WeatherCommand;
|
||||
@@ -1,45 +0,0 @@
|
||||
const wiki = require("wikipedia");
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const fixansi = require("../../util/ansi");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class WikiCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("wiki", ["wikipedia"], "wikipedia", 0, ["<article>"]);
|
||||
}
|
||||
async execute(context) {
|
||||
const source = context.source;
|
||||
const args = context.arguments;
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
const page = await wiki.page(args.join(" "));
|
||||
const summary = await page.intro();
|
||||
|
||||
component.push({ text: summary, color: config.colors.commands.primary });
|
||||
|
||||
if (source.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else if (source.sources.discord) {
|
||||
bot.discord.message.reply(
|
||||
`\`\`\`ansi\n${new fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()).ansi}\`\`\``,
|
||||
);
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
} catch (e) {
|
||||
if (
|
||||
e.toString() ===
|
||||
"pageError: TypeError: Cannot read properties of undefined (reading 'pages')"
|
||||
) {
|
||||
bot.tellraw("@a", { text: "no article found!", color: "red" });
|
||||
} else {
|
||||
bot.tellraw(`@a`, `${e.toString()}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = WikiCommand;
|
||||
@@ -1,108 +0,0 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const fixAnsi = require("../../util/ansi");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class CloopCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("cloop", ["commandloop", "loop"], "loops commands", 1, [
|
||||
"add <interval> <command>",
|
||||
"remove <index>",
|
||||
"list",
|
||||
"clear",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
let args;
|
||||
let component = [];
|
||||
|
||||
if (!source.sources.console && !source.sources.discord) {
|
||||
args = context.arguments.slice(16);
|
||||
} else {
|
||||
args = context.arguments;
|
||||
}
|
||||
|
||||
if (
|
||||
!args &&
|
||||
!args[0] &&
|
||||
!args[1] &&
|
||||
!args[2] &&
|
||||
!args[3] &&
|
||||
!args[4] &&
|
||||
!args[5]
|
||||
)
|
||||
return;
|
||||
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "add":
|
||||
if (isNaN(args[1])) throw new CommandError("invalid interval");
|
||||
|
||||
const interval = parseInt(args[1]);
|
||||
const command = args.slice(2).join(" ");
|
||||
bot.cloop.add(command, interval);
|
||||
|
||||
component.push(
|
||||
`added ${command} to the cloops with the interval ${interval}`,
|
||||
);
|
||||
break;
|
||||
case "clear":
|
||||
bot.cloop.clear();
|
||||
component.push("cleared the cloops");
|
||||
break;
|
||||
case "remove":
|
||||
if (isNaN(args[1]))
|
||||
throw new CommandError("argument must be an integer!");
|
||||
|
||||
const index = parseInt(args[1]);
|
||||
bot.cloop.remove(index);
|
||||
|
||||
component.push(`removed ${index} from cloops`);
|
||||
break;
|
||||
case "list":
|
||||
let listComponent = [];
|
||||
let i = 0;
|
||||
for (const cloop of bot.cloop.list) {
|
||||
listComponent.push({
|
||||
translate: "%s \u203a %s (%s)",
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${i}`, color: config.colors.integer },
|
||||
cloop.command,
|
||||
{ text: `${cloop.interval}`, color: config.colors.integer },
|
||||
],
|
||||
});
|
||||
listComponent.push("\n");
|
||||
i++;
|
||||
}
|
||||
|
||||
listComponent.pop();
|
||||
|
||||
component.push({
|
||||
translate: "Cloops (%s):",
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${bot.cloop.list.length}`, color: config.colors.integer },
|
||||
],
|
||||
});
|
||||
component.push("\n");
|
||||
|
||||
if (bot.cloop.list.length > 0) {
|
||||
component.push(listComponent);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError("invalid argument");
|
||||
}
|
||||
|
||||
if (source.sources.discord) {
|
||||
} else if (source.sources.console) {
|
||||
bot.console.info(component);
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CloopCommand;
|
||||
@@ -1,24 +0,0 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class ValidateCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("validate", ["val"], "validate through the bot", 1, [""]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
|
||||
if (args[0] === bot.validation.trusted) {
|
||||
bot.chat.message("&2Valid Trusted hash");
|
||||
}
|
||||
if (args[0] === bot.validation.admin) {
|
||||
bot.chat.message("&2Valid Admin hash");
|
||||
}
|
||||
if (args[0] === bot.validation.owner) {
|
||||
bot.chat.message("&2Valid Owner hash");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ValidateCommand;
|
||||
@@ -1,41 +0,0 @@
|
||||
const CommandError = require("../../commandUtil/CommandError");
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class kick extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"kick",
|
||||
[],
|
||||
"kick a player from the server",
|
||||
trustLevel.admin,
|
||||
["invalidstring", "item", "te"],
|
||||
false,
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
|
||||
if (!args && !args[0] && !args[1] && !args[2]) return;
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "invalidstring":
|
||||
bot.exploits.crashes.invalidString(args[2]);
|
||||
bot.tellraw("@a", `crashing ${args[2]}`);
|
||||
break;
|
||||
case "item":
|
||||
bot.exploits.kicks.item(args[2]);
|
||||
bot.tellraw("@a", `kicking ${args[2]}`);
|
||||
break;
|
||||
case "te":
|
||||
bot.exploits.kicks.translateEntity(args[2]);
|
||||
bot.tellraw("@a", `kicking ${args[2]}`);
|
||||
break;
|
||||
default:
|
||||
throw new CommandError("invalid argument");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = kick;
|
||||
@@ -0,0 +1,95 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "cloop",
|
||||
aliases: [
|
||||
"commandloop",
|
||||
"loop"
|
||||
],
|
||||
description: "loops commands",
|
||||
enabled: true,
|
||||
usages: [
|
||||
|
||||
]
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4] && !args[5]) return;
|
||||
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "add":
|
||||
if (isNaN(args[1]) === true) throw new CommandError("invalid interval");
|
||||
|
||||
const interval = parseInt(args[1]);
|
||||
const command = args.slice(2).join(' ');
|
||||
bot.cloop.add(command, interval);
|
||||
|
||||
bot.console.command(`added ${command} to the cloops with the interval ${interval}`);
|
||||
break;
|
||||
case "clear":
|
||||
bot.cloop.clear();
|
||||
bot.console.command('cleared the cloops');
|
||||
break;
|
||||
case "remove":
|
||||
// if (isNaN(args[1]) === true) throw new CommandError('argument must be an integer!');
|
||||
|
||||
const index = parseInt(args[1]);
|
||||
bot.cloop.remove(index);
|
||||
|
||||
bot.chat.message(`removed ${index} from cloops`);
|
||||
break;
|
||||
case "list":
|
||||
const component = []
|
||||
|
||||
const listComponent = []
|
||||
let i = 0
|
||||
for (const cloop of bot.cloop.list) {
|
||||
listComponent.push({
|
||||
translate: '%s \u203a %s (%s)',
|
||||
color: "dark_blue",
|
||||
with: [
|
||||
{ text: `${i}`, color: "gold" },
|
||||
cloop.command,
|
||||
{ text: `${cloop.interval}`, color: "gold" },
|
||||
]
|
||||
})
|
||||
listComponent.push('\n')
|
||||
i++
|
||||
}
|
||||
|
||||
listComponent.pop()
|
||||
|
||||
component.push({
|
||||
translate: 'Cloops (%s):',
|
||||
color: "dark_blue",
|
||||
with: [
|
||||
{ text: `${bot.cloop.list.length}`, color: "gold"}
|
||||
]
|
||||
})
|
||||
component.push('\n')
|
||||
|
||||
if (bot.cloop.list.length > 0) {
|
||||
component.push(listComponent)
|
||||
}
|
||||
bot.console.command(component);
|
||||
/*
|
||||
if (bot.cloop.list.length === 0) {
|
||||
bot.tellraw(`@a[name="${source?.player.profile?.name}"]`, {
|
||||
translate: 'Cloops (%s):',
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${bot.cloop.list.length}`, color: config.colors. }
|
||||
]
|
||||
})
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)
|
||||
}*/
|
||||
break;
|
||||
default:
|
||||
bot.console.command("invalid argument")
|
||||
//throw new CommandError('invalid argument')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
const CommandError = require("../../commandUtil/CommandError");
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class console extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"console",
|
||||
["c"],
|
||||
"runs commands made for the bots console",
|
||||
trustLevel.console,
|
||||
[
|
||||
"server/srv <all/servername>",
|
||||
"customchat <on/true/enable/off/false/disable>",
|
||||
"say <message>",
|
||||
"validate/validation/val <owner/o/admin/a/trusted/t>",
|
||||
"logging/togglelogging/logtoconsole <on/true/enable/off/false/disable>",
|
||||
],
|
||||
false,
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return;
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "server":
|
||||
case "svr":
|
||||
const servers = bot.bots.map((eachBot) => eachBot.options.serverName);
|
||||
for (const eachBot of bot.bots) {
|
||||
if (args.slice(1).join(" ").toLowerCase() === "all") {
|
||||
eachBot.console.server = "all";
|
||||
bot.console.info("Set the console server to all");
|
||||
continue;
|
||||
}
|
||||
const server = servers.find((server) =>
|
||||
server.toLowerCase().includes(args[1]),
|
||||
);
|
||||
if (!server) {
|
||||
bot.console.info("Invalid server");
|
||||
return;
|
||||
}
|
||||
bot.console.info(`Set the console server to ` + server);
|
||||
eachBot.console.server = server;
|
||||
}
|
||||
break;
|
||||
case "say":
|
||||
bot.chat.send(args.slice(1).join(" "));
|
||||
break;
|
||||
case "validate":
|
||||
case "validation":
|
||||
case "val":
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "owner":
|
||||
case "o":
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
case "admin":
|
||||
case "a":
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
case "trusted":
|
||||
case "t":
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "logging":
|
||||
case "togglelogging":
|
||||
case "logtoconsole":
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "on":
|
||||
case "enable":
|
||||
case "enabled":
|
||||
case "true":
|
||||
if (bot.options.logging === true) {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is already enabled!`,
|
||||
);
|
||||
} else {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is now enabled`,
|
||||
);
|
||||
bot.options.logging = true;
|
||||
}
|
||||
break;
|
||||
case "off":
|
||||
case "disable":
|
||||
case "disabled":
|
||||
case "false":
|
||||
if (bot.options.logging === false) {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is already disabled!`,
|
||||
);
|
||||
} else {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is now disabled`,
|
||||
);
|
||||
bot.options.logging = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = console;
|
||||
@@ -0,0 +1,19 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "core",
|
||||
enabled: true,
|
||||
aliases: [
|
||||
"cb",
|
||||
"corerun"
|
||||
],
|
||||
description: "run commands in core",
|
||||
usages: [
|
||||
"<command>"
|
||||
]
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
bot.core.run(args.join(' '));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "customchat",
|
||||
enabled: true,
|
||||
aliases: [
|
||||
],
|
||||
description: "toggle the custom chat",
|
||||
usages: [
|
||||
"enable/disable"
|
||||
]
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "enable":
|
||||
bot.customChat.enabled = true;
|
||||
bot.console.command('enabling custom chat');
|
||||
break;
|
||||
case "disable":
|
||||
bot.customChat.enabled = false;
|
||||
bot.console.command('disabling custom chat');
|
||||
break;
|
||||
default:
|
||||
bot.console.command(`Custom chat is ${bot.customChat.enabled}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "echo",
|
||||
enabled: true,
|
||||
aliases: [
|
||||
"say",
|
||||
"botsay"
|
||||
],
|
||||
description: "send things in chat",
|
||||
usages: [
|
||||
"<message>"
|
||||
]
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
bot._client.chat(args.join(' '));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
const { stylize } = require('../util/eval_colors');
|
||||
const util = require('util');
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "eval",
|
||||
enabled: true,
|
||||
aliases: [
|
||||
],
|
||||
description: "self explanatory",
|
||||
usages: [
|
||||
"<input>"
|
||||
]
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
try {
|
||||
bot.console.command(util.inspect(eval(args.join(' ')), { stylize }));
|
||||
} catch (e) {
|
||||
bot.console.command(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "help",
|
||||
enabled: true,
|
||||
aliases: [
|
||||
"heko",
|
||||
"?",
|
||||
"cmds",
|
||||
"commands"
|
||||
],
|
||||
description: "get a list of the commands",
|
||||
usages: [
|
||||
"<command>"
|
||||
]
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
let commandComponent = [];
|
||||
let outputComponent = [];
|
||||
let colorMix = true;
|
||||
for (const commands of bot.commandManager.commandlist) {
|
||||
let usagesComponent = [];
|
||||
let infoComponent = [];
|
||||
for (const usages of commands.data.usages) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.console.prefix}`, color: "dark_blue" },
|
||||
{ text: `${commands.data.name}`, color: "aqua" },
|
||||
{ text: `${usages}`, color: "blue" },
|
||||
]
|
||||
});
|
||||
|
||||
usagesComponent.push("\n");
|
||||
}
|
||||
usagesComponent.pop();
|
||||
|
||||
infoComponent.push({
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s:",
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: "Command Name", color: "dark_blue" },
|
||||
{ text: `${commands.data.name}`, color: "blue" },
|
||||
{ text: "Aliases", color: "dark_blue" },
|
||||
{ text: `${commands.data.aliases.toString().replaceAll(',',' ')}`, color: "blue" },
|
||||
{ text: "Description", color: "dark_blue" },
|
||||
{ text: `${commands.data.description}`, color: "blue" },
|
||||
{ text: "Usages", color: "dark_blue" },
|
||||
]
|
||||
});
|
||||
|
||||
infoComponent.push("\n");
|
||||
|
||||
infoComponent.push(usagesComponent);
|
||||
|
||||
if (args[0]?.toLowerCase() === commands.data.name) {
|
||||
bot.console.command(infoComponent);
|
||||
return;
|
||||
}
|
||||
|
||||
commandComponent.push({
|
||||
text: commands.data.name + ' ',
|
||||
color: (!(colorMix = !colorMix) ? "aqua" : "dark_blue")
|
||||
});
|
||||
}
|
||||
|
||||
outputComponent.push({
|
||||
translate: "%s (%s) \u203a\n %s",
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: "Commands", color: "blue" },
|
||||
{ text: `${bot.commandManager.commandlist.length}`, color: "gold" },
|
||||
commandComponent
|
||||
]
|
||||
})
|
||||
|
||||
bot.console.command(outputComponent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
const { request } = require('undici');
|
||||
const { execSync } = require('child_process');
|
||||
const { buildstring } = require('../data/info.json');
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "info",
|
||||
enabled: true,
|
||||
aliases: [
|
||||
"information",
|
||||
],
|
||||
description: "bot information",
|
||||
usages: [
|
||||
"version"
|
||||
]
|
||||
},
|
||||
async execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
let component = [];
|
||||
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "version":
|
||||
let fnfbfbotversionurl = await request('https://code.chipmunk.land/api/v1/repos/Parker2991/FridayNightFunkinBoyfriendBot/releases');
|
||||
let fnfbfbotcommiturl = await request('https://code.chipmunk.land/api/v1/repos/Parker2991/FridayNightFunkinBoyfriendBot/commits');
|
||||
|
||||
let urlVersionData = await fnfbfbotversionurl.body.json();
|
||||
let urlCommitData = await fnfbfbotcommiturl.body.json();
|
||||
let urlVersionOutput = urlVersionData[0];
|
||||
let urlCommitOutput = urlCommitData[0];
|
||||
|
||||
component.push({
|
||||
translate: "%s%s-%s\n%s: %s\n%s: %s\n\n%s%s%s-%s\n%s: %s",
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: "Ski", color: "aqua" },
|
||||
{ text: "Bot", color: "blue" },
|
||||
{ text: `${buildstring.version}`, color: "blue" },
|
||||
{ text: "Build", color: "dark_blue" },
|
||||
{ text: `${buildstring.build}`, color: "blue" },
|
||||
{ text: "Commit", color: "dark_blue" },
|
||||
{ text: `${execSync("git rev-parse HEAD").toString().substring(0, 10).replaceAll('\n', '')}`, color: "blue" },
|
||||
{ text: "FNF", color: "dark_blue" },
|
||||
{ text: "Boyfriend", color: "dark_aqua" },
|
||||
{ text: "Bot", color: "blue" },
|
||||
{ text: `${urlVersionOutput.name}`, color: "blue" },
|
||||
{ text: "Commit", color: "dark_blue" },
|
||||
{ text: `${urlCommitOutput.sha.substring(0, 10)}`, color: "blue" }
|
||||
]
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bot.console.command('SkiBot is a client chat bot created by Parker2991 using Custom FNFBoyfriendBot source\nSkiBot\'s source can be found at https://code.chipmunk.land/Parker2991/SkiBot.git\nFNFBoyfriendBot\'s source can be found at https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot.git\n\nthe idea of the bot is to try and make it close to a minecraft java client as much as i can')
|
||||
}
|
||||
bot.console.command(component);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "kick",
|
||||
enabled: true,
|
||||
aliases: [
|
||||
],
|
||||
description: "kick players",
|
||||
usages: [
|
||||
"invalidstring <player>",
|
||||
"item <player>",
|
||||
]
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "invalidstring":
|
||||
bot.exploits.crashes.invalidString(args.slice(1).join(' '));
|
||||
bot.console.command(`Crashing ${args.slice(1).join(' ')}`);
|
||||
break;
|
||||
case "item":
|
||||
bot.exploits.kicks.item(args.slice(1).join(' '));
|
||||
bot.console.command(`Kicking ${args.slice(1).join(' ')}`);
|
||||
break;
|
||||
case "te":
|
||||
bot.exploits.kicks.translateEntity(args.slice(1).join(' '))
|
||||
break;
|
||||
default:
|
||||
bot.console.command("invalid argument");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "kill",
|
||||
enabled: true,
|
||||
aliases: [
|
||||
],
|
||||
description: "kills the process",
|
||||
usages: [
|
||||
]
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
process.exit();
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class kill extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"kill",
|
||||
[
|
||||
"suicide",
|
||||
"quit"
|
||||
],
|
||||
"kill the bots process",
|
||||
trustLevel.owner,
|
||||
[""],
|
||||
false
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
module.exports = kill;
|
||||
@@ -1,46 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class core extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"core",
|
||||
[
|
||||
"cb",
|
||||
"cbrun",
|
||||
"corerun"
|
||||
],
|
||||
"run commands in core",
|
||||
trustLevel.public,
|
||||
[
|
||||
"$username <message>",
|
||||
"$uuid <message>",
|
||||
"<message>"
|
||||
],
|
||||
false,
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
|
||||
if (args.includes("$username") || args.includes("$uuid")) {
|
||||
bot.players.forEach((eachPlayer) => {
|
||||
bot.core.runTracked(
|
||||
args
|
||||
.join(" ")
|
||||
.replaceAll("$username", eachPlayer.profile.name)
|
||||
.replaceAll("$uuid", eachPlayer.uuid),
|
||||
source,
|
||||
);
|
||||
});
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(args.join(" "));
|
||||
} else {
|
||||
bot.core.runTracked(args.join(" "), source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = core;
|
||||
@@ -1,26 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class echo extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"echo",
|
||||
[
|
||||
"say",
|
||||
"botsay"
|
||||
],
|
||||
"make me say something!",
|
||||
trustLevel.public,
|
||||
[""],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
bot.chat.send(`${args.join(" ")}`);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = echo;
|
||||
@@ -1,57 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class extras extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"extras",
|
||||
[],
|
||||
"send messages via the extras channel",
|
||||
trustLevel.public,
|
||||
[
|
||||
"send",
|
||||
"register",
|
||||
"unregister",
|
||||
"unregisterall"
|
||||
],
|
||||
true,
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source
|
||||
|
||||
if (
|
||||
!args
|
||||
&&
|
||||
!args[0]
|
||||
&&
|
||||
!args[1]
|
||||
&&
|
||||
!args[2]
|
||||
) return;
|
||||
|
||||
switch (args[0]) {
|
||||
case "send":
|
||||
bot.extras.send(args[1], args.slice(2).join(" "))
|
||||
source.sendFeedback(`sent ${args.slice(2).join(" ")} to channel ${args[1]}`)
|
||||
break
|
||||
case "register":
|
||||
bot.extras.register(args[1])
|
||||
source.sendFeedback(`registered ${args[1]} channel`)
|
||||
break
|
||||
case "unregister":
|
||||
bot.extras.unregister(args[1])
|
||||
source.sendFeedback(`unregistered from ${args[1]} channel`)
|
||||
console.log(bot.extras.channels)
|
||||
break
|
||||
case "unregisterall":
|
||||
bot.extras.unregisterAll();
|
||||
source.sendFeedback("unregistered all channels")
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = extras;
|
||||
@@ -1,229 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class help extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"help",
|
||||
[
|
||||
"heko",
|
||||
"?",
|
||||
"cmds",
|
||||
"commands",
|
||||
"hell"
|
||||
],
|
||||
"see a list of commands",
|
||||
trustLevel.public,
|
||||
["<command>"],
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
const translations = bot.translations;
|
||||
|
||||
let component = [];
|
||||
let infoComponent = [];
|
||||
let usagesComponent = [];
|
||||
let Public = [];
|
||||
let trusted = [];
|
||||
let admin = [];
|
||||
let owner = [];
|
||||
let Console = [];
|
||||
|
||||
component.push({
|
||||
translate: "%s %s \u203a\n",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.command_layout",
|
||||
fallback: translations["fnfboyfriendbot.command.help.command_layout"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ':', color: config.colors.commands.tertiary },
|
||||
{ text: '(', color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.commandManager.commandlist.length}`, color: config.colors.integer },
|
||||
{ text: ')', color: config.colors.commands.tertiary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.category",
|
||||
fallback: translations["fnfboyfriendbot.command.help.category"],
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.trust_level.public",
|
||||
fallback: translations["fnfboyfriendbot.command.help.trust_level.public"],
|
||||
color: config.colors.help.public
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.trust_level.trusted",
|
||||
fallback: translations["fnfboyfriendbot.command.help.trust_level.trusted"],
|
||||
color: config.colors.help.trusted
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.trust_level.admin",
|
||||
fallback: translations["fnfboyfriendbot.command.help.trust_level.admin"],
|
||||
color: config.colors.help.admin
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.trust_level.owner",
|
||||
fallback: translations["fnfboyfriendbot.command.help.trust_level.owner"],
|
||||
color: config.colors.help.owner
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
for (const commands of bot.commandManager.commandlist) {
|
||||
switch (commands.data.trustLevel) {
|
||||
case 0:
|
||||
Public.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.public,
|
||||
});
|
||||
break;
|
||||
case 1:
|
||||
trusted.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.trusted,
|
||||
});
|
||||
break;
|
||||
case 2:
|
||||
admin.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.admin,
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
owner.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.owner,
|
||||
});
|
||||
break;
|
||||
case 4:
|
||||
Console.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.console,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
if (
|
||||
args[0]?.toLowerCase() === commands.data.name?.toLowerCase() ||
|
||||
commands.data.aliases.find(
|
||||
(e) => e?.toLowerCase() === args[0]?.toLowerCase(),
|
||||
)
|
||||
) {
|
||||
for (const usages of commands.data.usages) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{
|
||||
text: `${config.prefixes[0]}`,
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: `${usages}`, color: config.colors.commands.secondary },
|
||||
],
|
||||
});
|
||||
|
||||
usagesComponent.push("\n");
|
||||
}
|
||||
|
||||
usagesComponent.pop();
|
||||
|
||||
infoComponent.push({
|
||||
translate: "%s\n%s\n%s\n%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.info.command",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.command"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
commands.data.name,
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.info.alias",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.alias"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
commands.data.aliases.toString().replaceAll(',',' ')
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.info.description",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.description"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
commands.data.description
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.info.trust_level",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.trust_level"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${commands.data.trustLevel}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.usages",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.usages"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
usagesComponent
|
||||
]
|
||||
},
|
||||
|
||||
]
|
||||
})
|
||||
source.sendFeedback(infoComponent)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Public.length > 0) {
|
||||
component.push(Public);
|
||||
if (trusted.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
if (trusted.length > 0) {
|
||||
component.push(trusted);
|
||||
if (admin.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
if (admin.length > 0) {
|
||||
component.push(admin);
|
||||
if (owner.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
if (owner.length > 0) {
|
||||
component.push(owner);
|
||||
}
|
||||
|
||||
if (source.sources.console && Console.length > 0) {
|
||||
component.push(Console);
|
||||
}
|
||||
|
||||
source.sendFeedback(component)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = help;
|
||||
@@ -1,457 +0,0 @@
|
||||
const os = require("os");
|
||||
const CommandError = require("../../commandUtil/CommandError");
|
||||
const botInfo = require("../../data/info.json");
|
||||
const { execSync } = require("child_process");
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
function format(seconds) {
|
||||
function pad(s) {
|
||||
return (s < 10 ? "0" : "") + s;
|
||||
}
|
||||
var hours = Math.floor(seconds / (60 * 60));
|
||||
var minutes = Math.floor((seconds % (60 * 60)) / 60);
|
||||
var seconds = Math.floor(seconds % 60);
|
||||
return (
|
||||
pad(`${hours} Hours`) +
|
||||
" " +
|
||||
pad(`${minutes} Minutes`) +
|
||||
" " +
|
||||
pad(`${seconds} Seconds`)
|
||||
);
|
||||
}
|
||||
|
||||
class info extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"info",
|
||||
["information"],
|
||||
"check the bots info",
|
||||
trustLevel.public,
|
||||
[
|
||||
"about",
|
||||
"config",
|
||||
"contributors/credits",
|
||||
"discord",
|
||||
"loaded",
|
||||
"usages ",
|
||||
"uptimes",
|
||||
"server",
|
||||
"version",
|
||||
],
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const source = context.source;
|
||||
const translations = bot.translations;
|
||||
let component = [];
|
||||
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "about":
|
||||
component.push({
|
||||
translate: "fnfboyfriendbot.command.info.about",
|
||||
fallback: translations["fnfboyfriendbot.command.info.about"],
|
||||
color: config.colors.commands.primary,
|
||||
})
|
||||
break;
|
||||
case "config":
|
||||
component.push({
|
||||
translate: "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.server.ip",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.server.ip"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.options.host}`, color: config.colors.commands.primary },
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.options.port}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.server.name",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.server.name"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
bot.options.serverName
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.minecraft.username",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.minecraft.username"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot._client.username}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.minecraft.version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.minecraft.version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot._client.version}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.discord.username",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.discord.username"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${discordClient?.user?.tag}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.discord.channel",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.discord.channel"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.discord?.channel?.name}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.server.count",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.server.count"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.bots.length}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.prefixes",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.prefixes"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${config.prefixes.map((e) => e + " ").join(' ')}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.mode",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.mode"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.options.mode}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "contributors":
|
||||
case "credits":
|
||||
component.push({
|
||||
translate: "%s%s - %s\n%s:\n%s\n%s\n%s\n%s\n%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Parker", color: "dark_red" },
|
||||
{ text: "2991", color: "black" },
|
||||
{ text: "Owner" },
|
||||
{ text: "Contributors" },
|
||||
{ text: "_ChipMC_", color: "dark_blue" },
|
||||
{ text: "chayapak", color: "yellow" },
|
||||
{ text: "_yfd", color: "light_purple" },
|
||||
{ text: "aaa/ImFloriz", color: "gold" },
|
||||
{ text: "Ploat/ImGloriz", color: "#cd8ccb" },
|
||||
{ text: "TurtleKid", color: "green" }
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "discord":
|
||||
component.push({
|
||||
translate: "fnfboyfriendbot.command.info.discord",
|
||||
fallback: translations["fnfboyfriendbot.command.info.discord"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${config.discord.invite}`, color: config.colors.commands.secondary }
|
||||
],
|
||||
hover_event: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "click here to join the discord server!",
|
||||
color: `${config.colors.commands.primary}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
click_event: {
|
||||
action: "open_url",
|
||||
url: `${config.discord.invite}`,
|
||||
}
|
||||
})
|
||||
break;
|
||||
case "loaded":
|
||||
component.push({
|
||||
translate: "%s\n%s",
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.loaded.commands",
|
||||
fallback: translations["fnfboyfriendbot.command.info.loaded.commands"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${bot.commandManager.commandlist.length}`, color: config.colors.integer}
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.loaded.modules",
|
||||
fallback: translations["fnfboyfriendbot.command.info.loaded.modules"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${bot.modules.length}`, color: config.colors.integer }
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "server":
|
||||
component.push({
|
||||
translate: "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s",
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.hostname",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.hostname"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.hostname()}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.user",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.user"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.userInfo().username}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.directory",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.directory"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${require.main.path}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.arch",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.arch"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.arch}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.os",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.os"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.platform}`, color: config.colors.commands.primary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.os.version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.os.version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.version()}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.kernel_version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.kernel_version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.release()}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.cpu",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.cpu"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.cpus()[0].model}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.cpu.cores",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.cpu.cores"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.cpus().length}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.processes",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.processes"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${execSync("ps aux | wc -l").toString().replace("\n", "")}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.node_version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.node_version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${process.version}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.npm_version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.npm_version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${execSync("npm -v").toString().replaceAll("\n", "")}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "usages":
|
||||
component.push({
|
||||
translate: "%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.usages.botmem",
|
||||
fallback: translations["fnfboyfriendbot.command.info.usages.botmem"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576)}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.usages.servermem",
|
||||
fallback: translations["fnfboyfriendbot.command.info.usages.servermem"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${Math.floor(os.totalmem() / 1048576) - Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer }
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
break;
|
||||
case "uptimes":
|
||||
component.push({
|
||||
translate: "%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.uptimes.bot",
|
||||
fallback: translations["fnfboyfriendbot.command.info.uptimes.bot"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${format(process.uptime())}`}
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.uptimes.server",
|
||||
fallback: translations["fnfboyfriendbot.command.info.uptimes.server"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${format(os.uptime())}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
}
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "version":
|
||||
component.push({
|
||||
translate: "%s %s %s-%s-%s\n%s\n%s\n%s\n%s\n%s-%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Friday Night Funkin", color: "dark_blue" },
|
||||
{ text: "Boyfriend", color: "dark_aqua" },
|
||||
{ text: "Bot", color: "blue" },
|
||||
{
|
||||
text: `${botInfo.buildstring.version}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
botInfo.buildstring.codename || '',
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.version.build",
|
||||
fallback: translations["fnfboyfriendbot.command.info.version.build"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${botInfo.buildstring.build}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.version.repo_build",
|
||||
fallback: translations["fnfboyfriendbot.command.info.version.repo_build"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${execSync("git rev-list --count --all").toString().replaceAll("\n", "")}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.version.version_release_date",
|
||||
fallback: translations["fnfboyfriendbot.command.info.version.version_release_date"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${new Date(execSync("git log -1 --format=%ci").toString()).toLocaleString("en-US", { timeZone: "America/CHICAGO" })}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.version.commit",
|
||||
fallback: translations["fnfboyfriendbot.command.info.version.commit"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{ text: "11/22/22", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
|
||||
source.sendFeedback(component);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = info;
|
||||
@@ -1,57 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class list extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"list",
|
||||
[
|
||||
"pl",
|
||||
"playerlist"
|
||||
],
|
||||
"check whos online on the server",
|
||||
trustLevel.public,
|
||||
[""],
|
||||
false
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
let playerCount = [];
|
||||
|
||||
playerCount.push({
|
||||
translate: "%s: (%s)\n",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Players", color: config.colors.commands.primary },
|
||||
{ text: `${bot.players.length}`, color: config.colors.integer },
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
component.push(playerCount);
|
||||
|
||||
for (const player of bot.players) {
|
||||
component.push({
|
||||
translate: "%s \u203a %s [%s: %s]",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
player.displayName ?? player.profile.name,
|
||||
{ text: `${player.uuid}`, color: config.colors.commands.primary },
|
||||
{ text: "Latency", color: config.colors.commands.primary },
|
||||
{ text: `${player.latency}`, color: config.colors.integer }
|
||||
]
|
||||
})
|
||||
component.push("\n");
|
||||
}
|
||||
component.pop();
|
||||
|
||||
source.sendFeedback(component)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = list;
|
||||
@@ -1,87 +0,0 @@
|
||||
const mc = require("minecraft-protocol");
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class mcserver extends CommandContext {
|
||||
constructor() {
|
||||
super("mcserver",
|
||||
["pingserver"],
|
||||
"pings minecraft servers",
|
||||
trustLevel.public,
|
||||
["<ip>"],
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
async execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const translations = bot.translations
|
||||
const [host, port] = args[0].split(':')
|
||||
|
||||
let component = [];
|
||||
if (isNaN(port) && port) {
|
||||
source.sendFeedback({
|
||||
translate: "fnfboyfriendbot.arguments.invalid_integer",
|
||||
fallback: translations["fnfboyfriendbot.arguments.invalid_integer"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: "Port" }
|
||||
]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
process.on('uncaughtException', (error) => {
|
||||
console.log(error)
|
||||
source.sendFeedback({
|
||||
translate: "fnfboyfriendbot.command.mcserver.server.unknown",
|
||||
fallback: translations["fnfboyfriendbot.command.mcserver.server.unknown"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: `${host}` },
|
||||
{ text: `${Number(port ?? 25565)}` }
|
||||
]
|
||||
})
|
||||
})
|
||||
|
||||
const server = await mc.ping({ host, port: Number(port ?? 25565) })
|
||||
|
||||
component.push({
|
||||
translate: "%s\n%s\n%s\n%s",
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.mcserver.ip",
|
||||
fallback: translations["fnfboyfriendbot.command.mcserver.ip"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${host}`, color: config.colors.commands.secondary },
|
||||
{ text: `${Number(port ?? 25565)}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.mcserver.players",
|
||||
fallback: translations["fnfboyfriendbot.command.mcserver.players"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${server.players.online}`, color: config.colors.integer },
|
||||
{ text: `${server.players.max}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.mcserver.server.version",
|
||||
fallback: translations["fnfboyfriendbot.command.mcserver.server.version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${server.version.name}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
server.description
|
||||
]
|
||||
})
|
||||
source.sendFeedback(component)
|
||||
}
|
||||
}
|
||||
module.exports = mcserver;
|
||||
@@ -1,54 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class netmsg extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"netmsg",
|
||||
[
|
||||
"networkmessage",
|
||||
],
|
||||
"send a message to other servers that the bot is connected to",
|
||||
trustLevel.public,
|
||||
["<message>"],
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
|
||||
if (bot.options.private === true) {
|
||||
component.push({
|
||||
translate: "[%s] %s \u203a %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: `${bot.options.serverName}`, color: config.colors.commands.primary },
|
||||
source?.player?.displayName ?? source?.player?.profile?.name,
|
||||
{ text: `${args.join(' ')}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
})
|
||||
} else {
|
||||
component.push({
|
||||
translate: "[%s:%s] %s \u203a %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: `${bot.options.host}`, color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.port}`, color: config.colors.commands.primary },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: `${args.join(' ')}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
for (const eachBot of bot.bots) {
|
||||
eachBot.tellraw("@a", component)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = netmsg;
|
||||
@@ -1,32 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class refillcore extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"rc",
|
||||
[
|
||||
"refill",
|
||||
"refillcore"
|
||||
],
|
||||
"refill the bots core",
|
||||
trustLevel.public,
|
||||
[""],
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source
|
||||
|
||||
bot.core.move(bot.position);
|
||||
|
||||
source.sendFeedback({
|
||||
translation: "command.core.refill",
|
||||
}) // most likely wont be seen most of the time
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = refillcore;
|
||||
@@ -1,49 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
const between = require('../../util/between');
|
||||
|
||||
class rtp extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"rtp",
|
||||
[
|
||||
"randomtp",
|
||||
"tpr",
|
||||
"tprandom"
|
||||
],
|
||||
"teleport to a random place. This was ported from FNFBoyfriendBot v4.x",
|
||||
trustLevel.public,
|
||||
[""],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
const translations = bot.translations;
|
||||
const x = between(-1_000_000, 1_000_000);
|
||||
const y = 100;
|
||||
const z = between(-1_000_000, 1_000_000);
|
||||
let component = [];
|
||||
|
||||
bot.core.run(`essentials:tp ${source.player.uuid} ${x} ${y} ${z}`)
|
||||
|
||||
component.push({
|
||||
translate: "fnfboyfriendbot.command.rtp",
|
||||
fallback: translations["fnfboyfriendbot.command.rtp"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${source.player.profile.name}`, color: config.colors.commands.secondary },
|
||||
{ text: `${x}`, color: config.colors.integer },
|
||||
{ text: `${y}`, color: config.colors.integer },
|
||||
{ text: `${z}`, color: config.colors.integer }
|
||||
]
|
||||
})
|
||||
|
||||
bot.tellraw('@a', component)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = rtp
|
||||
@@ -1,25 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class test extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"test",
|
||||
[],
|
||||
"testing stuff",
|
||||
trustLevel.public,
|
||||
[""],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
|
||||
bot.chat.message('meow')
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = test;
|
||||
@@ -1,126 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
const { request } = require('undici');
|
||||
|
||||
class urban extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"urban",
|
||||
[
|
||||
"urbandictionary"
|
||||
],
|
||||
"look up definitions on urban dictionary",
|
||||
trustLevel.public,
|
||||
["<definition>"],
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
async execute(context) {
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const translations = bot.translations;
|
||||
let term = args.join(' ');
|
||||
|
||||
try {
|
||||
const prefix = {
|
||||
translate: "[%s] ",
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.urban.text",
|
||||
fallback: translations["fnfboyfriendbot.command.urban.text"],
|
||||
color: "#B72A00"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const query = new URLSearchParams({ term });
|
||||
const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`);
|
||||
const { list } = await dictResult.body.json();
|
||||
let component = [];
|
||||
|
||||
for (const definitions of list) {
|
||||
component.push(prefix, [
|
||||
{
|
||||
text: `${definitions.definition.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray',
|
||||
underlined: false,
|
||||
italic: false,
|
||||
translate: ""
|
||||
}
|
||||
])
|
||||
}
|
||||
source.sendFeedback(component)
|
||||
} catch (e) {
|
||||
bot.console.error(e.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = urban;
|
||||
|
||||
/*
|
||||
const prefix = [
|
||||
{ text: '[', color: 'dark_gray' },
|
||||
{ text: 'Urban', color: '#B72A00' },
|
||||
{ text: '] ', color: 'dark_gray'}
|
||||
]
|
||||
let component = [];
|
||||
let term = `${args.join(' ')}`
|
||||
const query = new URLSearchParams({ term });
|
||||
const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`);
|
||||
const { list } = await dictResult.body.json();
|
||||
|
||||
if (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, [
|
||||
{
|
||||
text: `${definitions.definition.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray',
|
||||
underlined: false,
|
||||
italic: false,
|
||||
translate: "",
|
||||
hover_event: {
|
||||
action:"show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Example \u203a \n ${definitions.example.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Word \u203a ${definitions.word.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray',
|
||||
},
|
||||
{
|
||||
text: `Author \u203a ${definitions.author.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `written on \u203a ${definitions.written_on.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Rating \u203a Thumbs-Up ${definitions.thumbs_up} / Thumbs-Down ${definitions.thumbs_down}`,
|
||||
color: 'gray'
|
||||
}
|
||||
]
|
||||
},
|
||||
click_event: {
|
||||
action: 'open_url',
|
||||
value: `${definitions.permalink}`
|
||||
}
|
||||
},
|
||||
])
|
||||
*/
|
||||
@@ -1,158 +0,0 @@
|
||||
const { request } = require("undici");
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class weather extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"weather",
|
||||
[],
|
||||
"check the weather in locations",
|
||||
trustLevel.public,
|
||||
["<weather/zip code>"],
|
||||
false,
|
||||
);
|
||||
}
|
||||
async execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const translations = bot.translations;
|
||||
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
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();
|
||||
|
||||
if (info.error) source.sendFeedback({
|
||||
translate: "fnfboyfriendbot.command.weather.unknown_location",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.unknown_location"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: `${args.join(' ')}`}
|
||||
]
|
||||
})
|
||||
|
||||
component.push({
|
||||
translate: "%s\n%s\n%s\n%s\n%s\n%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.location",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.location"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${info.location.name}`, color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${info.location.region}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: `${info.location.country}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.coords",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.coords"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${info.location.lat}`, color: config.colors.integer },
|
||||
{ text: `${info.location.lon}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.time",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.time"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
text: `${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id })}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: `${info.location.tz_id}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.temp",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.temp"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
text: `${Math.floor(info.current.temp_c)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(info.current.temp_f)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.wind_speed",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.wind_speed"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
text: `${Math.floor(info.current.wind_kph)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "kph", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${info.current.wind_dir}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(info.current.wind_mph)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "mph", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${info.current.wind_dir}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.condition",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.condition"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
text: `${info.current.condition.text}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.humidity",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.humidity"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
text: `${Math.floor(info.current.humidity)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
source.sendFeedback(component)
|
||||
} catch (e) {
|
||||
if (e.toString() === "TypeError: Cannot read properties of undefined (reading 'name')") return
|
||||
else source.sendFeedback(e.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = weather;
|
||||
@@ -1,46 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
const wikipedia = require('wikipedia');
|
||||
|
||||
class wiki extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"wiki",
|
||||
[
|
||||
"wikipedia"
|
||||
],
|
||||
"look up articles on wikipedia",
|
||||
trustLevel.public,
|
||||
["<article>"],
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
async execute(context) {
|
||||
const source = context.source;
|
||||
const args = context.arguments;
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const translations = bot.translations;
|
||||
let component = [];
|
||||
try {
|
||||
const page = await wikipedia.page(args.join(' '));
|
||||
const summary = await page.intro();
|
||||
component.push({ text: summary, color: config.colors.commands.primary })
|
||||
|
||||
source.sendFeedback(component)
|
||||
} catch (e) {
|
||||
if (e.toString().startsWith('pageError: pageError: No page with given title exists :')) {
|
||||
source.sendFeedback({
|
||||
translate: "fnfboyfriendbot.command.wiki.article_not_found",
|
||||
fallback: translations["fnfboyfriendbot.command.wiki.article_not_found"],
|
||||
color: "red"
|
||||
})
|
||||
} else {
|
||||
source.sendFeedback(e.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = wiki;
|
||||
@@ -0,0 +1,24 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "rc",
|
||||
enabled: true,
|
||||
aliases: [
|
||||
"refill",
|
||||
"refillcore"
|
||||
],
|
||||
description: "refills the core",
|
||||
usages: [
|
||||
]
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
if (config.core.itemRefill === true) {
|
||||
bot.core.itemRefill();
|
||||
} else {
|
||||
bot.core.chatRefill();
|
||||
}
|
||||
bot.console.command('refilling core,...');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "reconnect",
|
||||
enabled: true,
|
||||
aliases: [
|
||||
"end"
|
||||
],
|
||||
description: "reconnect to the server",
|
||||
usages: [
|
||||
]
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
bot._client.end('command reconnect');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "selfcare",
|
||||
enabled: true,
|
||||
aliases: [
|
||||
"sc",
|
||||
"selfcaretoggle",
|
||||
"sctoggles"
|
||||
],
|
||||
description: "toggle the selfcare",
|
||||
usages: [
|
||||
"vanish enable/disable",
|
||||
"mute enable/disable",
|
||||
"cspy enable/disable",
|
||||
"gamemode enable/disable",
|
||||
"op enable/disable",
|
||||
"icu enable/disable",
|
||||
"god enable/disable",
|
||||
"nick enable/disable",
|
||||
"username enable/disable",
|
||||
"prefix enable/disable"
|
||||
]
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
/*
|
||||
vanish: true
|
||||
mute: true
|
||||
cspy: true
|
||||
gamemode: true
|
||||
op: true
|
||||
icu: true
|
||||
god: true
|
||||
nick: true
|
||||
username: true
|
||||
prefix: true
|
||||
*/
|
||||
if (!args && !args[0] && !args[1]) return;
|
||||
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "vanish":
|
||||
switch (args[1]) {
|
||||
case "enable":
|
||||
config.selfcare.vanish = true;
|
||||
bot.console.command('enabling vanish selfcare');
|
||||
break;
|
||||
case "disable":
|
||||
config.selfcare.vanish = false;
|
||||
bot.console.command('disabling vanish selfcare');
|
||||
break;
|
||||
default:
|
||||
bot.console.command(`Vanish selfcare is currently ${config.selfcare.vanish}`);
|
||||
}
|
||||
break;
|
||||
case "prefix":
|
||||
switch (args[1]) {
|
||||
case "enable":
|
||||
config.selfcare.prefix = true;
|
||||
bot.console.command('enabling prefix selfcare');
|
||||
break;
|
||||
case "disable":
|
||||
config.selfcare.prefix = false;
|
||||
bot.console.command('disabling prefix selfcare');
|
||||
break;
|
||||
default:
|
||||
bot.console.command(`Prefix selfcare is currently ${config.selfcare.prefix}`);
|
||||
}
|
||||
break;
|
||||
case "username":
|
||||
switch (args[1]) {
|
||||
case "enable":
|
||||
config.selfcare.username = true;
|
||||
bot.console.command('enabling username selfcare');
|
||||
break;
|
||||
case "disable":
|
||||
config.selfcare.username = false;
|
||||
bot.console.command('disabling username selfcare');
|
||||
break;
|
||||
default:
|
||||
bot.console.command(`Username selfcare is currently ${config.selfcare.username}`);
|
||||
}
|
||||
break;
|
||||
case "nick":
|
||||
switch (args[1]) {
|
||||
case "enable":
|
||||
config.selfcare.nick = true;
|
||||
bot.console.command('enabling nick selfcare');
|
||||
break;
|
||||
case "disable":
|
||||
config.selfcare.nick = false;
|
||||
bot.console.command('disabling nick selfcare');
|
||||
break;
|
||||
default:
|
||||
bot.console.command(`Nick selfcare is currently ${config.selfcare.nick}`);
|
||||
}
|
||||
break;
|
||||
case "mute":
|
||||
switch (args[1]) {
|
||||
case "enable":
|
||||
config.selfcare.mute = true;
|
||||
bot.console.command('enabling mute selfcare');
|
||||
break;
|
||||
case "disable":
|
||||
config.selfcare.mute = false;
|
||||
bot.console.command('disabling mute selfcare');
|
||||
break;
|
||||
default:
|
||||
bot.console.command(`Mute selfcare is currently ${config.selfcare.mute}`);
|
||||
}
|
||||
break;
|
||||
case "cspy":
|
||||
switch (args[1]) {
|
||||
case "enable":
|
||||
config.selfcare.cspy = true;
|
||||
bot.console.command('enabling cspy selfcare');
|
||||
break;
|
||||
case "disable":
|
||||
config.selfcare.cspy = false;
|
||||
bot.console.command('disabling cspy selfcare');
|
||||
break;
|
||||
default:
|
||||
bot.console.command(`Cspy selfcare is currently ${config.selfcare.cspy}`);
|
||||
}
|
||||
break;
|
||||
case "god":
|
||||
switch (args[1]) {
|
||||
case "enable":
|
||||
config.selfcare.god = true;
|
||||
bot.console.command('enabling god selfcare');
|
||||
break;
|
||||
case "disable":
|
||||
config.selfcare.god = false;
|
||||
bot.console.command('disabling god selfcare');
|
||||
break;
|
||||
default:
|
||||
bot.console.command(`God selfcare is currently ${config.selfcare.god}`);
|
||||
}
|
||||
break;
|
||||
case "icu":
|
||||
switch (args[1]) {
|
||||
case "enable":
|
||||
config.selfcare.icu = true;
|
||||
bot.console.command('enabling icu selfcare');
|
||||
break;
|
||||
case "disable":
|
||||
config.selfcare.icu = false;
|
||||
bot.console.command('disabling icu selfcare');
|
||||
break;
|
||||
default:
|
||||
bot.console.command(`Icu selfcare is currently ${config.selfcare.icu}`);
|
||||
}
|
||||
break;
|
||||
case "gamemode":
|
||||
switch (args[1]) {
|
||||
case "enable":
|
||||
config.selfcare.gamemode = true;
|
||||
bot.console.command('enabling gamemode selfcare');
|
||||
break;
|
||||
case "disable":
|
||||
config.selfcare.gamemode = false;
|
||||
bot.console.command('disabling gamemode selfcare');
|
||||
break;
|
||||
default:
|
||||
bot.console.command(`Gamemode selfcare is currently ${config.selfcare.gamemode}`);
|
||||
}
|
||||
break;
|
||||
case "op":
|
||||
switch (args[1]) {
|
||||
case "enable":
|
||||
config.selfcare.op = true;
|
||||
bot.console.command('enabling op selfcare');
|
||||
break;
|
||||
case "disable":
|
||||
config.selfcare.op = false;
|
||||
bot.console.command('disabling op selfcare');
|
||||
break;
|
||||
default:
|
||||
bot.console.command(`Op selfcare is currently ${config.selfcare.vanish}`);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
bot.console.command('invalid argument');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
const CommandError = require("../../commandUtil/CommandError");
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class cloop extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"cloop",
|
||||
[
|
||||
"commandloop",
|
||||
"loop"
|
||||
],
|
||||
"loops commands",
|
||||
trustLevel.trusted,
|
||||
[
|
||||
"add <interval> <command>",
|
||||
"remove <index>",
|
||||
"list",
|
||||
"clear"
|
||||
],
|
||||
false
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
const args = context.arguments;
|
||||
let component = [];
|
||||
|
||||
if (
|
||||
!args &&
|
||||
!args[0] &&
|
||||
!args[1] &&
|
||||
!args[2] &&
|
||||
!args[3] &&
|
||||
!args[4] &&
|
||||
!args[5]
|
||||
)
|
||||
return;
|
||||
|
||||
switch (args[0]) {
|
||||
case "add":
|
||||
if (isNaN(args[1])) throw new CommandError("invalid interval");
|
||||
|
||||
const interval = parseInt(args[1]);
|
||||
const command = args.slice(2).join(" ");
|
||||
bot.cloop.add(command, interval);
|
||||
|
||||
component.push(
|
||||
`added ${command} to the cloops with the interval ${interval}`,
|
||||
);
|
||||
break;
|
||||
case "clear":
|
||||
bot.cloop.clear();
|
||||
component.push("cleared the cloops");
|
||||
break;
|
||||
case "remove":
|
||||
if (isNaN(args[1]))
|
||||
throw new CommandError("argument must be an integer!");
|
||||
|
||||
const index = parseInt(args[1]);
|
||||
bot.cloop.remove(index);
|
||||
|
||||
component.push(`removed ${index} from cloops`);
|
||||
break;
|
||||
case "list":
|
||||
let listComponent = [];
|
||||
let i = 0;
|
||||
for (const cloop of bot.cloop.list) {
|
||||
listComponent.push({
|
||||
translate: "%s \u203a %s (%s)",
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${i}`, color: config.colors.integer },
|
||||
cloop.command,
|
||||
{ text: `${cloop.interval}`, color: config.colors.integer },
|
||||
],
|
||||
});
|
||||
listComponent.push("\n");
|
||||
i++;
|
||||
}
|
||||
|
||||
listComponent.pop();
|
||||
|
||||
component.push({
|
||||
translate: "Cloops (%s):",
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${bot.cloop.list.length}`, color: config.colors.integer },
|
||||
],
|
||||
});
|
||||
component.push("\n");
|
||||
|
||||
if (bot.cloop.list.length > 0) {
|
||||
component.push(listComponent);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError("invalid argument");
|
||||
}
|
||||
|
||||
source.sendFeedback(component);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = cloop;
|
||||
@@ -1,25 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class reconnect extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"reconnect",
|
||||
["end"],
|
||||
"reconnect the bot",
|
||||
trustLevel.trusted,
|
||||
[""],
|
||||
false
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
|
||||
bot._client.end();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = reconnect;
|
||||
@@ -1,43 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class validate extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"validate",
|
||||
["val"],
|
||||
"validate through the bot",
|
||||
trustLevel.trusted,
|
||||
[""],
|
||||
false,
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
let component = []
|
||||
|
||||
if (source.player.trustLevel === 1)
|
||||
component.push({
|
||||
text: "Valid Trusted Hash",
|
||||
color: config.colors.help.trusted
|
||||
})
|
||||
|
||||
else if (source.player.trustLevel === 2)
|
||||
component.push({
|
||||
text: "Valid Admin Hash",
|
||||
color: config.colors.help.admin
|
||||
})
|
||||
else if (source.player.trustLevel === 3)
|
||||
component.push({
|
||||
text: "Valid Owner Hash",
|
||||
color: config.colors.help.owner
|
||||
})
|
||||
|
||||
source.sendFeedback(component)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = validate;
|
||||
@@ -0,0 +1,79 @@
|
||||
const crypto = require('crypto');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "validate",
|
||||
enabled: true,
|
||||
aliases: [
|
||||
"val"
|
||||
],
|
||||
description: "validate through bots",
|
||||
usages: [
|
||||
"chomens <arguments>",
|
||||
"fnfboyfriendbot <arguments>",
|
||||
"qbot <arguments>",
|
||||
"sbot <arguments>",
|
||||
"testbot <arguments>",
|
||||
]
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
let hash;
|
||||
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return;
|
||||
|
||||
switch (args[0]) {
|
||||
case "chomens":
|
||||
const time = Math.floor(Date.now() / 5_000)
|
||||
|
||||
const value = bot.uuid + args.slice(1).join(' ') + time + config.bots.chomens.key
|
||||
|
||||
hash = crypto.createHash('sha256').update(value).digest('hex').substring(0, 16)
|
||||
if (bot.customChat.enabled) {
|
||||
bot.customChat.chat(`${config.bots.chomens.prefix}${args.slice(1).shift()} ${hash} ${args.slice(2).join(' ')}`);
|
||||
} else {
|
||||
bot.chat(`${config.bots.chomens.prefix}${args.slice(1).shift()} ${hash} ${args.slice(2).join(' ')}`);
|
||||
}
|
||||
break;
|
||||
case "fnfboyfriendbot":
|
||||
hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 2000) + config.bots.fnfboyfriendbot.key).digest("hex").substring(0, 16);
|
||||
if (bot.customChat.enabled) {
|
||||
bot.customChat.chat(`${config.bots.fnfboyfriendbot.prefix}${args.slice(1).shift()} ${crypto.createHash('sha256').update(Math.floor(Date.now() / 2000) + config.bots.fnfboyfriendbot.key).digest('hex').substring(0, 16)} ${args.slice(2).join(' ')}`)
|
||||
} else {
|
||||
bot.chat(`${config.bots.fnfboyfriendbot.prefix}${args.slice(1).shift()} ${crypto.createHash('sha256').update(Math.floor(Date.now() / 2000) + config.bots.fnfboyfriendbot.key).digest('hex').substring(0, 16)} ${args.slice(2).join(' ')}`);
|
||||
}
|
||||
break;
|
||||
case "qbot":
|
||||
hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 1000) + config.bots.qbot.key).digest("hex").substring(0, 16);
|
||||
if (bot.customChat.enabled) {
|
||||
bot.customChat.chat(`${config.bots.qbot.prefix}${args.slice(1).shift()} ${hash} ${args.slice(2).join(' ')}`);
|
||||
} else {
|
||||
bot.chat(`${config.bots.qbot.prefix}${args.slice(1).shift()} ${hash} ${args.slice(2).join(' ')}`);
|
||||
}
|
||||
break;
|
||||
case "sbot":
|
||||
|
||||
const md = crypto.createHash("md5");
|
||||
const command = args.slice(1).join(' ');
|
||||
const time1 = Math.floor(+new Date() / 20000);
|
||||
const raw = ":"+`${command.replace(/&[0-9a-fklmnor]/g, '')};${bot.server.username};${time1};${config.bots.key}`;
|
||||
md.update(raw);
|
||||
const hash = md.digest();
|
||||
const big_int = hash.slice(0, 4).readUInt32BE();
|
||||
bot.chat(`${config.bots.sbot.prefix}${command} ${big_int.toString(36)}`);
|
||||
|
||||
break;
|
||||
case "testbot":
|
||||
context.webhook.send(`${bot.server.username}`);
|
||||
if (bot.customChat.enabled) {
|
||||
bot.customChat.chat(`${config.bots.testbot.prefix}${args.slice(1).join(' ')}`);
|
||||
} else {
|
||||
bot.chat(`${config.bots.testbot.prefix}${args.slice(1).join(' ')}`);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
console.warn('unknown argument');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
module.exports = {
|
||||
prefixes: ["!"],
|
||||
|
||||
discord: {
|
||||
token: "discord token here",
|
||||
prefix: "!",
|
||||
invite: "discord invite here",
|
||||
enabled: true,
|
||||
serverID: 'server id here',
|
||||
presence: {
|
||||
name: "amogus",
|
||||
status: "dnd",
|
||||
},
|
||||
|
||||
roles: {
|
||||
trusted: "trusted",
|
||||
admin: "admin",
|
||||
fullAccess: "full access",
|
||||
owner: "FNFBoyfriendBot Owner",
|
||||
},
|
||||
},
|
||||
|
||||
core: {
|
||||
name: { text: "FNFBoyfriendBot Core", color: "#00FFFF" },
|
||||
itemName: { text: "FNFBoyfriendBot core item", color: "#00FFFF" },
|
||||
refillInterval: 300000,
|
||||
// refilling core via item is buggy rn i recommend setting itemRefill to false for now
|
||||
area: {
|
||||
start: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0,
|
||||
},
|
||||
end: {
|
||||
x: 15,
|
||||
y: 0,
|
||||
z: 15,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
weatherApiKey: "weather api token here",
|
||||
|
||||
ratelimit: {
|
||||
console: 20,
|
||||
commands: 3
|
||||
},
|
||||
|
||||
debug: {
|
||||
commandSetMessage: false,
|
||||
},
|
||||
|
||||
keys: {
|
||||
trusted: "trusted key here",
|
||||
admin: "admin key here",
|
||||
owner: "owner key here",
|
||||
},
|
||||
|
||||
colors: {
|
||||
integer: "gold",
|
||||
discord: {
|
||||
embed: "#000000",
|
||||
error: "#FF0000",
|
||||
},
|
||||
|
||||
commands: {
|
||||
primary: "blue",
|
||||
secondary: "aqua",
|
||||
tertiary: "gray",
|
||||
},
|
||||
|
||||
help: {
|
||||
public: "blue",
|
||||
trusted: "dark_aqua",
|
||||
admin: "aqua",
|
||||
owner: "light_purple",
|
||||
console: "dark_purple",
|
||||
},
|
||||
},
|
||||
|
||||
console: {
|
||||
prefix: "c.",
|
||||
},
|
||||
|
||||
logsFolder: {
|
||||
path: "../../../",
|
||||
// this is being loaded from the modules so make sure it starts with ../../
|
||||
name: "fnfboyfriendbot-logs",
|
||||
},
|
||||
|
||||
skibot: {
|
||||
password: "<password>",
|
||||
player: "<username>",
|
||||
channel: "fnfboyfriendbot",
|
||||
enabled: false
|
||||
},
|
||||
|
||||
|
||||
bots: [
|
||||
// usernameGen is for a random username
|
||||
// if private is set to true then the server ip for the server will be hidden
|
||||
// channelId is for discord logging
|
||||
// logging is for console logging
|
||||
// reconnectDelay is for the delay for reconnecting to a server
|
||||
/*
|
||||
logging options
|
||||
console true or false
|
||||
file true or false
|
||||
*/
|
||||
// modes:
|
||||
// kaboom: for the server kaboom.pw
|
||||
// savageFriends: for the server savage Friends
|
||||
// creayun for the server creayun
|
||||
// version: 1.21.8
|
||||
// port: a number lmao
|
||||
// itemRefill: for refilling the core via chat or a command block
|
||||
{
|
||||
host: "localhost",
|
||||
username: "FNFBoyfriendBot",
|
||||
usernameGen: true,
|
||||
version: "1.20.2",
|
||||
serverName: "localhost",
|
||||
private: false,
|
||||
reconnectDelay: 6000,
|
||||
channelId: "discord channel ip here",
|
||||
logging: {
|
||||
file: false,
|
||||
console: true
|
||||
},
|
||||
mode: "kaboom",
|
||||
selfcareInterval: 300,
|
||||
itemRefill: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
bots:
|
||||
chomens:
|
||||
prefix: "*"
|
||||
key: ""
|
||||
|
||||
fnfboyfriendbot:
|
||||
prefix: "~"
|
||||
key: ""
|
||||
|
||||
qbot:
|
||||
prefix: "]"
|
||||
key: ""
|
||||
|
||||
sbot:
|
||||
prefix: ":"
|
||||
key: ""
|
||||
|
||||
testbot:
|
||||
prefix: "-"
|
||||
token: ""
|
||||
|
||||
console:
|
||||
prefix: "."
|
||||
|
||||
core:
|
||||
itemRefill: false
|
||||
area:
|
||||
start:
|
||||
x: 0
|
||||
y: 0
|
||||
z: 0
|
||||
end:
|
||||
x: 15
|
||||
y: 0
|
||||
z: 15
|
||||
itemName: { text: "https://doin-your.mom", color: "dark_red" }
|
||||
name: { text: "https://doin-your.mom", color: "dark_red" }
|
||||
|
||||
selfcare:
|
||||
vanish: true
|
||||
mute: true
|
||||
cspy: true
|
||||
gamemode: true
|
||||
op: true
|
||||
icu: true
|
||||
god: true
|
||||
nick: true
|
||||
username: true
|
||||
prefix: true
|
||||
|
||||
server:
|
||||
host: "localhost"
|
||||
# port: ""
|
||||
username: "player"
|
||||
version: "1.20.2"
|
||||
reconnectDelay: 3000
|
||||
@@ -0,0 +1,28 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
description: "pretty self explanatory",
|
||||
enabled: true,
|
||||
name: "custom chat",
|
||||
type: "extras"
|
||||
},
|
||||
inject (context) {
|
||||
const bot = context.bot;
|
||||
bot.customChat = {
|
||||
enabled: true,
|
||||
chat (args) {
|
||||
const prefix = {
|
||||
translate: "chat.type.text",
|
||||
with: [
|
||||
{ selector: `${bot.username}` },
|
||||
{
|
||||
text: '',
|
||||
extra: [ args ]
|
||||
}
|
||||
]
|
||||
}
|
||||
bot.tellraw("@a", prefix);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
description: "server exploits :3",
|
||||
enabled: true,
|
||||
name: "exploits",
|
||||
type: "extras",
|
||||
},
|
||||
inject (context) {
|
||||
const bot = context.bot;
|
||||
bot.exploits = {
|
||||
kicks: {
|
||||
|
||||
},
|
||||
|
||||
crashes: {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-4
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"buildstring": {
|
||||
"build": "3355",
|
||||
"codename": "§4Reignite",
|
||||
"version": "v8.0.0"
|
||||
"version": "1.3.5",
|
||||
"build": "50"
|
||||
}
|
||||
}
|
||||
}
|
||||
+6998
-7392
File diff suppressed because it is too large
Load Diff
@@ -1,127 +0,0 @@
|
||||
{
|
||||
"fnfboyfriendbot.arguments": "Expected %s Arguments, recieved %s",
|
||||
"fnfboyfriendbot.arguments.invalid_integer": "Expected %s to be an Integer",
|
||||
"fnfboyfriendbot.arguments.max_exceeded": "Expected %s Arguments not %s",
|
||||
"fnfboyfriendbot.arguments.no_args": "Expected no Arguments",
|
||||
"fnfboyfriendbot.arguments.not_enough_args": "Expected more than 0 Arguments",
|
||||
"fnfboyfriendbot.command.arguments.unknown": "Invalid Argument",
|
||||
|
||||
"fnfboyfriendbot.command.auth.as": "Authed as %s",
|
||||
"fnfboyfriendbot.command.auth.exists": "You are already authed with the trust level: %s",
|
||||
|
||||
"fnfboyfriendbot.command.cloop.list.text": "Cloops (%s):",
|
||||
"fnfboyfriendbot.command.cloop.remove": "Removed %s from the cloops",
|
||||
"fnfboyfriendbot.command.cloop.clear": "Cleared the cloops",
|
||||
"fnfboyfriendbot.command.cloop.not_an_integer": "Interval must be an Integer!",
|
||||
"fnfboyfriendbot.command.cloop.add": "Added %s to the cloops with the interval %s",
|
||||
|
||||
"fnfboyfriendbot.command.core.refill": "Refilling core",
|
||||
|
||||
"fnfboyfriendbot.command.extras.send": "Sent %s to Channel %s",
|
||||
"fnfboyfriendbot.command.extras.register": "Registered %s Channel",
|
||||
"fnfboyfriendbot.command.extras.unregister": "Unregistered from %s Channel",
|
||||
"fnfboyfriendbot.command.extras.unregisterAll": "Unregistered from all channels",
|
||||
|
||||
"fnfboyfriendbot.command.help.category": "(%s | %s | %s | %s)",
|
||||
"fnfboyfriendbot.command.help.command_layout": "Commands%s %s%s%s",
|
||||
"fnfboyfriendbot.command.help.info.alias": "Aliases%s %s",
|
||||
"fnfboyfriendbot.command.help.info.command": "Command%s %s",
|
||||
"fnfboyfriendbot.command.help.info.description": "Descripton%s %s",
|
||||
"fnfboyfriendbot.command.help.info.trust_level": "Trust Level%s %s",
|
||||
"fnfboyfriendbot.command.help.info.usages": "Usages%s\n%s",
|
||||
"fnfboyfriendbot.command.help.trust_level.public": "Public",
|
||||
"fnfboyfriendbot.command.help.trust_level.trusted": "Trusted",
|
||||
"fnfboyfriendbot.command.help.trust_level.admin": "Admin",
|
||||
"fnfboyfriendbot.command.help.trust_level.owner": "Owner",
|
||||
|
||||
"fnfboyfriendbot.command.info.about": "FNFBoyfriendBot is a kaboom bot created by Parker2991",
|
||||
|
||||
"fnfboyfriendbot.command.info.config.discord.channel": "Discord Channel%s %s",
|
||||
"fnfboyfriendbot.command.info.config.discord.username": "Discord Username%s %s",
|
||||
"fnfboyfriendbot.command.info.config.minecraft.username": "Minecraft Username%s %s",
|
||||
"fnfboyfriendbot.command.info.config.minecraft.version": "Minecraft Version%s %s",
|
||||
"fnfboyfriendbot.command.info.config.mode": "Mode%s %s",
|
||||
"fnfboyfriendbot.command.info.config.prefixes": "Prefixes%s %s",
|
||||
"fnfboyfriendbot.command.info.config.server.ip": "Server%s %s%s%s",
|
||||
"fnfboyfriendbot.command.info.config.server.name": "Server Name%s %s",
|
||||
"fnfboyfriendbot.command.info.config.server.count": "Server Count%s %s",
|
||||
|
||||
"fnfboyfriendbot.command.info.discord": "the discord server invite is %s",
|
||||
|
||||
"fnfboyfriendbot.command.info.loaded.commands": "%s Commands",
|
||||
"fnfboyfriendbot.command.info.loaded.modules": "%s Modules",
|
||||
|
||||
"fnfboyfriendbot.command.info.server.arch": "Arch%s %s",
|
||||
"fnfboyfriendbot.command.info.server.cpu": "CPU%s %s",
|
||||
"fnfboyfriendbot.command.info.server.cpu.cores": "CPU Cores%s %s",
|
||||
"fnfboyfriendbot.command.info.server.directory": "Directory%s %s",
|
||||
"fnfboyfriendbot.command.info.server.hostname": "Hostname%s %s",
|
||||
"fnfboyfriendbot.command.info.server.kernel_version": "Kernel Version%s %s",
|
||||
"fnfboyfriendbot.command.info.server.os": "OS%s %s",
|
||||
"fnfboyfriendbot.command.info.server.os.version": "OS Version%s %s",
|
||||
"fnfboyfriendbot.command.info.server.processes": "Processes%s %s",
|
||||
"fnfboyfriendbot.command.info.server.node_version": "Node Version%s %s",
|
||||
"fnfboyfriendbot.command.info.server.npm_version": "NPM Version%s %s",
|
||||
"fnfboyfriendbot.command.info.server.user": "Username%s %s",
|
||||
|
||||
"fnfboyfriendbot.command.info.uptimes.bot": "Bot Uptime%s %s",
|
||||
"fnfboyfriendbot.command.info.uptimes.server": "Server Uptime%s %s",
|
||||
|
||||
"fnfboyfriendbot.command.info.usages.botmem": "Bot Memory%s %s MB / %s MB",
|
||||
"fnfboyfriendbot.command.info.usages.servermem": "Server Memory%s %s MB / %s MB",
|
||||
|
||||
"fnfboyfriendbot.command.info.version.build": "Build%s %s",
|
||||
"fnfboyfriendbot.command.info.version.commit": "Commit%s %s",
|
||||
"fnfboyfriendbot.command.info.version.repo_build": "Repo Build%s %s",
|
||||
"fnfboyfriendbot.command.info.version.version_release_date": "Version Release Date%s %s",
|
||||
|
||||
"fnfboyfriendbot.command.list.latency": "Latency: %s",
|
||||
"fnfboyfriendbot.command.list.gamemode": "Gamemode: %s",
|
||||
|
||||
"fnfboyfriendbot.command.list.text": "Players: (%s)\n",
|
||||
|
||||
"fnfboyfriendbot.command.mcserver.ip": "Ip: %s:%s",
|
||||
"fnfboyfriendbot.command.mcserver.players": "Players: %s/%s",
|
||||
"fnfboyfriendbot.command.mcserver.server.unknown": "could not ping %s:%s",
|
||||
"fnfboyfriendbot.command.mcserver.server.version": "Server Version: %s",
|
||||
|
||||
"fnfboyfriendbot.command.rps.draw": "You chose %s and the bot chose %s so its a draw",
|
||||
"fnfboyfriendbot.command.rps.lose": "You lose! You chose %s and the bot chose %s",
|
||||
"fnfboyfriendbot.command.rps.win": "You win! You chose %s and the bot chose %s",
|
||||
"fnfboyfriendbot.command.rps.invalid_choice": "%s is not a valid option please pick rock paper or scissors",
|
||||
|
||||
"fnfboyfriendbot.command.rtp": "Telporting Player %s to X: %s, Y: %s, Z: %s",
|
||||
"fnfboyfriendbot.command.urban.definition_not_found": "%s Definition not found!",
|
||||
"fnfboyfriendbot.command.urban.text": "Urban",
|
||||
|
||||
"fnfboyfriendbot.command.validate.owner": "Validated as Owner",
|
||||
"fnfboyfriendbot.command.validate.admin": "Validated as Admin",
|
||||
"fnfboyfriendbot.command.validate.trusted": "Validated as Trusted",
|
||||
|
||||
"fnfboyfriendbot.command.weather.condition": "Condition: %s",
|
||||
"fnfboyfriendbot.command.weather.coords": "Coords: %s, %s",
|
||||
"fnfboyfriendbot.command.weather.humidity": "Humidity: %s",
|
||||
"fnfboyfriendbot.command.weather.location": "Location: %s %s, %s %s",
|
||||
"fnfboyfriendbot.command.weather.time": "Time: %s (%s)",
|
||||
"fnfboyfriendbot.command.weather.temp": "Temp: %s (\u00b0C), %s (\u00b0F)",
|
||||
"fnfboyfriendbot.command.weather.unknown_location": "%s is not a valid location!",
|
||||
"fnfboyfriendbot.command.weather.wind_speed": "Wind Speed: %s (%s, %s), %s (%s, %s)",
|
||||
|
||||
"fnfboyfriendbot.command.wiki.article_not_found": "Wiki Article not found!",
|
||||
|
||||
"fnfboyfriendbot.command_manager.validation.invalid_admin_hash": "Invalid Admin Hash",
|
||||
"fnfboyfriendbot.command_manager.validation.invalid_hash": "Invalid Hash",
|
||||
"fnfboyfriendbot.command_manager.validation.invalid_owner_hash": "Invalid Owner Hash",
|
||||
"fnfboyfriendbot.command_manager.validation.invalid_trusted_hash": "Invalid Trusted Hash",
|
||||
"fnfboyfriendbot.command_manager.validation.invalid_role": "Invalid Role",
|
||||
"fnfboyfriendbot.command_manager.trust_level.console_only": "This command can only be ran via console!",
|
||||
|
||||
"fnfboyfriendbot.https_requesting.status.forbidden": "",
|
||||
"fnfboyfriendbot.https_requesting.": "",
|
||||
|
||||
"fnfboyfriendbot.json.parse_invalid": "invalid json component to parse",
|
||||
"fnfboyfriendbot.json.stringify.invalid": "invalid json component to stringify",
|
||||
"fnfboyfriendbot.json.too_long": "Stringified JSON exceeds the max command block character limit",
|
||||
|
||||
"fnfboyfriendbot.reconnect.stop_logging": "stopped logging disconnect messages for now"
|
||||
}
|
||||
+33
-41
@@ -1,51 +1,43 @@
|
||||
const createBot = require("./bot.js");
|
||||
const readline = require("readline");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const loadModules = require("./util/loadModules");
|
||||
const { Client, GatewayIntentBits, Partials } = require("discord.js");
|
||||
const { MessageContent, GuildMessages, Guilds, DirectMessages } =
|
||||
GatewayIntentBits;
|
||||
const fs = require('fs');
|
||||
const { load } = require('js-yaml');
|
||||
const path = require('path');
|
||||
const { WebhookClient } = require('discord.js');
|
||||
|
||||
const discordClient = new Client({
|
||||
intents: [
|
||||
Guilds,
|
||||
GuildMessages,
|
||||
MessageContent,
|
||||
GatewayIntentBits.DirectMessages,
|
||||
],
|
||||
partials: [Partials.Channel],
|
||||
});
|
||||
|
||||
console.log("Starting FNFBoyfriendBot");
|
||||
|
||||
if (!fs.existsSync(path.join(__dirname, "../config.js"))) {
|
||||
if (!fs.existsSync(path.join(__dirname, "../config.yml"))) {
|
||||
console.warn("Config not found creating config from the default config");
|
||||
fs.copyFileSync(
|
||||
path.join(__dirname, "./data/default_config.js"),
|
||||
path.join(__dirname, "../config.js"),
|
||||
);
|
||||
path.join(__dirname, "./data/default_config.yml"),
|
||||
path.join(__dirname, "../config.yml")
|
||||
)
|
||||
}
|
||||
|
||||
const config = require("../config.js");
|
||||
if (!fs.existsSync(path.join(__dirname, "./modules/custom_chat.js"))) {
|
||||
console.warn("custom chat format not found recreating from default custom chat format");
|
||||
fs.copyFileSync(
|
||||
path.join(__dirname, "./data/default_custom_chat.js"),
|
||||
path.join(__dirname, "./modules/custom_chat.js")
|
||||
)
|
||||
}
|
||||
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
});
|
||||
if (!fs.existsSync(path.join(__dirname, "./modules/exploits.js"))) {
|
||||
console.warn("exploits module not found recreating from default exploits");
|
||||
fs.copyFileSync(
|
||||
path.join(__dirname, "./data/default_exploits.js"),
|
||||
path.join(__dirname, "./modules/exploits.js")
|
||||
)
|
||||
}
|
||||
|
||||
if (config.discord.enabled) discordClient.login(config.discord.token);
|
||||
try {
|
||||
config = load(fs.readFileSync(path.join(__dirname, '../', 'config.yml')));
|
||||
} catch (e) {
|
||||
console.error("Failed to load the config look below for the error stack");
|
||||
console.error(e.stack);
|
||||
}
|
||||
|
||||
const bots = [];
|
||||
let options;
|
||||
let bot;
|
||||
const webhook = new WebhookClient({ id: config.bots.testbot.id, token: config.bots.testbot.token });
|
||||
//webhook.send({ content: "amogus" });
|
||||
|
||||
for (const botOptions of config.bots) {
|
||||
options = botOptions;
|
||||
bot = new createBot(options, config);
|
||||
bot.translations = require('./data/translations.json')
|
||||
bots.push(bot);
|
||||
bot.bots = bots;
|
||||
loadModules(bot, options, config, discordClient);
|
||||
bot.console.readlineInterface(rl);
|
||||
}
|
||||
let bot = require('./bot.js')({ config });
|
||||
|
||||
require('./util/loadModules')(bot, config, webhook);
|
||||
|
||||
+96
-149
@@ -1,15 +1,14 @@
|
||||
const loadPrismarineChat = require("prismarine-chat");
|
||||
const convertNbtComponentToJson = require("../util/convertNbtComponentToJson");
|
||||
const kaboom = require("../chatParsers/kaboom");
|
||||
const creayun = require("../chatParsers/creayun");
|
||||
const chipmunkmod = require("../chatParsers/chipmunkmod");
|
||||
const vanilla = require('../chatParsers/vanilla/vanilla');
|
||||
const me = require('../chatParsers/vanilla/me')
|
||||
const convertNbtComponentToJson = require('../util/nbt_parser')
|
||||
/*
|
||||
please note that the code here for 1.21.8
|
||||
was ported from the FNFBoyfriendBot Reignite 1.21.8 port
|
||||
and had SkiBot's console format added to it
|
||||
*/
|
||||
|
||||
function parseNbt (chatTypes, type, sender, target, message) {
|
||||
function parse (chatTypes, type, sender, target, message) {
|
||||
const chatType = chatTypes[type]
|
||||
const parsed = convertNbtComponentToJson(null, chatType.value.value.chat)
|
||||
let json = { translate: parsed.translation_key, with: [] }
|
||||
const json = { translate: parsed.translation_key, with: [] }
|
||||
|
||||
for (const parameter of parsed.parameters) {
|
||||
|
||||
@@ -22,177 +21,125 @@ function parseNbt (chatTypes, type, sender, target, message) {
|
||||
}
|
||||
}
|
||||
|
||||
if (type === 4) json = message
|
||||
|
||||
return json
|
||||
}
|
||||
|
||||
class chat {
|
||||
constructor(context) {
|
||||
module.exports = {
|
||||
data: {
|
||||
description: "parses chat",
|
||||
enabled: true,
|
||||
name: "chat",
|
||||
type: "logging"
|
||||
},
|
||||
inject (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
let ChatMessage;
|
||||
let chatTypes;
|
||||
bot.on("registry_ready", (registry) => {
|
||||
ChatMessage = loadPrismarineChat(registry);
|
||||
});
|
||||
|
||||
bot.on('packet.registry_data', (packet) => {
|
||||
if (packet.id !== 'minecraft:chat_type') return // taken from the 1.21.1 build of my bot that chayapak made
|
||||
if (packet.id !== 'minecraft:chat_type') return // taken from FNFBoyfriendBot Reignite 1.21.8 port
|
||||
chatTypes = packet.entries
|
||||
|
||||
})
|
||||
|
||||
if (options.mode === "savageFriends") {
|
||||
bot.chatParsers = [creayun];
|
||||
} else {
|
||||
bot.chatParsers = [
|
||||
kaboom,
|
||||
creayun,
|
||||
chipmunkmod,
|
||||
vanilla,
|
||||
me
|
||||
/* KaboomChatParser,
|
||||
ChipmunkModChatParser,
|
||||
VanilaChatParser,*/
|
||||
];
|
||||
}
|
||||
bot.on('packet.player_chat', (packet) => {
|
||||
const unsigned = convertNbtComponentToJson(null, packet.unsignedChatContent);
|
||||
bot.emit('message', [
|
||||
{
|
||||
translate: "[%s %s %s%s %s] ",
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: 'Player Chat', color: 'dark_purple' },
|
||||
{ text: '|' },
|
||||
{ text: 'Packet Type', color: "aqua" },
|
||||
{ text: ':' },
|
||||
{ text: packet.type.chatType, color: 'gold' },
|
||||
],
|
||||
},
|
||||
unsigned
|
||||
])
|
||||
});
|
||||
|
||||
bot.on("packet.profileless_chat", (packet) => {
|
||||
bot.on('packet.profileless_chat', (packet) => {
|
||||
const sender = convertNbtComponentToJson(null, packet.name);
|
||||
const message = convertNbtComponentToJson(null, packet.message);
|
||||
const target = convertNbtComponentToJson(null, packet.target)
|
||||
const type = packet.type.chatType;
|
||||
const parsed = parseNbt(chatTypes, type, sender, target, message)
|
||||
bot.emit('message', {
|
||||
type: "minecraft:disguised_chat",
|
||||
message: parsed
|
||||
})
|
||||
const parsed = parse(chatTypes, type, sender, target, message)
|
||||
|
||||
parseMessage(parsed, { senderName: sender, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine, chatType: "minecraft:diguised_chat" })
|
||||
bot.emit('message', [
|
||||
{
|
||||
translate: "[%s %s %s%s %s] ",
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: 'Profileless Chat', color: 'dark_aqua' },
|
||||
{ text: '|' },
|
||||
{ text: 'Packet Type', color: "aqua" },
|
||||
{ text: ':' },
|
||||
{ text: packet.type.chatType, color: 'gold' },
|
||||
],
|
||||
},
|
||||
parsed
|
||||
])
|
||||
});
|
||||
|
||||
bot.on("packet.player_chat", (packet) => {
|
||||
const unsigned = convertNbtComponentToJson(null, packet.unsignedChatContent);
|
||||
const networkName = convertNbtComponentToJson(null, packet.networkName)
|
||||
bot.emit('message', {
|
||||
type: "minecraft:player_chat",
|
||||
message: unsigned
|
||||
})
|
||||
|
||||
parseMessage(unsigned, {
|
||||
senderUuid: packet.senderUuid,
|
||||
players: bot.players,
|
||||
getMessageAsPrismarine: bot.getMessageAsPrismarine,
|
||||
chatType: "minecraft:player_chat"
|
||||
});
|
||||
});
|
||||
|
||||
bot.on("packet.system_chat", (packet) => {
|
||||
const message = convertNbtComponentToJson(null, packet.content);
|
||||
if (
|
||||
message.translate === "advMode.setCommand.success"
|
||||
||
|
||||
message.translate === "multiplayer.message_not_delivered"
|
||||
||
|
||||
packet.isActionBar
|
||||
||
|
||||
message.translate === "advMode.notAllowed"
|
||||
)
|
||||
return;
|
||||
|
||||
bot.emit("message", {
|
||||
type: "minecraft:system_chat",
|
||||
message: message
|
||||
});
|
||||
bot.emit("system_chat", message);
|
||||
|
||||
parseMessage(message, {
|
||||
players: bot.players,
|
||||
getMessageAsPrismarine: bot.getMessageAsPrismarine,
|
||||
chatType: "minecraft:system_chat",
|
||||
});
|
||||
});
|
||||
|
||||
function parseMessage(message, data) {
|
||||
bot.on('packet.system_chat', packet => {
|
||||
try {
|
||||
let parsed;
|
||||
const message = convertNbtComponentToJson(null, packet.content)
|
||||
|
||||
for (const parser of bot.chatParsers) {
|
||||
parsed = parser(message, data);
|
||||
if (parsed) break;
|
||||
}
|
||||
if (message.translate === 'advMode.setCommand.success') return // Ignores command set message
|
||||
|
||||
if (!parsed) return;
|
||||
bot.emit("parsed_message", parsed);
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
if (message.translate === 'multiplayer.message_not_delivered') return;
|
||||
|
||||
if (packet.isActionBar) {
|
||||
return
|
||||
}
|
||||
|
||||
bot.emit('message', [
|
||||
{
|
||||
translate: "[%s] ",
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: 'System Chat', color: 'dark_blue' },
|
||||
],
|
||||
},
|
||||
message
|
||||
]);
|
||||
|
||||
bot.emit('system_chat_selfcare', message); // this is for selfcare
|
||||
} catch (e) {
|
||||
console.log(e.stack)
|
||||
}
|
||||
});
|
||||
|
||||
bot.getMessageAsPrismarine = (message) => {
|
||||
try {
|
||||
if (ChatMessage !== undefined) {
|
||||
return new ChatMessage(message);
|
||||
}
|
||||
} catch {}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
||||
bot.chat = {
|
||||
message(message) {
|
||||
const acc = 0;
|
||||
const bitset = Buffer.allocUnsafe(3);
|
||||
bitset[0] = acc & 0xff;
|
||||
bitset[1] = (acc >> 8) & 0xff;
|
||||
bitset[2] = (acc >> 16) & 0xff;
|
||||
bot._client.write("chat_message", {
|
||||
message: message?.substring(0, 256)?.replaceAll("§", "&"),
|
||||
timestamp: BigInt(Date.now()),
|
||||
salt: 0n,
|
||||
offset: 0,
|
||||
acknowledged: bitset,
|
||||
});
|
||||
},
|
||||
|
||||
command(command) {
|
||||
bot._client.write("chat_command", {
|
||||
command: command?.substring(0, 256)?.replaceAll("§", "&"),
|
||||
bot.chat = (args) => {
|
||||
if (args.startsWith('/')) {
|
||||
bot._client.write('chat_command', {
|
||||
command: args?.substring(1).substring(0, 256),
|
||||
timestamp: BigInt(Date.now()),
|
||||
salt: 0n,
|
||||
argumentSignatures: [],
|
||||
signedPreview: false,
|
||||
messageCount: 0,
|
||||
acknowledged: Buffer.alloc(3),
|
||||
previousMessages: [],
|
||||
});
|
||||
},
|
||||
|
||||
send(message) {
|
||||
if (message.startsWith("/")) {
|
||||
bot.chat.command(message.substring(1));
|
||||
return;
|
||||
}
|
||||
bot.chat.message(message);
|
||||
},
|
||||
};
|
||||
previousMessages: []
|
||||
})
|
||||
return;
|
||||
}
|
||||
const acc = 0;
|
||||
const bitset = Buffer.allocUnsafe(3);
|
||||
bitset[0] = acc & 0xFF;
|
||||
bitset[1] = (acc >> 8) & 0xFF;
|
||||
bitset[2] = (acc >> 16) & 0xFF;
|
||||
bot._client.write('chat_message', {
|
||||
message: args?.substring(0, 256),
|
||||
timestamp: BigInt(Date.now()),
|
||||
salt: 0n,
|
||||
offset: 0,
|
||||
acknowledged: bitset
|
||||
})
|
||||
}
|
||||
|
||||
bot.tellraw = (selector, message) => {
|
||||
const command = "minecraft:tellraw";
|
||||
const commandLength = 32767 - selector.length;
|
||||
const messageLength = JSON.stringify(message).length
|
||||
const finalLength = commandLength - messageLength
|
||||
// here we check to see if the output surpasses the max command block character limit which is 32767
|
||||
if (messageLength > finalLength)
|
||||
bot.core.run(`${command} ${selector} ` + JSON.stringify({
|
||||
translate: "fnfboyfriendbot.json.too_long",
|
||||
fallback: bot.translations["fnfboyfriendbot.json.too_long"],
|
||||
color: "red"
|
||||
}))
|
||||
else bot.core.run(`${command} ${selector} ` + JSON.stringify(message));
|
||||
};
|
||||
bot.core.run(`minecraft:tellraw ${selector} ${JSON.stringify(message)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = chat;
|
||||
|
||||
@@ -1,245 +0,0 @@
|
||||
const sleep = require("../util/sleep");
|
||||
const convertNbtComponentToJson = require("../util/convertNbtComponentToJson");
|
||||
|
||||
class commandCore {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
const Item = require("prismarine-item")(bot.options.version);
|
||||
|
||||
let command;
|
||||
|
||||
bot.core = {
|
||||
area: {
|
||||
start: config.core?.area.start ?? { x: 0, y: 0, z: 0 },
|
||||
end: config.core?.area.end ?? { x: 15, y: 0, z: 15 },
|
||||
},
|
||||
|
||||
position: null,
|
||||
|
||||
itemPosition: null,
|
||||
|
||||
currentBlockRelative: { x: 0, y: 0, z: 0 },
|
||||
|
||||
usePlacedCommandBlock: false,
|
||||
|
||||
chatRefill() {
|
||||
const pos = bot.core.position;
|
||||
const { start, end } = bot.core.area;
|
||||
const itemPosition = bot.core.itemPosition;
|
||||
|
||||
if (!pos || !itemPosition) return;
|
||||
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} command_block`;
|
||||
} else {
|
||||
command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} command_block{CustomName:${JSON.stringify(config.core.name)}}`;
|
||||
}
|
||||
bot.chat.command(command);
|
||||
},
|
||||
|
||||
itemRefill() {
|
||||
const pos = bot.core.position;
|
||||
const { start, end } = bot.core.area;
|
||||
const itemPosition = bot.core.itemPosition;
|
||||
|
||||
command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} command_block{CustomName:${JSON.stringify(config.core.name)}}`;
|
||||
if (bot.options.mode !== "savageFriends") {
|
||||
bot._client.write("set_creative_slot", {
|
||||
slot: 36,
|
||||
item: Item.toNotch(
|
||||
new Item(
|
||||
bot.registry.itemsByName.repeating_command_block.id,
|
||||
1,
|
||||
0,
|
||||
),
|
||||
),
|
||||
});
|
||||
|
||||
bot._client.write("block_dig", {
|
||||
status: 0,
|
||||
location: itemPosition,
|
||||
face: 0,
|
||||
});
|
||||
|
||||
bot._client.write("block_place", {
|
||||
hand: 0,
|
||||
location: itemPosition,
|
||||
direction: 0,
|
||||
cursorX: 0,
|
||||
cursorY: 0,
|
||||
cursorZ: 0,
|
||||
insideBlock: false,
|
||||
});
|
||||
|
||||
if (bot.core.usePlacedCommandBlock) {
|
||||
return;
|
||||
} else {
|
||||
bot.core.commandBlock(command, itemPosition, 1, 5);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
move(pos = bot.position) {
|
||||
bot.core.position = {
|
||||
x: Math.floor(pos.x / 16) * 16,
|
||||
y: 0,
|
||||
z: Math.floor(pos.z / 16) * 16,
|
||||
};
|
||||
|
||||
bot.core.itemPosition = {
|
||||
x: Math.floor(pos.x),
|
||||
y: Math.floor(pos.y - 1),
|
||||
z: Math.floor(pos.z),
|
||||
};
|
||||
|
||||
bot.core.commandBlocks = [];
|
||||
|
||||
if (bot.options.itemRefill && bot.options.mode !== "savageFriends") {
|
||||
bot.core.itemRefill();
|
||||
} else {
|
||||
bot.core.chatRefill();
|
||||
}
|
||||
},
|
||||
|
||||
currentBlock() {
|
||||
const relativePosition = bot.core.currentBlockRelative;
|
||||
const corePosition = bot.core.position;
|
||||
if (!corePosition) return null;
|
||||
return {
|
||||
x: relativePosition.x + corePosition.x,
|
||||
y: relativePosition.y + corePosition.y,
|
||||
z: relativePosition.z + corePosition.z,
|
||||
};
|
||||
},
|
||||
|
||||
incrementCurrentBlock() {
|
||||
const relativePosition = bot.core.currentBlockRelative;
|
||||
const { start, end } = bot.core.area;
|
||||
|
||||
relativePosition.x++;
|
||||
|
||||
if (relativePosition.x > end.x) {
|
||||
relativePosition.x = start.x;
|
||||
relativePosition.z++;
|
||||
}
|
||||
|
||||
if (relativePosition.z > end.z) {
|
||||
relativePosition.z = start.z;
|
||||
relativePosition.y++;
|
||||
}
|
||||
|
||||
if (relativePosition.y > end.y) {
|
||||
relativePosition.x = start.x;
|
||||
relativePosition.y = start.y;
|
||||
relativePosition.z = start.z;
|
||||
}
|
||||
},
|
||||
|
||||
commandBlock(command, location, mode, flags) {
|
||||
if (!bot.loggedIn) return;
|
||||
bot._client.write("update_command_block", {
|
||||
command: command?.substring(0, 32767),
|
||||
location: location,
|
||||
mode: mode,
|
||||
flags: flags,
|
||||
});
|
||||
},
|
||||
|
||||
run(command) {
|
||||
const location = bot.core.currentBlock();
|
||||
const itemPosition = bot.core.itemPosition;
|
||||
|
||||
if (!location) return;
|
||||
if (bot.options.mode === "creayun") {
|
||||
return;
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot.core.commandBlock(command, location, 2, 0b101);
|
||||
|
||||
bot.core.incrementCurrentBlock();
|
||||
} else {
|
||||
if (bot.core.usePlacedCommandBlock) {
|
||||
bot.core.commandBlock(command, itemPosition, 1, 5);
|
||||
bot.core.incrementCurrentBlock();
|
||||
} else {
|
||||
bot.core.commandBlock(command, location, 1, 5);
|
||||
bot.core.incrementCurrentBlock();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
async runTracked(command, source) {
|
||||
const location = bot.core.currentBlock();
|
||||
|
||||
const transactionId = Math.floor(Math.random() * 10000);
|
||||
|
||||
bot.core.commandBlock(command, location, 1, 0b101);
|
||||
|
||||
bot.core.incrementCurrentBlock();
|
||||
|
||||
await sleep(100);
|
||||
|
||||
bot._client.write("query_block_nbt", { location, transactionId });
|
||||
|
||||
bot.on("packet.nbt_query_response", async (data) => {
|
||||
try {
|
||||
if (data.transactionId == transactionId) {
|
||||
if (data?.nbt?.value?.LastOutput) {
|
||||
const output = convertNbtComponentToJson(
|
||||
null,
|
||||
data.nbt.value.LastOutput.value.extra,
|
||||
);
|
||||
source.sendFeedback(output);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
let timer;
|
||||
bot.on("packet.block_change", (data) => {
|
||||
try {
|
||||
if (
|
||||
data?.location?.x === bot?.core?.position?.x &&
|
||||
data?.location?.y === bot?.core?.position?.y &&
|
||||
data?.location?.z === bot?.core?.position?.z &&
|
||||
data.type === 0
|
||||
) {
|
||||
bot.core.move(bot.position);
|
||||
}
|
||||
} catch (e) {
|
||||
bot.console.warn(e.toString());
|
||||
}
|
||||
});
|
||||
|
||||
bot.on("move", async () => {
|
||||
try {
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
await sleep(2000);
|
||||
bot.chat.command("/removenear commandblock");
|
||||
await sleep(2000);
|
||||
bot.core.move(bot.position);
|
||||
} else {
|
||||
bot.core.move(bot.position);
|
||||
}
|
||||
} catch (e) {
|
||||
bot.console.warn(e.toString());
|
||||
}
|
||||
});
|
||||
|
||||
bot.on("packet.login", () => {
|
||||
timer = setInterval(() => {
|
||||
bot.core.move(bot.position);
|
||||
}, config.core.refillInterval);
|
||||
});
|
||||
|
||||
bot.on("end", () => {
|
||||
if (timer) clearInterval(timer);
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = commandCore;
|
||||
@@ -1,52 +0,0 @@
|
||||
const CommandSource = require("../commandUtil/CommandSource");
|
||||
|
||||
class commandHandler {
|
||||
constructor(context) {
|
||||
let ratelimit = 0;
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
|
||||
bot.on("parsed_message", (data) => {
|
||||
try {
|
||||
if (data.type !== "minecraft:chat" && data.type !== "extras:command_spy") return;
|
||||
const prefixes = config.prefixes;
|
||||
prefixes.map((prefix) => {
|
||||
const plainMessage = bot
|
||||
.getMessageAsPrismarine(data.contents)
|
||||
?.toString();
|
||||
|
||||
if (!plainMessage?.startsWith(prefix)) return;
|
||||
const command = plainMessage.substring(prefix.length);
|
||||
|
||||
const source = new CommandSource(
|
||||
data.sender,
|
||||
{ discord: false, console: false },
|
||||
data.chatType,
|
||||
data.trustLevel,
|
||||
);
|
||||
|
||||
source.sendFeedback = (message) => {
|
||||
if (options.mode === "savageFriends") bot.tellraw(`@a`, [
|
||||
message
|
||||
])
|
||||
else bot.tellraw(`@p[nbt={UUID:[I;${source.player.entityUuid}]}]`, message)
|
||||
}
|
||||
ratelimit++;
|
||||
setTimeout(() => {
|
||||
ratelimit--;
|
||||
}, 1000);
|
||||
if (ratelimit > config.ratelimit.commands) {
|
||||
return;
|
||||
} else if (command.split(" ")[0].length === 0) {
|
||||
} else {
|
||||
bot.commandManager.executeString(source, command);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
bot.console.error(e.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = commandHandler;
|
||||
@@ -1,28 +0,0 @@
|
||||
class commandLoop {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
bot.cloop = {
|
||||
list: [],
|
||||
add(command, interval) {
|
||||
let timer;
|
||||
timer = {
|
||||
timer: setInterval(() => bot.core.run(command), interval),
|
||||
command,
|
||||
interval,
|
||||
};
|
||||
this.list.push(timer);
|
||||
},
|
||||
|
||||
remove(index) {
|
||||
clearInterval(this.list[index].timer);
|
||||
bot.cloop.list.splice(index, 1);
|
||||
},
|
||||
|
||||
clear() {
|
||||
for (const cloop of this.list) clearInterval(cloop.timer);
|
||||
this.list = [];
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
module.exports = commandLoop;
|
||||
@@ -1,161 +0,0 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const CommandError = require("../commandUtil/CommandError");
|
||||
const CommandSource = require("../commandUtil/CommandSource");
|
||||
const CommandArguments = require('../commandUtil/CommandArguments')
|
||||
const fixansi = require("../util/ansi");
|
||||
const sleep = require("../util/sleep.js");
|
||||
|
||||
class commandManager {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const options = context.options;
|
||||
const translations = bot.translations;
|
||||
|
||||
bot.commandManager = {
|
||||
commands: {},
|
||||
commandlist: [],
|
||||
execute(source, commandName, args) {
|
||||
const command = this.getCommand(commandName.toLowerCase());
|
||||
|
||||
try {
|
||||
if (!command) {
|
||||
throw new CommandError({
|
||||
translate: "%s%s%s %s",
|
||||
color: "red",
|
||||
with: [
|
||||
{ translate: "command.unknown.command", color: "red" },
|
||||
{ text: "\n" },
|
||||
{ text: `${commandName}`, color: "gray" },
|
||||
{ translate: "command.context.here", color: "red" }
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
if (command?.data?.trustLevel !== 0 && command?.data.trustLevel < 4) {
|
||||
if (!source.sources.console && !source.sources.discord) {
|
||||
if (args[0] === bot.validation.trusted)
|
||||
source.player.trustLevel = 1
|
||||
else if (args[0] === bot.validation.admin)
|
||||
source.player.trustLevel = 2
|
||||
else if (args[0] === bot.validation.owner)
|
||||
source.player.trustLevel = 3
|
||||
|
||||
args = args.slice(1)
|
||||
if (source.player.trustLevel < command?.data?.trustLevel && !source.sources.console) {
|
||||
throw new CommandError({
|
||||
translate: "fnfboyfriendbot.command_manager.validation.invalid_hash",
|
||||
fallback: translations["fnfboyfriendbot.command_manager.validation.invalid_hash"],
|
||||
color: "red"
|
||||
})
|
||||
}
|
||||
} if (source.sources.discord) {
|
||||
const event = bot.discord.message;
|
||||
const roles = event?.member?.roles?.cache;
|
||||
const hashRole = roles?.some((role) => {
|
||||
if (role.name === `${config.discord.roles.trusted}`) source.player.trustLevel = 1;
|
||||
else if (role.name === `${config.discord.roles.admin}`) source.player.trustLevel = 2;
|
||||
else if (role.name === `${config.discord.roles.owner}`) source.player.trustLevel = 3;
|
||||
})
|
||||
|
||||
if (source.player.trustLevel < command?.data?.trustLevel)
|
||||
throw new CommandError({
|
||||
translate: "fnfboyfriendbot.command_manager.validation.invalid_role",
|
||||
fallback: translations["fnfboyfriendbot.command_manager.validation.invalid_role"],
|
||||
color: "red"
|
||||
})
|
||||
}
|
||||
} if (command?.data?.trustLevel === 4 && !source.sources.console)
|
||||
throw new CommandError({
|
||||
translate: "fnfboyfriendbot.command_manager.trust_level.console_only",
|
||||
fallback: translations["fnfboyfriendbot.command_manager.trust_level.console_only"],
|
||||
color: "red"
|
||||
})
|
||||
if (
|
||||
command?.data.playerChatOnly
|
||||
&&
|
||||
source.ChatType !== "minecraft:player_chat"
|
||||
&&
|
||||
!source.sources.console
|
||||
&&
|
||||
!source.sources.discord
|
||||
&&
|
||||
bot.options.mode === 'kaboom'
|
||||
) return
|
||||
return command?.execute({
|
||||
bot,
|
||||
source,
|
||||
arguments: args,
|
||||
config,
|
||||
discordClient,
|
||||
});
|
||||
} catch (error) {
|
||||
if (error instanceof CommandError) {
|
||||
source.sendFeedback(error._message);
|
||||
} else {
|
||||
bot.console.error(error.stack)
|
||||
source.sendFeedback(
|
||||
{
|
||||
translate: "command.failed",
|
||||
color: "red",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
contents: String(error.stack),
|
||||
},
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
executeString(source, command) {
|
||||
const [commandName, ...args] = command.split(" ");
|
||||
|
||||
return this.execute(source, commandName, args);
|
||||
},
|
||||
|
||||
register(command) {
|
||||
this.commands[command.data.name] = command;
|
||||
if (command.data.aliases) {
|
||||
command.data.aliases.map((a) => (this.commands[a] = command));
|
||||
}
|
||||
},
|
||||
|
||||
getCommand(name) {
|
||||
return this.commands[name];
|
||||
},
|
||||
|
||||
getCommands() {
|
||||
return Object.values(this.commands);
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
command loader ported from my discord bot SkiBot
|
||||
*/
|
||||
let commandlist = [];
|
||||
const foldersPath = path.join(__dirname, "../commands");
|
||||
const commandFolders = fs.readdirSync(foldersPath);
|
||||
for (const folder of commandFolders) {
|
||||
const commandsPath = path.join(foldersPath, folder);
|
||||
const commandFiles = fs.readdirSync(commandsPath);
|
||||
for (const filename of commandFiles) {
|
||||
try {
|
||||
const filePath = path.join(commandsPath, filename);
|
||||
|
||||
if (filename.endsWith(".js")) {
|
||||
const command = require(filePath);
|
||||
const commands = new command();
|
||||
bot.commandManager.register(commands);
|
||||
bot.commandManager.commandlist.push(commands);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Failed to load command", filename, ":", error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = commandManager;
|
||||
@@ -1,38 +0,0 @@
|
||||
class commandSpy {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
|
||||
bot.on("system_chat", (message) => {
|
||||
try {
|
||||
const child = message.extra;
|
||||
const sender =
|
||||
bot.players.find((e) => e?.profile?.name === message.text)?.profile
|
||||
?.name === message.text;
|
||||
if (!child || !message.text || !message.color || !sender) return;
|
||||
const command = child[1].substring("/".length);
|
||||
if (
|
||||
(message.color === "yellow" &&
|
||||
child[0] === ": " &&
|
||||
child[1] === `/${command}` &&
|
||||
sender) ||
|
||||
(message.color === "aqua" &&
|
||||
child[0] === ": " &&
|
||||
child[1] === `/${command}` &&
|
||||
sender)
|
||||
) bot.emit("parsed_message", {
|
||||
sender: bot.players.find((e) => e.profile.name === message.text),
|
||||
contents: { text: command },
|
||||
type: "extras:command_spy",
|
||||
displayName: bot.players.find(
|
||||
(e) => e.profile.name === message.text,
|
||||
).displayName,
|
||||
});
|
||||
} catch (e) {
|
||||
// console.log(e.stack);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = commandSpy;
|
||||
@@ -0,0 +1,173 @@
|
||||
const mcData = require('minecraft-data')('1.20.2');
|
||||
const nbt = require('prismarine-nbt');
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
description: "runs commands in command blocks",
|
||||
enabled: true,
|
||||
name: "command core",
|
||||
type: "commands"
|
||||
},
|
||||
inject (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const Item = require("prismarine-item")(bot.server.version);
|
||||
|
||||
bot.core = {
|
||||
area: {
|
||||
start: config.core?.area.start ?? { x: 0, y: 0, z: 0 },
|
||||
end: config.core?.area.end ?? { x: 15, y: 0, z: 15 }
|
||||
},
|
||||
|
||||
position: null,
|
||||
|
||||
itemPosition: null,
|
||||
|
||||
currentBlockRelative: { x: 0, y: 0, z: 0 },
|
||||
|
||||
usePlacedCommandBlock: false,
|
||||
|
||||
chatRefill () {
|
||||
const pos = bot.core.position
|
||||
const { start, end } = bot.core.area
|
||||
|
||||
if (!pos) return
|
||||
const command = `/minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:${JSON.stringify(config.core.name)}}`
|
||||
bot.chat(`${command}`)
|
||||
},
|
||||
|
||||
itemRefill () {
|
||||
const pos = bot.core.position;
|
||||
const { start, end } = bot.core.area;
|
||||
const itemPosition = bot.core.itemPosition;
|
||||
|
||||
if (!pos) return;
|
||||
|
||||
const command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} command_block{CustomName:${JSON.stringify(config.core.name)}}`
|
||||
|
||||
bot._client.write('set_creative_slot', {
|
||||
slot: 36,
|
||||
item: Item.toNotch(
|
||||
new Item(
|
||||
bot.registry.itemsByName.repeating_command_block.id,
|
||||
1,
|
||||
0,
|
||||
),
|
||||
),
|
||||
});
|
||||
|
||||
bot._client.write('block_dig', {
|
||||
status: 0,
|
||||
location: itemPosition,
|
||||
face: 0
|
||||
});
|
||||
|
||||
bot._client.write('block_place', {
|
||||
hand: 0,
|
||||
location: itemPosition,
|
||||
direction: 0,
|
||||
cursorX: 0.1,
|
||||
cursorY: 0,
|
||||
cursorZ: 0.1,
|
||||
insideBlock: false
|
||||
});
|
||||
|
||||
if (bot.core.usePlacedCommandBlock) {
|
||||
return
|
||||
} else {
|
||||
bot._client.write('update_command_block', {
|
||||
location: itemPosition,
|
||||
command,
|
||||
flags: 5,
|
||||
mode: 1
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
move (pos = bot.position) {
|
||||
bot.core.position = {
|
||||
x: Math.floor(pos.x / 16) * 16,
|
||||
y: 0,
|
||||
z: Math.floor(pos.z / 16) * 16
|
||||
};
|
||||
|
||||
bot.core.itemPosition = {
|
||||
x: pos.x,
|
||||
y: pos.y -1,
|
||||
z: pos.z
|
||||
}
|
||||
|
||||
if (config.core.itemRefill === true) {
|
||||
bot.core.itemRefill();
|
||||
} else {
|
||||
bot.core.chatRefill();
|
||||
}
|
||||
},
|
||||
|
||||
currentBlock () {
|
||||
const relativePosition = bot.core.currentBlockRelative
|
||||
const corePosition = bot.core.position
|
||||
if (!corePosition) return null
|
||||
return { x: relativePosition.x + corePosition.x, y: relativePosition.y + corePosition.y, z: relativePosition.z + corePosition.z }
|
||||
},
|
||||
|
||||
incrementCurrentBlock () {
|
||||
const relativePosition = bot.core.currentBlockRelative
|
||||
const { start, end } = bot.core.area
|
||||
|
||||
relativePosition.x++
|
||||
|
||||
if (relativePosition.x > end.x) {
|
||||
relativePosition.x = start.x
|
||||
relativePosition.z++
|
||||
}
|
||||
|
||||
if (relativePosition.z > end.z) {
|
||||
relativePosition.z = start.z
|
||||
relativePosition.y++
|
||||
}
|
||||
|
||||
if (relativePosition.y > end.y) {
|
||||
relativePosition.x = start.x
|
||||
relativePosition.y = start.y
|
||||
relativePosition.z = start.z
|
||||
}
|
||||
},
|
||||
|
||||
run (command) {
|
||||
const location = bot.core.currentBlock();
|
||||
const itemPosition = bot.core.itemPosition;
|
||||
|
||||
if (!location || bot.server.mode === "savageFriends") return;
|
||||
if (bot.core.usePlacedCommandBlock) {
|
||||
bot._client.write('update_command_block', {
|
||||
command: command.substring(0, 32767),
|
||||
location: itemPosition,
|
||||
mode: 1,
|
||||
flags: 5,
|
||||
});
|
||||
|
||||
bot.core.incrementCurrentBlock();
|
||||
} else {
|
||||
bot._client.write('update_command_block', {
|
||||
command: command.substring(0, 32767),
|
||||
location,
|
||||
mode: 1,
|
||||
flags: 5
|
||||
});
|
||||
|
||||
bot.core.incrementCurrentBlock();
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
bot.on('move', () => {
|
||||
if (bot.server.mode === "savageFriends") return;
|
||||
bot.core.move(bot.position)
|
||||
})
|
||||
|
||||
bot.on('packet.block_change', (data) => {
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
description: "loops commands",
|
||||
enabled: true,
|
||||
name: "command loop",
|
||||
type: "extras"
|
||||
},
|
||||
inject (context) {
|
||||
const bot = context.bot;
|
||||
bot.cloop = {
|
||||
list: [],
|
||||
add (command, interval) {
|
||||
let timer;
|
||||
if (bot.server.mode === "savageFriends") {
|
||||
timer = ({ timer: setInterval(() => bot.chat(`${command}`), interval), command, interval })
|
||||
} else {
|
||||
timer = ({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
|
||||
}
|
||||
this.list.push(timer)
|
||||
|
||||
bot.on('end', () => {
|
||||
this.clear()
|
||||
})
|
||||
|
||||
bot.on('packet.login', () => {
|
||||
if (this.list.length === 0) return
|
||||
timer = ({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
|
||||
this.list.push(timer);
|
||||
})
|
||||
},
|
||||
|
||||
remove (index) {
|
||||
clearInterval(this.list[index].timer)
|
||||
bot.cloop.list.splice(index, 1)
|
||||
},
|
||||
|
||||
clear () {
|
||||
for (const cloop of this.list) clearInterval(cloop.timer)
|
||||
this.list = []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
description: "registers commands",
|
||||
enabled: true,
|
||||
name: "command manager",
|
||||
type: "commands"
|
||||
},
|
||||
inject (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const webhook = context.webhook;
|
||||
const { MessageBuilder } = require('prismarine-chat')(bot.server.version);
|
||||
bot.commandManager = {
|
||||
commands: {},
|
||||
commandlist: [],
|
||||
execute (commandName, args) {
|
||||
const command = bot.commandManager.getCommand(commandName?.toLowerCase())
|
||||
|
||||
try {
|
||||
if (!command || !command.execute) bot.console.command('unknown command');
|
||||
return command?.execute({ bot, config, arguments: args, MessageBuilder, webhook })
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
executeString (command) {
|
||||
const [commandName, ...args] = command.split(' ')
|
||||
return this.execute(commandName, args)
|
||||
},
|
||||
|
||||
register (command) {
|
||||
this.commands[command.data.name] = command
|
||||
if (command.data.aliases) {
|
||||
command.data.aliases.map((a) => (
|
||||
this.commands[a] = command
|
||||
))
|
||||
}
|
||||
},
|
||||
|
||||
getCommand (name) {
|
||||
return this.commands[name]
|
||||
},
|
||||
|
||||
getCommands () {
|
||||
return Object.values(this.commands)
|
||||
}
|
||||
}
|
||||
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, '../commands'))) {
|
||||
try {
|
||||
const command = require(path.join(__dirname, '../commands', filename))
|
||||
if (command.data.enabled === false) {
|
||||
|
||||
} else {
|
||||
bot.commandManager.register(command);
|
||||
bot.commandManager.commandlist.push(command);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load command', filename, ':', error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+47
-136
@@ -1,151 +1,62 @@
|
||||
const CommandSource = require("../commandUtil/CommandSource");
|
||||
const prismarineChat = require("prismarine-chat")("1.21.8");
|
||||
const { fromNotch } = require('prismarine-chat')('1.20.2');
|
||||
const readline = require('readline');
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
});
|
||||
|
||||
class Console {
|
||||
// named it Console so that it doesnt override the console variable
|
||||
constructor(context) {
|
||||
module.exports = {
|
||||
data: {
|
||||
description: "console functions",
|
||||
enabled: true,
|
||||
name: "console",
|
||||
type: "console"
|
||||
},
|
||||
inject (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
rl.on('line', (args) => {
|
||||
if (args.startsWith(config.console.prefix)) {
|
||||
return bot.commandManager.executeString(args.substring(config.console.prefix.length));
|
||||
} else if (args.startsWith('')) {
|
||||
if (bot.customChat.enabled) {
|
||||
if (args.startsWith('/')) {
|
||||
bot.chat(`/${args.substring(1)}`);
|
||||
return;
|
||||
}
|
||||
bot.customChat.chat(args.substring(0));
|
||||
} else {
|
||||
bot.commandManager.executeString(`echo ${args.substring(0)}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let ratelimit = 0;
|
||||
|
||||
let serverName;
|
||||
|
||||
if (options.private) {
|
||||
serverName = `${options.serverName}`;
|
||||
} else {
|
||||
serverName = `§1${bot.options.host}:§9${bot.options.port}`;
|
||||
refreshLine = function (...args) {
|
||||
rl.output.write("\x1b[2K\r");
|
||||
console.log(args.toString());
|
||||
rl._refreshLine();
|
||||
}
|
||||
|
||||
bot.console = {
|
||||
readline: null,
|
||||
server: "all",
|
||||
readlineInterface(rl) {
|
||||
this.readline = rl;
|
||||
rl.on("line", (args) => {
|
||||
if (bot.options.serverName !== this.server && this.server !== "all")
|
||||
return;
|
||||
if (args.startsWith(config.console.prefix)) {
|
||||
return bot.commandManager.executeString(
|
||||
bot.console.source,
|
||||
args.substring(config.console.prefix.length),
|
||||
);
|
||||
} else if (args.startsWith("")) {
|
||||
bot.chat.send(args);
|
||||
}
|
||||
|
||||
rl.on("close", () => {
|
||||
this.readline = null;
|
||||
});
|
||||
});
|
||||
},
|
||||
source: new CommandSource(
|
||||
{
|
||||
profile: {
|
||||
name: bot._client.username,
|
||||
},
|
||||
uuid: bot._client.uuid,
|
||||
},
|
||||
{ console: true, discord: false },
|
||||
"minecraft:chat",
|
||||
{
|
||||
trustLevel: 4,
|
||||
log (message) {
|
||||
if (fromNotch(message)?.toString().includes("https://www.innersloth.com/games/among-us/ › amogus")) {
|
||||
|
||||
} else {
|
||||
refreshLine(`${fromNotch("§8[§6logs§8]§r")?.toAnsi()} ${fromNotch(message)?.toAnsi(require('../data/language.json'))}`)
|
||||
}
|
||||
),
|
||||
refreshLine(...args) {
|
||||
this?.readline.output.write("\x1b[2K\r");
|
||||
console.log.apply(console, arguments);
|
||||
this.readline._refreshLine();
|
||||
},
|
||||
log(message) {
|
||||
this.refreshLine(
|
||||
bot
|
||||
.getMessageAsPrismarine(
|
||||
`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO" })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })} §6logs§8] §8[${serverName}§8] `,
|
||||
)
|
||||
?.toAnsi() + message,
|
||||
);
|
||||
command (message) {
|
||||
refreshLine(`${fromNotch("§8[§ecommand§8]§r")?.toAnsi()} ${fromNotch(message)?.toAnsi(require('../data/language.json'))}`)
|
||||
},
|
||||
warn(error) {
|
||||
this.refreshLine(
|
||||
prismarineChat
|
||||
.fromNotch(
|
||||
`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO" })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })} §ewarn§8] §8[${serverName}§8] `,
|
||||
)
|
||||
?.toAnsi() + error,
|
||||
);
|
||||
disconnect (reason) {
|
||||
refreshLine(`${fromNotch("§8[§bdisconnect§8]§r")?.toAnsi()} ${fromNotch(reason)?.toAnsi(require('../data/language.json'))}`)
|
||||
},
|
||||
error(error) {
|
||||
this.refreshLine(
|
||||
bot
|
||||
.getMessageAsPrismarine(
|
||||
`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO" })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })} §4error§8] §8[${serverName}§8] `,
|
||||
)
|
||||
?.toAnsi() + error,
|
||||
);
|
||||
warn (error) {
|
||||
refreshLine(`${fromNotch("§8[§cwarn§8]§r")?.toAnsi()} ${fromNotch(error)?.toAnsi(require('../data/language.json'))}`)
|
||||
},
|
||||
info(message) {
|
||||
this.refreshLine(
|
||||
prismarineChat
|
||||
.fromNotch(
|
||||
`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO" })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })} §2info§8] §8[${serverName}§8] `,
|
||||
)
|
||||
?.toAnsi() + message,
|
||||
);
|
||||
},
|
||||
command(message) {
|
||||
this.refreshLine(
|
||||
prismarineChat
|
||||
.fromNotch(
|
||||
`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO" })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })} §6command§8] §8[${serverName}§8] `,
|
||||
)
|
||||
?.toAnsi() +
|
||||
bot.getMessageAsPrismarine(message)?.toAnsi(bot.registry.language),
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
bot.console.source.sendFeedback = (message) => {
|
||||
bot.console.command(message);
|
||||
};
|
||||
setInterval(() => (ratelimit = 0), 1000 * 2);
|
||||
|
||||
bot.on("message", (message) => {
|
||||
if (message.type === "minecraft:player_chat")
|
||||
message = [
|
||||
{
|
||||
text: "[P] ",
|
||||
},
|
||||
message.message,
|
||||
];
|
||||
else if (message.type === "minecraft:disguised_chat") message = [
|
||||
{
|
||||
text: "[V] "
|
||||
},
|
||||
message.message
|
||||
]
|
||||
else if (message.type === "minecraft:system_chat") message = [
|
||||
{
|
||||
text: "[S] "
|
||||
},
|
||||
message.message
|
||||
]
|
||||
|
||||
if (options.logging.console) {
|
||||
if (ratelimit > config.ratelimit.console) return;
|
||||
|
||||
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
error (error) {
|
||||
refreshLine(`${fromNotch("§8[§4error§8]§r")?.toAnsi()} ${fromNotch(error)?.toAnsi(require('../data/language.json'))}`)
|
||||
}
|
||||
|
||||
if (options.logging.file && bot.loggedIn) {
|
||||
bot.console.fileLogger(
|
||||
`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO" })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })} logs] [${serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`,
|
||||
);
|
||||
}
|
||||
|
||||
ratelimit++;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = Console;
|
||||
|
||||
@@ -1,192 +0,0 @@
|
||||
const fixansi = require("../util/ansi");
|
||||
const CommandSource = require("../commandUtil/CommandSource");
|
||||
|
||||
class discord {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const options = context.options;
|
||||
if (options.channelId.length == 0) {
|
||||
bot.discord = {
|
||||
invite: config.discord?.invite,
|
||||
client: discordClient,
|
||||
prefix: config.discord.prefix,
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
bot.discord = {
|
||||
client: discordClient,
|
||||
channel: undefined,
|
||||
invite: config.discord.invite || undefined,
|
||||
prefix: config.discord.prefix,
|
||||
};
|
||||
discordClient.once("clientReady", (context) => {
|
||||
bot.discord.channel = discordClient.channels.cache.get(options.channelId);
|
||||
discordClient.user.setPresence({
|
||||
activities: [
|
||||
{
|
||||
name: `${config.discord.presence.name}`,
|
||||
type: 0,
|
||||
},
|
||||
],
|
||||
status: `${config.discord.presence.status}`,
|
||||
});
|
||||
});
|
||||
|
||||
let discordQueue = [];
|
||||
setInterval(() => {
|
||||
if (discordQueue.length === 0) return;
|
||||
try {
|
||||
bot?.discord?.channel?.send(
|
||||
`\`\`\`ansi\n${discordQueue.join("\n").substring(0, 1984)}\n\`\`\``,
|
||||
);
|
||||
} catch (error) {}
|
||||
discordQueue = [];
|
||||
}, 2000);
|
||||
|
||||
function sendDiscordMessage(message) {
|
||||
discordQueue.push(message);
|
||||
}
|
||||
|
||||
function sendComponent(message) {
|
||||
const ansi = bot
|
||||
.getMessageAsPrismarine(message)
|
||||
?.toAnsi(bot?.registry?.language)
|
||||
.replaceAll("```\u001b[9```" + "```\u001b[3```")
|
||||
.replaceAll("https://discord", "https:\rdiscord");
|
||||
try {
|
||||
sendDiscordMessage(fixansi(ansi?.replaceAll("`", "`\u200b")));
|
||||
} catch (e) {
|
||||
bot.console.warn(`Error sending a message to Discord: ${e.message}`);
|
||||
sendDiscordMessage(e.message);
|
||||
}
|
||||
}
|
||||
|
||||
bot.on("message", (message) => {
|
||||
sendComponent(message.message);
|
||||
});
|
||||
|
||||
function messageCreate(message, source) {
|
||||
bot.discord.message = message;
|
||||
if (message.author.id === bot.discord.client.user.id) return;
|
||||
|
||||
if (message.channel.id !== bot.discord.channel.id) return;
|
||||
|
||||
if (message.content.startsWith(config.discord.prefix)) {
|
||||
const source = new CommandSource(
|
||||
{
|
||||
profile: {
|
||||
name: `${message?.member.nickname || message?.author.displayName}`,
|
||||
},
|
||||
},
|
||||
{
|
||||
discord: true,
|
||||
console: false,
|
||||
},
|
||||
false,
|
||||
message,
|
||||
);
|
||||
|
||||
source.sendFeedback = input => {
|
||||
message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(input)?.toAnsi()?.replaceAll('`', '`\u200b').substring(0, 1780))}\`\`\``);
|
||||
}
|
||||
|
||||
bot.commandManager.executeString(
|
||||
source,
|
||||
message.content.substring(config.discord.prefix.length),
|
||||
);
|
||||
return;
|
||||
}
|
||||
const tag = {
|
||||
translate: "[%s] %s \u203a ",
|
||||
with: [
|
||||
{
|
||||
translate: "%s%s%s %s",
|
||||
bold: false,
|
||||
with: [
|
||||
{
|
||||
text: "FNF",
|
||||
bold: false,
|
||||
color: "blue",
|
||||
},
|
||||
{
|
||||
text: "Boyfriend",
|
||||
bold: false,
|
||||
color: "dark_aqua",
|
||||
},
|
||||
{
|
||||
text: "Bot",
|
||||
bold: false,
|
||||
color: "dark_blue",
|
||||
},
|
||||
{
|
||||
text: "Discord",
|
||||
bold: false,
|
||||
color: "blue",
|
||||
},
|
||||
],
|
||||
click_event: bot.discord.invite
|
||||
? {
|
||||
action: "open_url",
|
||||
url: bot.discord.invite,
|
||||
}
|
||||
: undefined,
|
||||
hover_event: {
|
||||
action: "show_text",
|
||||
value: [ "Click to join the discord" ],
|
||||
},
|
||||
},
|
||||
{
|
||||
text: `${message.member.nickname || message.author.displayName}`,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
try {
|
||||
if (message.attachments.size > 0) {
|
||||
message.attachments.forEach((Attachment) => {
|
||||
let attachment = {
|
||||
text: `[Attachment: ${Attachment.name}] ${message?.content}`,
|
||||
color: "blue",
|
||||
hover_event: {
|
||||
action: "show_text",
|
||||
contents: "click here to view attachment",
|
||||
},
|
||||
click_event: {
|
||||
action: "open_url",
|
||||
url: `${Attachment?.url}`,
|
||||
},
|
||||
};
|
||||
|
||||
bot.tellraw("@a", [tag, attachment]);
|
||||
});
|
||||
} else if (message?.reference?.type === 0) {
|
||||
// this is for messages that are replied to
|
||||
const repliedMessage = message.channel.messages.cache.get(
|
||||
message.reference.messageId,
|
||||
);
|
||||
let reply = [
|
||||
tag,
|
||||
{
|
||||
text: `[Replying to: ${repliedMessage.author.username}] `,
|
||||
color: "blue",
|
||||
},
|
||||
message.content,
|
||||
];
|
||||
|
||||
bot.tellraw("@a", [reply]);
|
||||
} else if (message?.reference?.type === 1) {
|
||||
// this is for messages that are forwarded
|
||||
} else {
|
||||
bot.tellraw("@a", [tag, message.content]);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
}
|
||||
discordClient.on("messageCreate", messageCreate);
|
||||
}
|
||||
}
|
||||
module.exports = discord;
|
||||
@@ -1,63 +0,0 @@
|
||||
const channels = "extras:register\0extras:unregister\0extras:message\0";
|
||||
class extrasMessages {
|
||||
constructor (context) {
|
||||
const bot = context.bot
|
||||
const config = context.config
|
||||
const options = context.options
|
||||
|
||||
bot.on('packet.login', () => {
|
||||
bot._client.write("custom_payload", {
|
||||
channel: "minecraft:register",
|
||||
data: Buffer.from(channels, "utf8")
|
||||
})
|
||||
});
|
||||
|
||||
// I wanna use the extras channels to my advantage --- Parker2991
|
||||
bot.extras = {
|
||||
channels: [],
|
||||
register (channel) {
|
||||
const buf = Buffer.from(channel, "utf8")
|
||||
buf[buf.length - 1] |= 0x80;
|
||||
bot._client.write("custom_payload", {
|
||||
channel: "extras:register",
|
||||
data: buf,
|
||||
})
|
||||
|
||||
bot.extras.channels.push(channel)
|
||||
},
|
||||
unregister (channel) {
|
||||
const buf = Buffer.from(channel, "utf8")
|
||||
buf[buf.length - 1] |= 0x80;
|
||||
|
||||
bot._client.write("custom_payload", {
|
||||
channel: "extras:unregister",
|
||||
data: buf,
|
||||
})
|
||||
bot.extras.channels.pop(channel)
|
||||
},
|
||||
unregisterall () {
|
||||
for (const channel of this.channels) {
|
||||
this.unregister(channel)
|
||||
}
|
||||
},
|
||||
send (channel, message) {
|
||||
const buf = Buffer.from(channel, "utf8")
|
||||
buf[buf.length - 1] |= 0x80;
|
||||
bot._client.write("custom_payload", {
|
||||
channel: "extras:message",
|
||||
data: Buffer.concat([buf, Buffer.from(`${message}`, "utf8")])
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
bot.on('end', () => bot.extras.channels = [])
|
||||
|
||||
bot.on('packet.custom_payload', (data) => {
|
||||
if (data.channel === "extras:message") {
|
||||
console.log(data.data.toString('ascii'))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = extrasMessages;
|
||||
@@ -1,74 +0,0 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { createGzip } = require("zlib");
|
||||
const readline = require("readline");
|
||||
const { Console } = require("console");
|
||||
|
||||
class fileLogger {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
const currentDate = new Date();
|
||||
|
||||
if (!options.logging.file) return;
|
||||
|
||||
const timestamp = `${currentDate.getFullYear()}-${(
|
||||
currentDate.getMonth() + 1
|
||||
)
|
||||
.toString()
|
||||
.padStart(2, "0")}-${currentDate.getDate().toString().padStart(2, "0")}`;
|
||||
const logFolder = path.join(
|
||||
__dirname,
|
||||
`${config.logsFolder.path}`,
|
||||
`${config.logsFolder.name}`,
|
||||
);
|
||||
const logFileName = "latest.log";
|
||||
const logFilePath = path.join(logFolder, logFileName);
|
||||
const logStream = fs.createWriteStream(logFilePath, { flags: "a" });
|
||||
try {
|
||||
if (!fs.existsSync(logFolder)) {
|
||||
console.info(
|
||||
`logs folder not found recreating it at ${config.logsFolder.path}${config.logsFolder.name}`,
|
||||
);
|
||||
fs.mkdirSync(logFolder);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(`Unable to create log folder: ${e}`);
|
||||
}
|
||||
|
||||
function compressFile(input, output) {
|
||||
const plainOutput = output.slice(0, -3);
|
||||
|
||||
fs.renameSync(input, plainOutput);
|
||||
const gzip = createGzip();
|
||||
fs.createReadStream(plainOutput)
|
||||
.pipe(gzip)
|
||||
.pipe(fs.createWriteStream(output + ".tmp"))
|
||||
.once("finish", () => {
|
||||
fs.unlinkSync(plainOutput);
|
||||
fs.renameSync(output + ".tmp", output);
|
||||
});
|
||||
}
|
||||
|
||||
if (fs.existsSync(logFilePath)) {
|
||||
const plainName = fs
|
||||
.statSync(logFilePath)
|
||||
.ctime.toISOString()
|
||||
.split("T")[0];
|
||||
let name = plainName;
|
||||
let counter = 1;
|
||||
let newFileName = path.join(logFolder, `${name}.log.gz`);
|
||||
while (fs.existsSync(newFileName)) {
|
||||
name = `${plainName}-${counter}`;
|
||||
newFileName = path.join(logFolder, `${name}.log.gz`);
|
||||
counter++;
|
||||
}
|
||||
compressFile(logFilePath, newFileName);
|
||||
}
|
||||
bot.console.fileLogger = function logging(message) {
|
||||
logStream.write(message + "\n");
|
||||
};
|
||||
}
|
||||
}
|
||||
module.exports = fileLogger;
|
||||
@@ -0,0 +1,18 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
descripton: "logs chat to console",
|
||||
enabled: true,
|
||||
name: "log",
|
||||
type: "console"
|
||||
},
|
||||
inject (context) {
|
||||
const bot = context.bot;
|
||||
|
||||
bot.on('message', (message) => {
|
||||
try {
|
||||
bot.console.log(message)
|
||||
} catch {}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
const convertNbtComponentToJson = require("../util/convertNbtComponentToJson");
|
||||
const entityUUID = require('../util/entityUUID');
|
||||
|
||||
class playerList {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
bot.players = [];
|
||||
|
||||
bot.on("packet.player_info", (packet) => {
|
||||
const actions = [];
|
||||
if (packet.action._value & 0b000001) actions.push(addPlayer);
|
||||
if (packet.action._value & 0b000010) actions.push(initializeChat);
|
||||
if (packet.action._value & 0b000100) actions.push(updateGamemode);
|
||||
if (packet.action._value & 0b001000) actions.push(updateListed);
|
||||
if (packet.action._value & 0b010000) actions.push(updateLatency);
|
||||
if (packet.action._value & 0b100000) actions.push(updateDisplayName);
|
||||
for (const entry of packet.data) {
|
||||
for (const action of actions) {
|
||||
action(entry);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
bot.on("packet.player_remove", async ({ players }) => {
|
||||
// players has uuids of the players
|
||||
let player_completion = (
|
||||
await bot.tab_complete("scoreboard players add ")
|
||||
).filter((_) => _.tooltip == undefined); // exclude @a, @r, @s, @e, @p -aaa
|
||||
bot.players.forEach(async (player) => {
|
||||
if (!players.includes(player.uuid)) return;
|
||||
|
||||
const a = player_completion.filter(
|
||||
(_) => _.match == player.profile.name,
|
||||
);
|
||||
if (a.length >= 1) {
|
||||
player.vanished = true;
|
||||
} else {
|
||||
bot.players = bot.players.filter((_) => _.uuid != player.uuid);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function addPlayer(entry) {
|
||||
bot.players = bot.players.filter((_entry) => _entry.uuid !== entry.uuid);
|
||||
bot.players.push({
|
||||
uuid: entry.uuid,
|
||||
entityUuid: entityUUID(entry.uuid),
|
||||
profile: {
|
||||
name: entry.player.name,
|
||||
properties: entry.player.properties,
|
||||
},
|
||||
chatSession: undefined,
|
||||
gamemode: undefined,
|
||||
listed: undefined,
|
||||
latency: undefined,
|
||||
displayName: undefined,
|
||||
prefix: undefined,
|
||||
vanished: false,
|
||||
});
|
||||
|
||||
bot.emit('player_info', entry)
|
||||
}
|
||||
|
||||
function initializeChat(entry) {}
|
||||
|
||||
function updateGamemode(entry) {
|
||||
const target = bot.players.find((_entry) => _entry.uuid === entry.uuid);
|
||||
if (!target) return;
|
||||
|
||||
target.gamemode = entry.gamemode;
|
||||
}
|
||||
|
||||
function updateListed(entry) {
|
||||
const target = bot.players.find((_entry) => _entry.uuid === entry.uuid);
|
||||
if (!target) return;
|
||||
target.listed = entry.listed;
|
||||
}
|
||||
|
||||
function updateLatency(entry) {
|
||||
const target = bot.players.find((_entry) => _entry.uuid === entry.uuid);
|
||||
if (!target) return;
|
||||
|
||||
target.latency = entry.latency;
|
||||
}
|
||||
|
||||
function updateDisplayName(entry) {
|
||||
const target = bot.players.find((_entry) => _entry.uuid === entry.uuid);
|
||||
if (!target) return;
|
||||
|
||||
try {
|
||||
target.displayName = convertNbtComponentToJson(null, entry.displayName);
|
||||
if (bot.options.mode === "kaboom") target.prefix = convertNbtComponentToJson(null, entry.displayName).extra[0]
|
||||
} catch {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
bot.on("end", () => (bot.players = []));
|
||||
|
||||
}
|
||||
}
|
||||
module.exports = playerList;
|
||||
+14
-12
@@ -1,24 +1,26 @@
|
||||
class position {
|
||||
constructor(context) {
|
||||
module.exports = {
|
||||
data: {
|
||||
description: "where the bot is at",
|
||||
enabled: true,
|
||||
name: "position",
|
||||
type: "client"
|
||||
},
|
||||
inject (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
bot.position = null;
|
||||
|
||||
bot.on("packet.position", (packet) => {
|
||||
bot.on('packet.position', packet => {
|
||||
bot.position = {
|
||||
x: packet.x,
|
||||
y: packet.y,
|
||||
z: packet.z,
|
||||
z: packet.z
|
||||
};
|
||||
|
||||
bot._client.write("teleport_confirm", { teleportId: packet.teleportId });
|
||||
bot._client.write('teleport_confirm', { teleportId: packet.teleportId })
|
||||
|
||||
bot.emit("move");
|
||||
});
|
||||
bot.emit('move')
|
||||
})
|
||||
|
||||
bot.on("end", () => {
|
||||
bot.position = null;
|
||||
});
|
||||
bot.on('end', () => { bot.position = null })
|
||||
}
|
||||
}
|
||||
module.exports = position;
|
||||
|
||||
+16
-20
@@ -1,26 +1,22 @@
|
||||
const mc = require("minecraft-protocol");
|
||||
const usernameGen = require("../util/usernameGen");
|
||||
class reconnect {
|
||||
constructor(context) {
|
||||
const mc = require('minecraft-protocol');
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
description: "reconnects the players to the server",
|
||||
enabled: true,
|
||||
name: "reconnect",
|
||||
type: "client"
|
||||
},
|
||||
inject (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
let client;
|
||||
bot.reconnectDelay = options.reconnectDelay;
|
||||
|
||||
bot.on("end", () => {
|
||||
if (bot.server.reconnectDelay < 0) return
|
||||
bot.on('end', () => {
|
||||
setTimeout(() => {
|
||||
if (options.usernameGen) {
|
||||
client =
|
||||
options.client ??
|
||||
mc.createClient(options, (options.username = usernameGen()));
|
||||
} else {
|
||||
client = options.client ?? mc.createClient(options);
|
||||
}
|
||||
let client = new mc.createClient(bot.server)
|
||||
bot._client = client;
|
||||
bot.emit("init_client", bot._client);
|
||||
}, bot.reconnectDelay);
|
||||
});
|
||||
bot.emit('init_client', client)
|
||||
}, bot.server.reconnectDelay);
|
||||
})
|
||||
}
|
||||
}
|
||||
module.exports = reconnect;
|
||||
|
||||
+14
-8
@@ -1,13 +1,19 @@
|
||||
const createRegistry = require("prismarine-registry");
|
||||
const registry = require('prismarine-registry');
|
||||
|
||||
class registry {
|
||||
constructor(context) {
|
||||
module.exports = {
|
||||
data: {
|
||||
description: "registers the client data",
|
||||
enabled: true,
|
||||
name: 'registry',
|
||||
type: 'client',
|
||||
},
|
||||
inject (context) {
|
||||
const bot = context.bot;
|
||||
bot.once("packet.login", (packet) => {
|
||||
bot.registry = createRegistry(bot._client.version);
|
||||
bot.registry.language = require("../data/language.json");
|
||||
bot.emit("registry_ready", bot.registry);
|
||||
bot.on('packet.login', packet => {
|
||||
bot.registry = registry(bot._client.version)
|
||||
// bot.registry.language = require('../data/language.json');
|
||||
bot.emit('registry_ready', bot.registry)
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
module.exports = registry;
|
||||
|
||||
+115
-95
@@ -1,119 +1,139 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
class selfcare {
|
||||
constructor(context) {
|
||||
const { fromNotch } = require('prismarine-chat')('1.20.2');
|
||||
module.exports = {
|
||||
data: {
|
||||
description: "self explanatory",
|
||||
enabled: true,
|
||||
name: "selfcare",
|
||||
type: "client"
|
||||
},
|
||||
inject (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
|
||||
let entityId;
|
||||
let permission = 2;
|
||||
let gameMode;
|
||||
let positionCount = 0;
|
||||
let mute = false;
|
||||
let god = false;
|
||||
let commandSpy = false;
|
||||
let prefix = false;
|
||||
let vanish = false;
|
||||
let nick = false;
|
||||
let username = false;
|
||||
|
||||
bot.on("system_chat_selfcare", (message) => {
|
||||
try {
|
||||
const parsedMessage = fromNotch(message)?.toMotd();
|
||||
if (parsedMessage?.startsWith("§6You have been muted")) mute = true;
|
||||
else if (parsedMessage?.startsWith("§6You have been unmuted")) mute = false;
|
||||
else if (parsedMessage?.startsWith("§6Your voice has been silenced")) mute = true;
|
||||
|
||||
bot.selfcare = {
|
||||
permissionLevel: 2,
|
||||
entityId: undefined,
|
||||
gameMode: undefined,
|
||||
commandSpy: undefined,
|
||||
prefix: undefined,
|
||||
vanished: undefined,
|
||||
mute: undefined,
|
||||
username: undefined,
|
||||
nickname: undefined,
|
||||
god: undefined,
|
||||
register: undefined,
|
||||
login: undefined,
|
||||
position_count: 0,
|
||||
};
|
||||
else if (parsedMessage === "§6God mode§c enabled§6.") god = true;
|
||||
else if (parsedMessage === "§6God mode§c disabled§6.") god = false;
|
||||
|
||||
const messageSelfcare = [
|
||||
require('../selfcare/extras/commandSpy'),
|
||||
require('../selfcare/essentials/god'),
|
||||
require('../selfcare/essentials/mute'),
|
||||
require('../selfcare/auth/login'),
|
||||
require('../selfcare/auth/register'),
|
||||
require('../selfcare/essentials/vanish')
|
||||
]
|
||||
else if (parsedMessage === "Successfully enabled CommandSpy") commandSpy = true;
|
||||
else if (parsedMessage === "Successfully disabled CommandSpy") commandSpy = false;
|
||||
else if (parsedMessage === "Successfully disabled CommandSpy.") commandSpy = false;
|
||||
else if (parsedMessage === "Successfully enabled CommandSpy.") commandSpy = true;
|
||||
|
||||
const entitySelfcare = [
|
||||
require('../selfcare/entity/gamemode'),
|
||||
require('../selfcare/entity/icu'),
|
||||
require('../selfcare/entity/op'),
|
||||
require('../selfcare/extras/prefix'),
|
||||
require('../selfcare/extras/username'),
|
||||
require('../selfcare/entity/death')
|
||||
//require('../selfcare/essentials/vanish')
|
||||
]
|
||||
for (const entity of entitySelfcare) new entity({ bot, config, options });
|
||||
else if (parsedMessage?.startsWith("You now have the tag:")) prefix = true;
|
||||
else if (parsedMessage === "You no longer have a tag" || parsedMessage === "Something went wrong while saving the prefix. Please check console.") prefix = false;
|
||||
|
||||
bot.on("system_chat", (message) => {
|
||||
const stringMessage = bot.getMessageAsPrismarine(message)?.toString();
|
||||
else if (parsedMessage === `§6Vanish for ${bot.server.username}: enabled`) vanish = true;
|
||||
else if (parsedMessage === `§6Vanish for §c${bot.server.username}§6: disabled`) vanish = false;
|
||||
|
||||
for (const file of messageSelfcare)
|
||||
new file({ bot, config, options, stringMessage });
|
||||
else if (parsedMessage?.startsWith('§6Your nickname is now')) nick = true;
|
||||
else if (parsedMessage === "§6You no longer have a nickname.") nick = false;
|
||||
|
||||
else if (parsedMessage?.startsWith("Successfully set your username to ") || parsedMessage?.endsWith(`${bot.server.username}`)) username = true;
|
||||
else if (parsedMessage === `Successfully set your username to "${bot.server.username}"`) username = false;
|
||||
else if (parsedMessage === `You already have the username "${bot.server.username}"`) username = false;
|
||||
|
||||
} catch (e) {
|
||||
console.log(e.stack)
|
||||
}
|
||||
});
|
||||
|
||||
bot.on('packet.entity_status', (data) => {
|
||||
if (data.entityId !== entityId || data.entityStatus < 24 || data.entityStatus > 28) return;
|
||||
permission = data.entityStatus - 24
|
||||
});
|
||||
|
||||
bot.on('packet.game_state_change', (packet) => {
|
||||
if (packet.reason === 3 || packet.reason === "change_game_mode") {
|
||||
gameMode = packet.gameMode;
|
||||
} if (packet.reason === 4 || packet.reason === "win_game") {
|
||||
bot._client.write('client_command', { action: 0 })
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* bot.on("packet.position", (packet, position) => {
|
||||
if (!config.selfcare.icu || bot.server.mode === "savageFriends") return;
|
||||
positionCount++
|
||||
setTimeout(() => {
|
||||
positionCount--
|
||||
if (positionCount > 4) {
|
||||
bot.core.run('sudo * icu stop');
|
||||
} if (permission < 2 || gameMode !== 1) {
|
||||
bot._client.end('anti icu :3');
|
||||
}
|
||||
}, 1000)
|
||||
})*/
|
||||
|
||||
let timer;
|
||||
bot.on("packet.login", (data) => {
|
||||
bot.selfcare.entityId = data.entityId;
|
||||
bot.selfcare.gameMode = data.gameMode;
|
||||
bot.on('packet.login', (data) => {
|
||||
entityId = data.entityId;
|
||||
switch (data.worldState.gamemode) {
|
||||
case 'survival':
|
||||
bot.selfcare.gameMode = 0
|
||||
break
|
||||
gameMode = 0
|
||||
break
|
||||
case 'creative':
|
||||
bot.selfcare.gameMode = 1
|
||||
break
|
||||
gameMode = 1
|
||||
break
|
||||
case 'adventure':
|
||||
bot.selfcare.gameMode = 2
|
||||
break
|
||||
gameMode = 2
|
||||
break
|
||||
case 'spectator':
|
||||
bot.selfcare.gameMode = 3
|
||||
break
|
||||
gameMode = 3
|
||||
break
|
||||
default:
|
||||
bot.selfcare.gameMode = 0
|
||||
break
|
||||
gameMode = 0
|
||||
break
|
||||
}
|
||||
|
||||
// if (bot.server.mode === "savageFriends") return;
|
||||
timer = setInterval(() => {
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
if (bot.selfcare.register) bot.chat.command('register amogusissus amogusissus')
|
||||
else if (bot.selfcare.login) bot.chat.command('login amogusissus')
|
||||
if (!bot.selfcare.login) return
|
||||
else if (bot.selfcare.permissionLevel < 2)
|
||||
bot.chat.command(`minecraft:op ${bot._client.username}`);
|
||||
else if (bot.selfcare.gameMode !== 1)
|
||||
bot._client.write('change_gamemode', { mode: 1 })
|
||||
} else if (bot.options.mode === "kaboom") {
|
||||
if (!bot.selfcare.prefix)
|
||||
bot.chat.command(
|
||||
`extras:prefix &8[&bPrefix&8: &3${config.prefixes[0]}&8]`,
|
||||
);
|
||||
else if (bot.selfcare.permissionLevel < 2)
|
||||
bot.chat.command("minecraft:op @s[type=player]");
|
||||
else if (bot.selfcare.username) bot.chat.command(`extras:username ${bot._client.username}`)
|
||||
else if (bot.selfcare.gameMode !== 1)
|
||||
if (bot.options.chatGamemodeChange) bot.chat.command("minecraft:gamemode creative")
|
||||
else bot._client.write("change_gamemode", { mode: 1 })
|
||||
else if (!bot.selfcare.commandSpy)
|
||||
bot.core.run(`commandspy ${bot.uuid} on`);
|
||||
else if (!bot.selfcare.vanished)
|
||||
bot.core.run(`essentials:vanish ${bot._client.username} on`);
|
||||
else if (!bot.selfcare.god)
|
||||
bot.core.run(`essentials:god ${bot._client.username} on`);
|
||||
else if (bot.selfcare.mute)
|
||||
bot.core.run(`essentials:mute ${bot._client.uuid}`);
|
||||
else if (bot.selfcare.nickname)
|
||||
bot.core.run(`essentials:nickname ${bot._client.username} off`);
|
||||
if (bot.server.mode === "savageFriends") {
|
||||
if (gameMode !== 1 && config.selfcare.game) bot.chat("/minecraft:gamemode creative")
|
||||
else if (permission < 2 && config.selfcare.op) bot.chat(`/minecraft:op ${bot._client.username}`)
|
||||
} else {
|
||||
if (permission < 2 && config.selfcare.op) bot.chat("/minecraft:op @s[type=player]");
|
||||
else if (gameMode !== 1 && config.selfcare.gamemode) bot.chat("/minecraft:gamemode creative");
|
||||
else if (!commandSpy && config.selfcare.cspy) bot.chat('/cspy on');
|
||||
else if (prefix && config.selfcare.prefix) bot.chat('/prefix off');
|
||||
else if (!vanish && config.selfcare.vanish) bot.chat('/vanish on');
|
||||
else if (username && config.selfcare.username) bot.chat(`/username ${bot.server.username}`);
|
||||
|
||||
else if (mute && config.selfcare.mute) bot.core.run(`essentials:mute ${bot.uuid}`);
|
||||
else if (!god && config.selfcare.god) bot.core.run(`god ${bot.server.username} on`);
|
||||
else if (nick && config.selfcare.nick) bot.core.run(`nick ${bot.server.username} off`);
|
||||
|
||||
else if (gameMode !== 4) bot._client.write("client_command", { actionId: 0 });
|
||||
}
|
||||
}, options.selfcareInterval);
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
bot.on("end", () => {
|
||||
bot.on('end', () => {
|
||||
if (timer) clearInterval(timer);
|
||||
bot.selfcare.commandSpy = false;
|
||||
bot.selfcare.prefix = false;
|
||||
bot.selfcare.vanished = false;
|
||||
bot.selfcare.mute = false;
|
||||
bot.selfcare.username = false;
|
||||
bot.selfcare.nickname = false;
|
||||
bot.selfcare.god = false;
|
||||
commandSpy = false;
|
||||
god = false;
|
||||
mute = false;
|
||||
prefix = false;
|
||||
vanish = false;
|
||||
nick = false;
|
||||
username = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = selfcare;
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
class tabComplete {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
// let aaa cook
|
||||
bot.tab_complete = (str) => {
|
||||
return new Promise((resolve) => {
|
||||
bot._client.write("tab_complete", {
|
||||
text: str,
|
||||
assumeCommand: false,
|
||||
sendBlockInSight: false,
|
||||
});
|
||||
const tab_completeH = (packet) => {
|
||||
bot._client.removeListener("tab_complete", tab_completeH);
|
||||
resolve(packet.matches);
|
||||
};
|
||||
bot._client.once("tab_complete", tab_completeH);
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
module.exports = tabComplete;
|
||||
@@ -1,15 +0,0 @@
|
||||
const crypto = require("crypto");
|
||||
|
||||
class validation {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
bot.validation = {}
|
||||
setInterval(() => {
|
||||
bot.validation.trusted = crypto.createHash("sha512").update(Math.floor(Date.now() / 2000) + config.keys.trusted).digest("hex").substring(0, 16)
|
||||
bot.validation.admin = crypto.createHash("sha512").update(Math.floor(Date.now() / 2000) + config.keys.admin).digest("hex").substring(0, 16)
|
||||
bot.validation.owner = crypto.createHash("sha512").update(Math.floor(Date.now() / 2000) + config.keys.owner).digest("hex").substring(0, 16)
|
||||
}, 100)
|
||||
}
|
||||
}
|
||||
module.exports = validation;
|
||||
@@ -1,14 +0,0 @@
|
||||
class login {
|
||||
constructor (context) {
|
||||
const bot = context.bot
|
||||
const options = context.options
|
||||
const config = context.config
|
||||
const stringMessage = context.stringMessage
|
||||
|
||||
if (stringMessage === "Please, login with the command: /login <password>") bot.selfcare.login = true;
|
||||
else if (stringMessage === "Successful login!") bot.selfcare.logged = false;
|
||||
else if (stringMessage === "You're already logged in!") bot.selfcare.login = false;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = login;
|
||||
@@ -1,16 +0,0 @@
|
||||
class register {
|
||||
constructor (context) {
|
||||
const bot = context.bot
|
||||
const options = context.options
|
||||
const config = context.config
|
||||
const stringMessage = context.stringMessage
|
||||
|
||||
if (stringMessage === "Please, register to the server with the command: /register <password> <ConfirmPassword>") bot.selfcare.register = true;
|
||||
else if (stringMessage === "This user isn't registered!") bot.selfcare.register = true;
|
||||
else if (stringMessage === "Successfully registered!") bot.selfcare.register = false;
|
||||
else if (stringMessage === "You're already logged in!") bot.selfcare.register = false;
|
||||
else if (stringMessage === "Successful login!") bot.selfcare.register = false;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = register;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user