Compare commits

...
4 Commits
Author SHA1 Message Date
Parker2991 18e2278ebd Update src/data/info.json
just realized i put the wrong version its supposed to be v7.0.2 not v7.0.3
2025-02-28 18:17:27 -05:00
Parker2991 1fd50ab7fa v7.0.2, build: 2100 2025-02-25 19:53:19 +00:00
Parker2991 6d43ecc249 v7.0.1, build: 2055 2025-02-11 06:41:30 -06:00
Parker2991 7eadb4eccd v7.0.0, build: 2050 2025-02-05 10:11:22 -06:00
22 changed files with 575 additions and 284 deletions
+202
View File
@@ -7,6 +7,7 @@
"dependencies": {
"discord.js": "^14.17.3",
"js-yaml": "^4.1.0",
"matrix-js-sdk": "^36.2.0",
"minecraft-data": "^3.83.1",
"minecraft-protocol": "^1.54.0",
"prismarine-chat": "^1.10.1",
@@ -38,6 +39,18 @@
"node": ">=16"
}
},
"node_modules/@babel/runtime": {
"version": "7.26.9",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.9.tgz",
"integrity": "sha512-aA63XwOkcl4xxQa3HjPMqOP6LiK0ZDv3mUPYEFXkpHbaFjtGggE1A61FjFzJnB+p7/oy2gA8E+rcBNl/zC1tMg==",
"license": "MIT",
"dependencies": {
"regenerator-runtime": "^0.14.0"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@discordjs/builders": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.10.0.tgz",
@@ -174,6 +187,21 @@
"url": "https://github.com/discordjs/discord.js?sponsor"
}
},
"node_modules/@matrix-org/matrix-sdk-crypto-wasm": {
"version": "13.0.0",
"resolved": "https://registry.npmjs.org/@matrix-org/matrix-sdk-crypto-wasm/-/matrix-sdk-crypto-wasm-13.0.0.tgz",
"integrity": "sha512-2gtpjnxL42sdJAgkwitpMMI4cw7Gcjf5sW0MXoe+OAlXPlxIzyM+06F5JJ8ENvBeHkuV2RqtFIRrh8i90HLsMw==",
"license": "Apache-2.0",
"engines": {
"node": ">= 18"
}
},
"node_modules/@matrix-org/olm": {
"version": "3.2.15",
"resolved": "https://registry.npmjs.org/@matrix-org/olm/-/olm-3.2.15.tgz",
"integrity": "sha512-S7lOrndAK9/8qOtaTq/WhttJC/o4GAzdfK0MUPpo8ApzsJEC0QjtwrkC3KBXdFP1cD1MXi/mlKR7aaoVMKgs6Q==",
"license": "Apache-2.0"
},
"node_modules/@sapphire/async-queue": {
"version": "1.5.5",
"resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.5.tgz",
@@ -207,6 +235,12 @@
"npm": ">=7.0.0"
}
},
"node_modules/@types/events": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.3.tgz",
"integrity": "sha512-trOc4AAUThEz9hapPtSd7wf5tiQKvTtu5b371UxXdTuqzIh0ArcRspRP0i0Viu+LXstIQ1z96t1nsPxT9ol01g==",
"license": "MIT"
},
"node_modules/@types/node": {
"version": "22.10.10",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.10.tgz",
@@ -235,6 +269,12 @@
"safe-buffer": "~5.1.1"
}
},
"node_modules/@types/retry": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz",
"integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==",
"license": "MIT"
},
"node_modules/@types/ws": {
"version": "8.5.14",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.14.tgz",
@@ -304,6 +344,12 @@
"url": "https://github.com/sponsors/epoberezkin"
}
},
"node_modules/another-json": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/another-json/-/another-json-0.2.0.tgz",
"integrity": "sha512-/Ndrl68UQLhnCdsAzEXLMFuOR546o2qbYRqCglaNHbjXrwG1ayTcdwr3zkSGOGtGXDyR5X9nCFfnyG2AFJIsqg==",
"license": "Apache-2.0"
},
"node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
@@ -331,6 +377,12 @@
"follow-redirects": "^1.14.0"
}
},
"node_modules/base-x": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/base-x/-/base-x-5.0.0.tgz",
"integrity": "sha512-sMW3VGSX1QWVFA6l8U62MLKz29rRfpTlYdCqLdpLo1/Yd4zZwSbnUaDfciIAowAqvq7YFnWq9hrhdg1KYgc1lQ==",
"license": "MIT"
},
"node_modules/base64-js": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
@@ -351,6 +403,15 @@
],
"license": "MIT"
},
"node_modules/bs58": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/bs58/-/bs58-6.0.0.tgz",
"integrity": "sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw==",
"license": "MIT",
"dependencies": {
"base-x": "^5.0.0"
}
},
"node_modules/buffer": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
@@ -420,6 +481,15 @@
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"license": "MIT"
},
"node_modules/content-type": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/debug": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
@@ -666,6 +736,15 @@
"safe-buffer": "^5.0.1"
}
},
"node_modules/jwt-decode": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-4.0.0.tgz",
"integrity": "sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==",
"license": "MIT",
"engines": {
"node": ">=18"
}
},
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
@@ -739,6 +818,19 @@
"integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==",
"license": "MIT"
},
"node_modules/loglevel": {
"version": "1.9.2",
"resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.9.2.tgz",
"integrity": "sha512-HgMmCqIJSAKqo68l0rS2AanEWfkxaZ5wNiEFb5ggm08lDs9Xl2KxBlX3PTcaD2chBM1gXAYf491/M2Rv8Jwayg==",
"license": "MIT",
"engines": {
"node": ">= 0.6.0"
},
"funding": {
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/loglevel"
}
},
"node_modules/macaddress": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/macaddress/-/macaddress-0.5.3.tgz",
@@ -751,6 +843,61 @@
"integrity": "sha512-/k20Lg2q8LE5xiaaSkMXk4sfvI+9EGEykFS4b0CHHGWqDYU0bGUFSwchNOMA56D7TCs9GwVTkqe9als1/ns8UQ==",
"license": "MIT"
},
"node_modules/matrix-events-sdk": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/matrix-events-sdk/-/matrix-events-sdk-0.0.1.tgz",
"integrity": "sha512-1QEOsXO+bhyCroIe2/A5OwaxHvBm7EsSQ46DEDn8RBIfQwN5HWBpFvyWWR4QY0KHPPnnJdI99wgRiAl7Ad5qaA==",
"license": "Apache-2.0"
},
"node_modules/matrix-js-sdk": {
"version": "36.2.0",
"resolved": "https://registry.npmjs.org/matrix-js-sdk/-/matrix-js-sdk-36.2.0.tgz",
"integrity": "sha512-pP44qfqLA9tiJjx5YjxBPPkUmNsA2G0nb04ZUTuPbtQFmfK5cEQgIpvoCq69oqU6aulufeYpxJmd9yNffOvF9g==",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@matrix-org/matrix-sdk-crypto-wasm": "^13.0.0",
"@matrix-org/olm": "3.2.15",
"another-json": "^0.2.0",
"bs58": "^6.0.0",
"content-type": "^1.0.4",
"jwt-decode": "^4.0.0",
"loglevel": "^1.7.1",
"matrix-events-sdk": "0.0.1",
"matrix-widget-api": "^1.10.0",
"oidc-client-ts": "^3.0.1",
"p-retry": "4",
"sdp-transform": "^2.14.1",
"unhomoglyph": "^1.0.6",
"uuid": "11"
},
"engines": {
"node": ">=20.0.0"
}
},
"node_modules/matrix-js-sdk/node_modules/uuid": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz",
"integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==",
"funding": [
"https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan"
],
"license": "MIT",
"bin": {
"uuid": "dist/esm/bin/uuid"
}
},
"node_modules/matrix-widget-api": {
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/matrix-widget-api/-/matrix-widget-api-1.13.1.tgz",
"integrity": "sha512-mkOHUVzaN018TCbObfGOSaMW2GoUxOfcxNNlTVx5/HeMk3OSQPQM0C9oEME5Liiv/dBUoSrEB64V8wF7e/gb1w==",
"license": "Apache-2.0",
"dependencies": {
"@types/events": "^3.0.0",
"events": "^3.2.0"
}
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
@@ -887,6 +1034,31 @@
"asn1": "0.2.3"
}
},
"node_modules/oidc-client-ts": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/oidc-client-ts/-/oidc-client-ts-3.1.0.tgz",
"integrity": "sha512-IDopEXjiwjkmJLYZo6BTlvwOtnlSniWZkKZoXforC/oLZHC9wkIxd25Kwtmo5yKFMMVcsp3JY6bhcNJqdYk8+g==",
"license": "Apache-2.0",
"dependencies": {
"jwt-decode": "^4.0.0"
},
"engines": {
"node": ">=18"
}
},
"node_modules/p-retry": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.6.2.tgz",
"integrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==",
"license": "MIT",
"dependencies": {
"@types/retry": "0.12.0",
"retry": "^0.13.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/prismarine-auth": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/prismarine-auth/-/prismarine-auth-2.6.0.tgz",
@@ -1061,6 +1233,12 @@
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"node_modules/regenerator-runtime": {
"version": "0.14.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==",
"license": "MIT"
},
"node_modules/ret": {
"version": "0.1.15",
"resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz",
@@ -1070,12 +1248,30 @@
"node": ">=0.12"
}
},
"node_modules/retry": {
"version": "0.13.1",
"resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz",
"integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==",
"license": "MIT",
"engines": {
"node": ">= 4"
}
},
"node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"license": "MIT"
},
"node_modules/sdp-transform": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/sdp-transform/-/sdp-transform-2.15.0.tgz",
"integrity": "sha512-KrOH82c/W+GYQ0LHqtr3caRpM3ITglq3ljGUIb8LTki7ByacJZ9z+piSGiwZDsRyhQbYBOBJgr2k6X4BZXi3Kw==",
"license": "MIT",
"bin": {
"sdp-verify": "checker.js"
}
},
"node_modules/semver": {
"version": "7.6.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
@@ -1160,6 +1356,12 @@
"integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==",
"license": "MIT"
},
"node_modules/unhomoglyph": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/unhomoglyph/-/unhomoglyph-1.0.6.tgz",
"integrity": "sha512-7uvcWI3hWshSADBu4JpnyYbTVc7YlhF5GDW/oPD5AxIxl34k4wXR3WDkPnzLxkN32LiTCTKMQLtKVZiwki3zGg==",
"license": "MIT"
},
"node_modules/uri-js": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
+1
View File
@@ -2,6 +2,7 @@
"dependencies": {
"discord.js": "^14.17.3",
"js-yaml": "^4.1.0",
"matrix-js-sdk": "^36.2.0",
"minecraft-data": "^3.83.1",
"minecraft-protocol": "^1.54.0",
"prismarine-chat": "^1.10.1",
+7 -1
View File
@@ -15,4 +15,10 @@ module.exports = {
bot._client.end();
bot.chat.message('reconnecting')
},
}
discordExecute (context) {
const bot = context.bot;
bot._client.end();
bot?.discord?.message?.reply('reconnecting');
}
}
+6 -2
View File
@@ -19,7 +19,11 @@ module.exports = {
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
bot.discord.message.channel.send(args.join(' '));
bot.chat.send(args.join(' '));
if (args.includes("@everyone") || args.includes("@here")) {
bot.discord.message.reply("go fuck yourself");
} else {
bot.discord.message.channel.send(args.join(' '));
}
// bot.chat.send(args.join(' '));
}
}
+93 -122
View File
@@ -1,3 +1,74 @@
function commandListComponent (commands, config, public, trusted, admin, owner, Console) {
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:
bot.chat.message(`fuck you ${commands.data.name} has a invalid trust level`);
};
}
function infoComponents (commands, config, infoComponent, usagesComponent) {
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');
};
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);
}
module.exports = {
data: {
name: "help",
@@ -26,7 +97,7 @@ module.exports = {
let admin = [];
let owner = [];
let Console = [];
const { MessageBuilder } = require('prismarine-chat')(bot._client.version);
component.push({
translate: "%s: (%s) \u203a\n",
color: config.colors.commands.tertiary,
@@ -36,72 +107,12 @@ module.exports = {
]
});
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:
bot.chat.message(`fuck you ${commands.data.name} has a invalid trust level`);
};
commandListComponent(commands, config, public, trusted, admin, owner, Console);
if (args[0] === commands.data.name) {
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');
}
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);
infoComponents(commands, config, infoComponent, usagesComponent);
bot.tellraw(`@a`, infoComponent);
return;
}
}
@@ -115,7 +126,6 @@ module.exports = {
discordExecute (context) {
const bot = context.bot;
const config = context.config;
const EmbedBuilder = context.EmbedBuilder
const fixansi = context.fixansi;
const args = context.arguments;
let infoComponent = [];
@@ -125,72 +135,33 @@ module.exports = {
let admin = [];
let owner = [];
let Console = [];
let component = [];
component.push({
translate: "%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 },
]
});
for (const commands of bot.commandManager.commandlist) {
switch (commands.data.trustLevel) {
case 0:
public.push(commands.data.name);
break;
case 1:
trusted.push(commands.data.name);
break;
case 2:
admin.push(commands.data.name);
break;
case 3:
owner.push(commands.data.name);
break;
case 4:
Console.push(commands.data.name);
break;
}
if (args[0] === commands.data.name) {
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');
}
commandListComponent(commands, config, public, trusted, admin, owner, Console);
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 (args[0] === commands.data.name) {
infoComponents(commands, config, infoComponent, usagesComponent);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(infoComponent)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
return;
}
}
let commandsEmbed = new EmbedBuilder()
.setColor(config.colors.discord.embed)
.setTitle(`${this.data.name} Command`)
.setDescription(`Commands (${bot.commandManager.commandlist.length})`)
.addFields(
{ name: "Public", value: public.toString().replaceAll(',',' '), inline: false },
{ name: "Trusted", value: trusted.toString().replaceAll(',',' '), inline: false },
{ name: "Admin", value: admin.toString().replaceAll(',',' '), inline: false },
{ name: "Owner", value: owner.toString().replaceAll(',',' '), inline: false },
{ name: "Console", value: Console.toString().replaceAll(',',' '), inline: false },
);
bot.discord.message.reply({ embeds: [ commandsEmbed ] });
component.push(public);
component.push(trusted);
component.push(admin);
component.push(owner);
component.push(Console);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
}
}
+38 -1
View File
@@ -16,7 +16,7 @@ module.exports = {
execute (context) {
const bot = context.bot;
const args = context.arguments;
const confix = context.config;
const config = context.config;
let component = [];
let infoComponent = [];
@@ -48,5 +48,42 @@ module.exports = {
}
component.pop();
bot.tellraw("@a", component);
},
discordExecute (context) {
const bot = context.bot;
const config = context.config;
const fixansi = context.fixansi;
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();
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi())}\`\`\``);
}
}
+21 -1
View File
@@ -75,7 +75,27 @@ module.exports = {
async discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const component = [];
const fixansi = context.fixansi;
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();
try {
for (definitions of list) {
component.push([
{
text: `${definitions.definition.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77').substring(0, 1950)}\n`,
color: 'gray',
}
]);
}
bot.discord.message.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
} catch (e) {
bot?.discord?.message?.reply(e.toString());
}
}
}
+71 -48
View File
@@ -1,6 +1,56 @@
const CommandError = require('../../util/command_error');
const { request } = require('undici');
function components (config, info, component) {
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 }
]
});
}
module.exports = {
data: {
name: "weather",
@@ -22,57 +72,30 @@ module.exports = {
try {
const url = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ').replaceAll(' ','&')}`);
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 }
]
});
components(config, info, component);
bot.tellraw("@a", component);
} catch (e) {
bot.chat.message(e.toString());
}
},
async discordExecute (context) {
const config = context.config;
const bot = context.bot;
const fixansi = context.fixansi;
const args = context.arguments;
let component = [];
try {
const url = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ').replaceAll(' ','&')}`);
const info = await url.body.json();
components(config, info, component);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
} catch (e) {
bot?.discord?.message?.reply(e.toString());
}
}
}
}
+19 -8
View File
@@ -39,17 +39,28 @@ module.exports = {
bot.tellraw(`@a`, `${e.toString()}`)
}
}
},
async discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const fixansi = context.fixansi;
/* try {
const page = await wiki.page(args.join(' '))
let component = [];
try {
const page = await wiki.page(args.join(' '));
const summary = await page.intro();
bot.tellraw(`@a`, { text: `${summary}`, color: 'gray' });
} catch (error) {
if (error.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')") {
bot.chat.message('&cArticle not found!');
components(config, summary, component);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
} catch (e) {
if (e.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')") {
bot?.discord?.message?.reply('Article not found!');
} else {
bot.tellraw(`@a`, `${error.toString()}`)
bot?.discord?.message?.reply(`${e.toString()}`);
}
}*/
}
}
}
+3 -3
View File
@@ -1,8 +1,8 @@
{
"buildstring": {
"build": "2030",
"codename": "§aGame §aTheory",
"version": "v7.0.0-beta",
"build": "2100",
"codename": "§bPit Stop",
"version": "v7.0.2",
"url":"https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot"
}
}
+15 -4
View File
@@ -7,10 +7,9 @@ const { Client, GatewayIntentBits } = require('discord.js');
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits;
const discordClient = new Client({ intents: [Guilds, GuildMessages, MessageContent] });
const CommandSource = require('./util/command_source');
const matrix = require('matrix-js-sdk');
console.log('Starting FNFBoyfriendBot');
process.stdout.write('\x1b]2;Starting FNFBoyfriendBot please wait,.....\x1b\x5c');
if (fs.existsSync(path.join(__dirname, "../config.yml")) === false) {
console.warn("Config not found creating config from the default config");
@@ -32,6 +31,17 @@ const rl = readline.createInterface({
})
if (config.discord.enabled) discordClient.login(config.discord.token);
const mxClient = matrix.createClient({
baseUrl: config.matrix.host,
accessToken: config.matrix.token,
userId: config.matrix.id
});
if (config.matrix.enabled) mxClient.startClient();
const bots = [];
let bot;
@@ -39,7 +49,7 @@ for (const options of config.bots) {
bot = new createBot(options, config);
bots.push(bot);
bot.bots = bots;
require('./util/loadModules')(bot, options, config, discordClient);
require('./util/loadModules')(bot, options, config, discordClient, mxClient);
bot.console.readlineInterface(rl);
}
@@ -59,7 +69,8 @@ discordClient.on('messageCreate', (message) => {
}
}, {
discord: true,
console: false
console: false,
matrix: false
}, false, message);
bot.commandManager.executeString(source, message.content.substring(prefix.length));
-3
View File
@@ -17,9 +17,6 @@ function inject (context) {
process.exit(5);
});
setInterval(() => {
process.stdout.write(`\x1b]2; FNFBoyfriendBot | Time: ${new Date().toLocaleString("en-US",{timeZone: "America/CHICAGO"})} | \x1b\x5c`)
}, 1000)
}
module.exports = {
+1 -1
View File
@@ -21,7 +21,7 @@ function inject (context) {
bot.on('registry_ready', registry => {
ChatMessage = loadPrismarineChat(registry)
})
if (options.isSavage || options.isCreayun) {
if (options.mode === "savageFriends" || options.mode === "creayun") {
bot.chatParsers = [CreayunChatParser, sayConsoleChatParser]
} else {
bot.chatParsers = [KaboomChatParser, ChipmunkModChatParser, VanillaChatParser, sayConsoleChatParser, yfdCustomChatParser]
+1 -13
View File
@@ -25,15 +25,7 @@ function inject (context) {
if (!pos) return
if (bot.options.mode === "creayun" || bot.options.mode === "savageFriends") return;
if (isNaN(pos.x + start.x)) {
bot.chat.command('spawn');
return
}
/*^^^
for checking is the core pos is null and if so
it will not refill core until the pos is not NaN
instead of tping to a set cords cuz fuck you im not doing that
*/
const command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'} destroy`
bot.chat.command(`${command}`)
},
@@ -45,10 +37,6 @@ function inject (context) {
if (!pos) return;
if (bot.options.mode === "creayun" || bot.options.mode === "savageFriends") return;
if (isNaN(pos.x + pos.x)) {
bot.chat.command('spawn');
return
}
const command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'} destroy`
+2 -2
View File
@@ -49,8 +49,8 @@ function inject (context) {
bot.on('message', (message) => {
if (!options.logging) return;
//if (bot.getMessageAsPrismarine(message)?.toString().includes("https://www.innersloth.com/games/among-us/ › amogus")) return;
// if (ratelimit > 10) return
if (ratelimit > 10) return
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
ratelimit++
+2 -4
View File
@@ -73,11 +73,9 @@ function inject (context) {
}, {
discord: true,
console: false
}, false, message)
}, false, message);
// bot.sendFeedback = message => {
sendComponent(message)
// }
sendComponent(message);
bot.commandManager.executeString(source, message.content.substring(config.discord.prefix.length))
return
+86
View File
@@ -0,0 +1,86 @@
const CommandSource = require('../util/command_source');
function inject (context) {
const matrixClient = context.mxClient;
const config = context.config;
const bot = context.bot;
const options = context.options;
if (!config.matrix.enabled) return;
require('matrix-js-sdk/lib/logger').logger.disableAll();
bot.matrix = {
client: matrixClient,
invite: JSON.stringify(config.matrix.invite),
};
let matrixQueue = [];
setInterval(async () => {
try {
if (matrixQueue.length === 0) return;
const content = { body: matrixQueue.join('\n'), msgtype: "m.text" };
await bot.matrix.client.sendEvent(bot.options.roomId, 'm.room.message', content, '');
} catch (e) {
bot?.console?.warn(e.stack);
}
matrixQueue = [];
}, 5000);
function sendChatMessage (message) {
matrixQueue.push(message);
}
bot.on('message', (data) => {
const message = bot.getMessageAsPrismarine(data)?.toString();
sendChatMessage(message)
});
let start = Date.now();
bot.matrix.client.on('Room.timeline', (event, room, toStartOfTimeline) => {
if (event.getRoomId() !== bot.options.roomId || event.getType() !== 'm.room.message' || event.getTs() < start || event.sender.userId === bot.matrix.client.getUserId()) return;
if (event.getContent().body.startsWith('/')) {
bot.core.run(event.getContent().body.substring('/'.length));
return;
}
const tag = [{
translate: "[%s] %s \u203a ",
color: "dark_gray",
with: [
{
translate: "%s%s%s %s",
with: [
{ text: "FNF", color: "blue" },
{ text: "Boyfriend", color: "dark_aqua" },
{ text: "Bot", color: "dark_blue" },
{ text: "Matrix", color: "green" },
],
clickEvent: config.matrix.invite ? {
action: "open_url",
value: bot.matrix.invite
} : undefined,
hoverEvent: {
action: "show_text",
contents: "Click to join the matrix!"
}
},
{ text: event.sender.rawDisplayName },
]
}]
bot.tellraw("@a", [ tag, event.getContent().body ]);
});
}
module.exports = {
data: {
enabled: true,
name: "matrix",
type: "logging"
},
inject
};
+4 -4
View File
@@ -5,10 +5,10 @@ function inject (context) {
bot.on('packet.position', packet => {
bot.position = {
x: packet.flags & 1 ? (this.x + packet.x) : packet.x,
y: packet.flags & 2 ? (this.y + packet.y) : packet.y,
z: packet.flags & 4 ? (this.z + packet.z) : packet.z
};
x: packet.x,
y: packet.y,
z: packet.z
}
bot._client.write('teleport_confirm', { teleportId: packet.teleportId })
-2
View File
@@ -28,8 +28,6 @@ function inject (context) {
else if (stringMessage === "Please, register to the server with the command: /register <password> <ConfirmPassword>") register = true;
else if (stringMessage === "This user isn't registered!") register = true;
else if (stringMessage === "Successfully registered!") register = false;
// else if (stringMessage === "You already have registered this username!") register = false;
else if (stringMessage === "You're already logged in!") register = false;
else if (stringMessage === "Successful login!") register = false;
-61
View File
@@ -1,61 +0,0 @@
const sleep = require('../util/sleep');
function inject (context) {
const bot = context.bot;
const options = context.options;
const config = context.config;
if (options.mode !== "kaboom" || config.team.enabled === false) return;
bot.on("packet.login", async () => {
if (options.mode === "kaboom") {
await sleep(100);
bot.chat.command(`minecraft:team add ${config.team.name}`);
await sleep(100);
bot.core.run(`minecraft:team join ${config.team.name} @a[name="${bot.options.username}"]`);
}
})
bot.on("packet.teams", async (data) => {
// if (options.isSavage || options.isCreayun) return;
try {
if (data.team === config.team.name) {
data?.players?.map(async (player) => {
if (player !== bot.options.username) {
await sleep(100);
bot.core.run(`minecraft:team empty ${config.team.name}`);
await sleep(100);
bot.core.run(`minecraft:team join ${config.team.name} @a[name="${bot.options.username}"]`);
// this removes players who are not the bot
}
});
if (data.mode == 1) {
// this is checking if the team has been deleted
bot.core.run(`minecraft:team add ${config.team.name}`);
await sleep(100);
bot.core.run(`minecraft:team join ${config.team.name} @a[name="${bot.options.username}"]`);
} if (data.name !== JSON.stringify(config.team.displayName)) {
// this checks if the team displayName matches the one set in the config
bot.core.run(`minecraft:team modify ${config.team.name} displayName ${JSON.stringify(config.team.displayName)}`);
} if (data.prefix !== JSON.stringify(config.team.prefix)) {
// this checks if the team prefix matches the one set in the config
bot.core.run(`minecraft:team modify ${config.team.name} prefix ${JSON.stringify(config.team.prefix)}`);
} if (data.suffix !== JSON.stringify(config.team.suffix)) {
// this checks if the team suffix matches the one set in the config
bot.core.run(`minecraft:team modify ${config.team.name} suffix ${JSON.stringify(config.team.suffix)}`)
}
}
} catch (e) {
console.log(e.stack)
}
})
}
module.exports = {
data: {
enabled: true,
name: "teams",
type: "extras"
},
inject
}
-1
View File
@@ -2,7 +2,6 @@ const CommandError = require('./command_error');
module.exports = (bot, command, args, source) => {
const event = bot.discord.message;
const roles = event?.member?.roles?.cache;
switch (command?.data?.trustLevel) {
case 0:
// do nothing since trust level 0 is public
+3 -3
View File
@@ -1,6 +1,6 @@
const fs = require("fs");
const path = require("path");
async function loadModules (bot, options, config, discordClient) {
async function loadModules (bot, options, config, discordClient, mxClient) {
bot.modules = [];
for (const filename of fs.readdirSync(path.join(__dirname, '../', 'modules'))) {
try {
@@ -9,12 +9,12 @@ async function loadModules (bot, options, config, discordClient) {
if (module.data.enabled === false) {
bot.modules.push(module);
} else {
module.inject({ bot, options, config, discordClient });
module.inject({ bot, options, config, discordClient, mxClient });
bot.modules.push(module);
}
} if (filename.endsWith(".mjs")) {
const module = await import(path.join(__dirname, '../modules', filename));
module.default({ bot, options, config, discordClient });
module.default({ bot, options, config, discordClient, mxClient });
}
} catch (error) {
console.error(`Failed to load module ${filename} due to error`);