mirror of
https://code.chipmunk.land/Parker2991/NitoriBot/
synced 2026-11-29 21:55:38 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23288717ab | ||
|
|
639a2b0eaa | ||
|
|
f60f5c4a15 | ||
|
|
572e09989c | ||
|
|
ad4f35bb4c | ||
|
|
e655f831d3 | ||
|
|
a140a2d12e | ||
|
|
8f61177250 | ||
|
|
ab87e748f9 | ||
|
|
ca45444dd5 | ||
|
|
ac2f59d14d | ||
|
|
ee887d5081 | ||
|
|
0a637e0c8f | ||
|
|
3344fc6e2e |
Generated
+40
-8
@@ -2,6 +2,12 @@
|
||||
"name": "FridayNightFunkinBoyfriendBot",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"buildstring": {
|
||||
"version": "v6.1.4",
|
||||
"build": "1215",
|
||||
"codename": "",
|
||||
"url": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot"
|
||||
},
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
@@ -23,6 +29,7 @@
|
||||
"prismarine-chat": "^1.10.1",
|
||||
"prismarine-registry": "^1.7.0",
|
||||
"proxy-agent": "^6.4.0",
|
||||
"socks": "^2.8.3",
|
||||
"wikipedia": "^2.1.2",
|
||||
"xml2js": "^0.6.2"
|
||||
}
|
||||
@@ -86,6 +93,7 @@
|
||||
"version": "1.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.9.0.tgz",
|
||||
"integrity": "sha512-0zx8DePNVvQibh5ly5kCEei5wtPBIUbSoE9n+91Rlladz4tgtFbJ36PZMxxZrTEOQ7AHMZ/b0crT/0fCy6FTKg==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@discordjs/formatters": "^0.5.0",
|
||||
"@discordjs/util": "^1.1.1",
|
||||
@@ -105,12 +113,14 @@
|
||||
"node_modules/@discordjs/builders/node_modules/discord-api-types": {
|
||||
"version": "0.37.97",
|
||||
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.97.tgz",
|
||||
"integrity": "sha512-No1BXPcVkyVD4ZVmbNgDKaBoqgeQ+FJpzZ8wqHkfmBnTZig1FcH3iPPersiK1TUIAzgClh2IvOuVUYfcWLQAOA=="
|
||||
"integrity": "sha512-No1BXPcVkyVD4ZVmbNgDKaBoqgeQ+FJpzZ8wqHkfmBnTZig1FcH3iPPersiK1TUIAzgClh2IvOuVUYfcWLQAOA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@discordjs/collection": {
|
||||
"version": "1.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.5.3.tgz",
|
||||
"integrity": "sha512-SVb428OMd3WO1paV3rm6tSjM4wC+Kecaa1EUGX7vc6/fddvw/6lg90z4QtCqm21zvVe92vMMDt9+DkIvjXImQQ==",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
}
|
||||
@@ -119,6 +129,7 @@
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/formatters/-/formatters-0.5.0.tgz",
|
||||
"integrity": "sha512-98b3i+Y19RFq1Xke4NkVY46x8KjJQjldHUuEbCqMvp1F5Iq9HgnGpu91jOi/Ufazhty32eRsKnnzS8n4c+L93g==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"discord-api-types": "0.37.97"
|
||||
},
|
||||
@@ -132,12 +143,14 @@
|
||||
"node_modules/@discordjs/formatters/node_modules/discord-api-types": {
|
||||
"version": "0.37.97",
|
||||
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.97.tgz",
|
||||
"integrity": "sha512-No1BXPcVkyVD4ZVmbNgDKaBoqgeQ+FJpzZ8wqHkfmBnTZig1FcH3iPPersiK1TUIAzgClh2IvOuVUYfcWLQAOA=="
|
||||
"integrity": "sha512-No1BXPcVkyVD4ZVmbNgDKaBoqgeQ+FJpzZ8wqHkfmBnTZig1FcH3iPPersiK1TUIAzgClh2IvOuVUYfcWLQAOA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@discordjs/rest": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-2.4.0.tgz",
|
||||
"integrity": "sha512-Xb2irDqNcq+O8F0/k/NaDp7+t091p+acb51iA4bCKfIn+WFWd6HrNvcsSbMMxIR9NjcMZS6NReTKygqiQN+ntw==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@discordjs/collection": "^2.1.1",
|
||||
"@discordjs/util": "^1.1.1",
|
||||
@@ -160,6 +173,7 @@
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-2.1.1.tgz",
|
||||
"integrity": "sha512-LiSusze9Tc7qF03sLCujF5iZp7K+vRNEDBZ86FT9aQAv3vxMLihUvKvpsCWiQ2DJq1tVckopKm1rxomgNUc9hg==",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
@@ -170,12 +184,14 @@
|
||||
"node_modules/@discordjs/rest/node_modules/discord-api-types": {
|
||||
"version": "0.37.97",
|
||||
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.97.tgz",
|
||||
"integrity": "sha512-No1BXPcVkyVD4ZVmbNgDKaBoqgeQ+FJpzZ8wqHkfmBnTZig1FcH3iPPersiK1TUIAzgClh2IvOuVUYfcWLQAOA=="
|
||||
"integrity": "sha512-No1BXPcVkyVD4ZVmbNgDKaBoqgeQ+FJpzZ8wqHkfmBnTZig1FcH3iPPersiK1TUIAzgClh2IvOuVUYfcWLQAOA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@discordjs/util": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/util/-/util-1.1.1.tgz",
|
||||
"integrity": "sha512-eddz6UnOBEB1oITPinyrB2Pttej49M9FZQY8NxgEvc3tq6ZICZ19m70RsmzRdDHk80O9NoYN/25AqJl8vPVf/g==",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
@@ -187,6 +203,7 @@
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/ws/-/ws-1.1.1.tgz",
|
||||
"integrity": "sha512-PZ+vLpxGCRtmr2RMkqh8Zp+BenUaJqlS6xhgWKEZcgC/vfHLEzpHtKkB0sl3nZWpwtcKk6YWy+pU3okL2I97FA==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@discordjs/collection": "^2.1.0",
|
||||
"@discordjs/rest": "^2.3.0",
|
||||
@@ -209,6 +226,7 @@
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-2.1.1.tgz",
|
||||
"integrity": "sha512-LiSusze9Tc7qF03sLCujF5iZp7K+vRNEDBZ86FT9aQAv3vxMLihUvKvpsCWiQ2DJq1tVckopKm1rxomgNUc9hg==",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
@@ -219,7 +237,8 @@
|
||||
"node_modules/@discordjs/ws/node_modules/discord-api-types": {
|
||||
"version": "0.37.83",
|
||||
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.83.tgz",
|
||||
"integrity": "sha512-urGGYeWtWNYMKnYlZnOnDHm8fVRffQs3U0SpE8RHeiuLKb/u92APS8HoQnPTFbnXmY1vVnXjXO4dOxcAn3J+DA=="
|
||||
"integrity": "sha512-urGGYeWtWNYMKnYlZnOnDHm8fVRffQs3U0SpE8RHeiuLKb/u92APS8HoQnPTFbnXmY1vVnXjXO4dOxcAn3J+DA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@isaacs/cliui": {
|
||||
"version": "8.0.2",
|
||||
@@ -436,6 +455,7 @@
|
||||
"version": "1.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.3.tgz",
|
||||
"integrity": "sha512-x7zadcfJGxFka1Q3f8gCts1F0xMwCKbZweM85xECGI0hBTeIZJGGCrHgLggihBoprlQ/hBmDR5LKfIPqnmHM3w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=v14.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
@@ -445,6 +465,7 @@
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-4.0.0.tgz",
|
||||
"integrity": "sha512-d9dUmWVA7MMiKobL3VpLF8P2aeanRTu6ypG2OIaEv/ZHH/SUQ2iHOVyi5wAPjQ+HmnMuL0whK9ez8I/raWbtIg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"lodash": "^4.17.21"
|
||||
@@ -457,6 +478,7 @@
|
||||
"version": "3.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.5.3.tgz",
|
||||
"integrity": "sha512-jjmJywLAFoWeBi1W7994zZyiNWPIiqRRNAmSERxyg93xRGzNYvGjlZ0gR6x0F4gPRi2+0O6S71kOZYyr3cxaIQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=v14.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
@@ -486,6 +508,7 @@
|
||||
"version": "8.5.12",
|
||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.12.tgz",
|
||||
"integrity": "sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
@@ -494,6 +517,7 @@
|
||||
"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==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=v14.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
@@ -1045,12 +1069,14 @@
|
||||
"node_modules/discord-api-types": {
|
||||
"version": "0.37.100",
|
||||
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.100.tgz",
|
||||
"integrity": "sha512-a8zvUI0GYYwDtScfRd/TtaNBDTXwP5DiDVX7K5OmE+DRT57gBqKnwtOC5Ol8z0mRW8KQfETIgiB8U0YZ9NXiCA=="
|
||||
"integrity": "sha512-a8zvUI0GYYwDtScfRd/TtaNBDTXwP5DiDVX7K5OmE+DRT57gBqKnwtOC5Ol8z0mRW8KQfETIgiB8U0YZ9NXiCA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/discord.js": {
|
||||
"version": "14.16.3",
|
||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.16.3.tgz",
|
||||
"integrity": "sha512-EPCWE9OkA9DnFFNrO7Kl1WHHDYFXu3CNVFJg63bfU7hVtjZGyhShwZtSBImINQRWxWP2tgo2XI+QhdXx28r0aA==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@discordjs/builders": "^1.9.0",
|
||||
"@discordjs/collection": "1.5.3",
|
||||
@@ -1706,7 +1732,8 @@
|
||||
"node_modules/lodash.snakecase": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz",
|
||||
"integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw=="
|
||||
"integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lru-cache": {
|
||||
"version": "10.4.3",
|
||||
@@ -1721,7 +1748,8 @@
|
||||
"node_modules/magic-bytes.js": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/magic-bytes.js/-/magic-bytes.js-1.10.0.tgz",
|
||||
"integrity": "sha512-/k20Lg2q8LE5xiaaSkMXk4sfvI+9EGEykFS4b0CHHGWqDYU0bGUFSwchNOMA56D7TCs9GwVTkqe9als1/ns8UQ=="
|
||||
"integrity": "sha512-/k20Lg2q8LE5xiaaSkMXk4sfvI+9EGEykFS4b0CHHGWqDYU0bGUFSwchNOMA56D7TCs9GwVTkqe9als1/ns8UQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/make-fetch-happen": {
|
||||
"version": "13.0.1",
|
||||
@@ -2485,6 +2513,7 @@
|
||||
"version": "2.8.3",
|
||||
"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz",
|
||||
"integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ip-address": "^9.0.5",
|
||||
"smart-buffer": "^4.2.0"
|
||||
@@ -2646,7 +2675,8 @@
|
||||
"node_modules/ts-mixer": {
|
||||
"version": "6.0.4",
|
||||
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.4.tgz",
|
||||
"integrity": "sha512-ufKpbmrugz5Aou4wcr5Wc1UUFWOLhq+Fm6qa6P0w0K5Qw2yhaUoiWszhCVuNQyNwrlGiscHOmqYoAox1PtvgjA=="
|
||||
"integrity": "sha512-ufKpbmrugz5Aou4wcr5Wc1UUFWOLhq+Fm6qa6P0w0K5Qw2yhaUoiWszhCVuNQyNwrlGiscHOmqYoAox1PtvgjA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.7.0",
|
||||
@@ -2657,6 +2687,7 @@
|
||||
"version": "6.19.8",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.19.8.tgz",
|
||||
"integrity": "sha512-U8uCCl2x9TK3WANvmBavymRzxbfFYG+tAu+fgx3zxQy3qdagQqBLwJVrdyO1TBfUXvfKveMKJZhpvUYoOjM+4g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18.17"
|
||||
}
|
||||
@@ -2842,6 +2873,7 @@
|
||||
"version": "8.18.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz",
|
||||
"integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"prismarine-chat": "^1.10.1",
|
||||
"prismarine-registry": "^1.7.0",
|
||||
"proxy-agent": "^6.4.0",
|
||||
"socks": "^2.8.3",
|
||||
"wikipedia": "^2.1.2",
|
||||
"xml2js": "^0.6.2"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
this folder is for removed / scrapped concepts just in case people want to reimplement them
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
const bots = require('../data/bots.json');
|
||||
const CommandError = require('../util/command_error')
|
||||
const bots = require('../../data/bots.json');
|
||||
const CommandError = require('../../util/command_error')
|
||||
module.exports = {
|
||||
name: "bots",
|
||||
description: ["shows a list of known bots"],
|
||||
aliases: ["knownbots"],
|
||||
trustLevel: 0,
|
||||
usages:[""],
|
||||
async execute(context) {
|
||||
data: {
|
||||
name: "bots",
|
||||
description: "shows a list of known bots",
|
||||
aliases: [
|
||||
"knownbots"
|
||||
],
|
||||
trustLevel: 0,
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
async execute(context) {
|
||||
const query = context.arguments.join(" ").toLowerCase();
|
||||
const bot = context.bot;
|
||||
if (query.length === 0) {
|
||||
@@ -0,0 +1,114 @@
|
||||
const trustedPlayers = require('../data/trustedPlayers.json');
|
||||
module.exports = (bot, options, config) => {
|
||||
let component;
|
||||
trustedPlayers.map((trusted) => {
|
||||
/*component.push({
|
||||
translate: "%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "ea" }
|
||||
]
|
||||
})*/
|
||||
bot.on('message', (data) => {
|
||||
try {
|
||||
let stringMessage = bot.getMessageAsPrismarine(data)?.toString();
|
||||
// console.log(JSON.stringify(data))
|
||||
// console.log(data?.with[0]?.clickEvent);
|
||||
// console.log(data.color);
|
||||
// for (const players of bot.players) {
|
||||
if (
|
||||
/*
|
||||
stringMessage.startsWith(`${trusted.player}`) &&
|
||||
data.translate === "multiplayer.player.joined" &&
|
||||
data.color === "yellow" &&
|
||||
data.with.insertion === `${trusted.player}` &&
|
||||
data?.with[0]?.clickEvent === `{action:'suggest_command',value:'/tell ${trusted.player} '}` &&*/
|
||||
JSON.stringify(data) ===
|
||||
JSON.stringify({
|
||||
color:'yellow',
|
||||
translate:'multiplayer.player.joined',
|
||||
with:[{insertion:`${trusted.player}`,
|
||||
clickEvent:{
|
||||
action:'suggest_command',
|
||||
value:`/tell ${trusted.player} `
|
||||
},
|
||||
hoverEvent:{
|
||||
action:'show_entity',
|
||||
contents:{
|
||||
type:'minecraft:player',
|
||||
id:`${bot.players.find((player) => player.profile.name === trusted.player)?.uuid}`,
|
||||
name:{
|
||||
text:`${trusted.player}`
|
||||
}
|
||||
}
|
||||
},
|
||||
text:`${trusted.player}`
|
||||
}]
|
||||
})
|
||||
) {
|
||||
if (bot.players.map((e) => { e.profile.name === trusted.player })) {
|
||||
bot.tellraw(`@a[name="${trusted.player}"]`, "e");
|
||||
component = "e";
|
||||
}
|
||||
}
|
||||
// bot.tellraw(`@a[name="${bot.players.find((player) => player.profile.name === trusted.player).profile.name}"]`, component);
|
||||
/* for (const players of bot.players) {
|
||||
// console.log(players);
|
||||
if (players.profile.name === trusted.player) {
|
||||
let e = players.profile.name === trusted.player;
|
||||
for (const eachBot of bot.bots) {
|
||||
eachBot.tellraw(`@a[name="${trusted.player}"]`, "e");
|
||||
}
|
||||
}*/
|
||||
// }
|
||||
//if (bot.players.find((player) => player.profile.name !== trusted.player)) return
|
||||
//for (const eachBot of bot.bots) {
|
||||
// if (bot.players.find((player) => player.profile.name === trusted.player)) {
|
||||
// bot.tellraw(`@a[name="${bot.players.find((player) => player.profile.name === trusted.player).profile.name}"]`, "e");
|
||||
// }
|
||||
//}
|
||||
// bot.chat.message(`${trusted.player} joined the game`);
|
||||
// }
|
||||
// }
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
})
|
||||
})
|
||||
/* bot.on('packet.login', (data) => {
|
||||
console.log(bot.players.find((players) => players.profile.name === trusted.player))
|
||||
console.log(bot.players)
|
||||
if (bot.players.find((player) => player.profile.name === trusted.player)) {
|
||||
bot.chat.message('player joined the game')
|
||||
}
|
||||
})
|
||||
multiplayer.player.joined
|
||||
[{"insertion":"Parker2991","clickEvent":{"action":"suggest_command",
|
||||
"value":"/tell Parker2991 "},"hoverEvent":{"action":"show_entity",
|
||||
"contents":{"type":"minecraft:player",
|
||||
"id":"85f5b68d-a567-3877-9701-3cd7404bc9d9",
|
||||
"name":{"text":"Parker2991"}}},"text":"Parker2991"}]
|
||||
[
|
||||
{
|
||||
insertion: 'Parker2991',
|
||||
clickEvent: { action: 'suggest_command', value: '/tell Parker2991 ' },
|
||||
hoverEvent: { action: 'show_entity', contents: [Object] },
|
||||
text: 'Parker2991'
|
||||
}
|
||||
]
|
||||
yellow
|
||||
*/
|
||||
/*for (const trusted in trustedPlayers) {
|
||||
component.push({
|
||||
translate: '%s',
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: 'e' }
|
||||
]
|
||||
})
|
||||
// console.log(component)
|
||||
}*/
|
||||
|
||||
// bot.tellraw("@a", component)
|
||||
|
||||
}
|
||||
+25
-11
@@ -1,10 +1,10 @@
|
||||
const mc = require('minecraft-protocol');
|
||||
const { EventEmitter } = require('events');
|
||||
EventEmitter.defaultMaxListeners = Infinity;
|
||||
EventEmitter.defaultMaxListeners = 5e6;
|
||||
const util = require('util');
|
||||
const createRegistry = require('prismarine-registry');
|
||||
const ChatMessage = require('prismarine-chat');
|
||||
function createBot(options = {}, config) {
|
||||
let endCount = 0;
|
||||
const bot = new EventEmitter();
|
||||
bot.options = {
|
||||
// Set some default values in options
|
||||
@@ -17,30 +17,40 @@ function createBot(options = {}, config) {
|
||||
bot.on('init_client', client => {
|
||||
client.on('packet', (data, meta) => {
|
||||
bot.emit('packet', data, meta)
|
||||
bot.emit('packet.' + meta.name, data)
|
||||
bot.emit('packet.' + meta.name, data);
|
||||
})
|
||||
|
||||
client.on('login', () => {
|
||||
client.on('login', (data) => {
|
||||
bot.uuid = client.uuid
|
||||
bot.username = client.username
|
||||
bot.registry = createRegistry(client.version)
|
||||
bot.registry = require('prismarine-registry')(client.version);
|
||||
bot.registry.language = require('./data/language.json');
|
||||
bot.emit('registry_ready', bot.registry)
|
||||
bot.emit('registry_ready', bot.registry);
|
||||
})
|
||||
|
||||
client.on('disconnect', data => {
|
||||
bot.emit("disconnect", data);
|
||||
console.log(ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi())
|
||||
bot.console.warn(`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`)
|
||||
})
|
||||
|
||||
client.on('end', reason => {
|
||||
bot.emit('end', reason);
|
||||
if (reason === "socketClosed") return;
|
||||
bot.console.warn(ChatMessage(bot._client.version).fromNotch(`§8[§bClient Reconnect§8]§r ${reason}`)?.toAnsi())
|
||||
bot.console.warn(ChatMessage(bot._client.version).fromNotch(`§8[§bClient Reconnect§8]§r ${reason}`)?.toAnsi());
|
||||
})
|
||||
|
||||
client.on('error', error => {
|
||||
bot.console.warn(ChatMessage(bot._client.version).fromNotch('§8[§bClient Reconnect§8]§r ')?.toAnsi() + util.inspect(error.toString()))
|
||||
bot?.discord?.channel?.send(error.toString())
|
||||
endCount++
|
||||
if (endCount === 10) {
|
||||
bot.console.info('stopped logging disconnect messages for now...');
|
||||
bot?.discord?.channel?.send('stopped logging disconnect messages for now...');
|
||||
return;
|
||||
} else if (endCount > 10) {
|
||||
return;
|
||||
} else {
|
||||
bot.console.warn(ChatMessage(bot._client.version).fromNotch('§8[§bClient Reconnect§8]§r ')?.toAnsi() + util.inspect(error.toString()))
|
||||
bot?.discord?.channel?.send(error.toString());
|
||||
}
|
||||
})
|
||||
|
||||
client.on("keep_alive", ({ keepAliveId }) => {
|
||||
@@ -53,6 +63,10 @@ function createBot(options = {}, config) {
|
||||
bot?.discord?.channel?.send(util.inspect(data.reason))
|
||||
})
|
||||
|
||||
client.on('success', (data) => {
|
||||
endCount = 0;
|
||||
})
|
||||
|
||||
process.on("uncaughtException", (e) => {
|
||||
// console?.warn(e.stack)
|
||||
});
|
||||
@@ -64,4 +78,4 @@ function createBot(options = {}, config) {
|
||||
bot.bots = options.bots ?? [bot]
|
||||
return bot
|
||||
}
|
||||
module.exports = createBot
|
||||
module.exports = createBot;
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
const CommandError = require('../../util/command_error');
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'coresettings',
|
||||
trustLevel: 2,
|
||||
aliases: [
|
||||
"cbsettings"
|
||||
],
|
||||
description: 'change the bots core settings',
|
||||
usages: [
|
||||
"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;
|
||||
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;
|
||||
bot.chat.message('now using the placed command block');
|
||||
break;
|
||||
case "off":
|
||||
case "false":
|
||||
case "disable":
|
||||
bot.core.usePlacedCommandBlock = false;
|
||||
bot.chat.message('no longer using the placed command block');
|
||||
break;
|
||||
default:
|
||||
if (bot.core.usePlacedCommandBlock) {
|
||||
bot.chat.message("the bot is currently using the placed command block to run its commands");
|
||||
} else {
|
||||
bot.chat.message("the bot is currently using its command block core to run its commands");
|
||||
}
|
||||
}
|
||||
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;
|
||||
bot.chat.message("arguments were NaN, defaulting to config core start coords");
|
||||
} else {
|
||||
bot.core.area.start = {
|
||||
x: Number(args[3]),
|
||||
y: Number(args[4]),
|
||||
z: Number(args[5])
|
||||
};
|
||||
bot.chat.message(`setting core start pos to x: ${args[3]}, y: ${args[4]}, z: ${args[5]}`);
|
||||
}
|
||||
break;
|
||||
case "end":
|
||||
if (isNaN(args[3]) || isNaN(args[4]) || isNaN(args[5])) {
|
||||
bot.core.area.end = config.core.area.end;
|
||||
bot.chat.message("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])
|
||||
};
|
||||
|
||||
bot.chat.message(`setting core end pos to x: ${args[3]}, y: ${args[4]}, z: ${args[5]}`);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
bot.chat.message(`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} `)
|
||||
}
|
||||
break;
|
||||
case "refillmethod":
|
||||
case "rcmethod":
|
||||
switch (args[2]?.toLowerCase()) {
|
||||
case "item":
|
||||
config.core.itemRefill = true;
|
||||
bot.chat.message('now refilling via item');
|
||||
break;
|
||||
case "chat":
|
||||
config.core.itemRefill = false;
|
||||
bot.chat.message('now refilling via chat');
|
||||
break;
|
||||
default:
|
||||
if (config.core.itemRefill) {
|
||||
bot.chat.message("currently filling core via item");
|
||||
} else {
|
||||
bot.chat.message("currently filling core via chat");
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError('invalid argument');
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'vanish',
|
||||
trustLevel: 2,
|
||||
aliases: [
|
||||
"vanishtoggle"
|
||||
],
|
||||
description: 'toggle the bots vanish selfcare',
|
||||
usages: [
|
||||
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
if (args.slice(1).join('') === 'true') {
|
||||
bot.vanished = true
|
||||
bot.chat.message('enabled vanish selfcare')
|
||||
}
|
||||
if (args.slice(1).join('') === 'false') {
|
||||
bot.vanished = false;
|
||||
bot.chat.message('disabled vanish selfcare')
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
bot.vanished = false;
|
||||
bot.chat.message('disabling vanish selfcare,...');
|
||||
bot.chat.command('v off')
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,19 @@
|
||||
module.exports = {
|
||||
name: 'console',
|
||||
trustLevel: 4,
|
||||
aliases: [
|
||||
data: {
|
||||
name: 'console',
|
||||
trustLevel: 4,
|
||||
description: "",
|
||||
aliases: [
|
||||
|
||||
],
|
||||
usages: [
|
||||
'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>'
|
||||
],
|
||||
],
|
||||
usages: [
|
||||
'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;
|
||||
@@ -66,7 +69,6 @@ module.exports = {
|
||||
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
|
||||
} else if (!bot.console.customChat.enabled) {
|
||||
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
|
||||
// bot.chat.message(`${config.prefixes[0]}${args.slice(2)} ${args.slice(3).shift()}${bot.validation.trusted}`)
|
||||
}
|
||||
break
|
||||
case "admin":
|
||||
@@ -80,7 +82,7 @@ module.exports = {
|
||||
case "trusted":
|
||||
case "t":
|
||||
if (bot.console.customChat.enabled) {
|
||||
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`);
|
||||
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`);
|
||||
} else if (!bot.console.customChat.enabled) {
|
||||
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
const CommandError = require('../util/command_error')
|
||||
|
||||
module.exports = {
|
||||
name: 'core',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"cb",
|
||||
"corerun",
|
||||
"commandcorerun",
|
||||
],
|
||||
description: 'run commands in core!',
|
||||
usages: [
|
||||
"<command>",
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ');
|
||||
bot.core.run(message)
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
bot.core.run(args.join(' '));
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
const CommandError = require('../util/command_error');
|
||||
module.exports = {
|
||||
name: 'filter',
|
||||
trustLevel: 2,
|
||||
aliases: [
|
||||
"blacklist"
|
||||
],
|
||||
description: 'filters players',
|
||||
usages: [
|
||||
"list",
|
||||
"--regex(-r) --ignorecase(-i) add <player>",
|
||||
"--ignorecase(-i) add <player>",
|
||||
"add <player>",
|
||||
"clear",
|
||||
"remove(rm) <index>"
|
||||
],
|
||||
execute (context) {
|
||||
/*
|
||||
note:
|
||||
bot.filter.add(ignoreCase(true/false), regexed(true/false), name(args))
|
||||
*/
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
let component = [];
|
||||
if (bot.options.isCreayun || bot.options.isSavage) throw new CommandError('this command is meant for kaboom.pw and its clones')
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4]) return
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case 'list':
|
||||
// bot.tellraw(`@a`, JSON.stringify(bot.filter.list().length));
|
||||
if (bot.filter.list().length === 0) {
|
||||
component.push({
|
||||
translate: '%s: (%s)',
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
{ text: 'Players', color: 'dark_blue' },
|
||||
{ text: JSON.stringify(bot.filter.list().length), color: 'gold' },
|
||||
]
|
||||
})
|
||||
} else {
|
||||
let i = 0;
|
||||
let listComponent = []
|
||||
for (const players of bot.filter.list()) {
|
||||
listComponent.push({
|
||||
translate: '%s \u203a %s',
|
||||
color: 'dark_blue',
|
||||
with: [
|
||||
{ text: `${i}`, color: 'gold' },
|
||||
{ text: players.name, color: 'blue' },
|
||||
]
|
||||
})
|
||||
listComponent.push('\n')
|
||||
i++
|
||||
}
|
||||
|
||||
listComponent.pop()
|
||||
|
||||
component.push({
|
||||
translate: '%s: (%s)',
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
{ text: 'Players', color: 'dark_blue' },
|
||||
{ text: `${bot.filter.list().length}`, color: 'gold' }
|
||||
]
|
||||
})
|
||||
component.push('\n')
|
||||
component.push(listComponent)
|
||||
// bot.tellraw("@a", component)
|
||||
}
|
||||
bot.tellraw("@a", component)
|
||||
break;
|
||||
case "--regex":
|
||||
case "-r":
|
||||
switch (args[2]?.toLowerCase()) {
|
||||
case "--ignorecase":
|
||||
case "-i":
|
||||
switch (args[3]?.toLowerCase()) {
|
||||
case "add":
|
||||
case "a":
|
||||
bot.filter.add(true, true, args[4])
|
||||
bot.chat.message(`Added ${args[4]} to the filter`)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "add":
|
||||
bot.filter.add(false, true, args[3]);
|
||||
bot.chat.message(`Added ${args[3]} to the filter`);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "--ignorecase":
|
||||
case "-i":
|
||||
switch (args[2]?.toLowerCase()) {
|
||||
case "add":
|
||||
bot.filter.add(true, false, args[3]);
|
||||
bot.chat.message(`Added ${args[3]} to the filter`)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "add":
|
||||
case "a":
|
||||
bot.filter.add(false, false, args.slice(2).join(' '));
|
||||
bot.chat.message(`Added ${args.slice(2).join(' ')} to the filter`);
|
||||
break;
|
||||
case "clear":
|
||||
case "c":
|
||||
bot.filter.clear();
|
||||
bot.chat.message('Cleared filter');
|
||||
break
|
||||
case "remove":
|
||||
case "rm": // rm linux command reference
|
||||
if (isNaN(args.slice(2))) throw new CommandError('argument must be a integer!');
|
||||
bot.filter.remove(args.slice(2));
|
||||
bot.chat.message(`Removed ${args.slice(2)} from the filter`);
|
||||
break
|
||||
default:
|
||||
throw new CommandError('invalid argument')
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -1,403 +0,0 @@
|
||||
const os = require("os");
|
||||
const CommandError = require('../util/command_error');
|
||||
const fs = require("fs");
|
||||
const botInfo = require('../data/info.json');
|
||||
const fixansi = require('../util/ansi.js');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { exec } = require('child_process')
|
||||
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`))
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: 'info',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"information",
|
||||
],
|
||||
description: 'check the bots info',
|
||||
usages: [
|
||||
"version",
|
||||
"config",
|
||||
"discord",
|
||||
"server",
|
||||
"contributors",
|
||||
"about"
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const source = context.source;
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case 'version':
|
||||
if (botInfo.bot.buildstring.codename === '') {
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(`&9Friday &9Night &9Funkin &3Boyfriend &1Bot&8&r-${botInfo.bot.buildstring.version}-#${botInfo.bot.buildstring.build}`)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(`11/22/22 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`)
|
||||
}, 300)
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, `§9Friday §9Night §9Funkin §3Boyfriend §1Bot§8§r-${botInfo.bot.buildstring.version}-#${botInfo.bot.buildstring.build}\n11/22/22 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`);
|
||||
}
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, `§9Friday §9Night §9Funkin §3Boyfriend §1Bot§8§r-${botInfo.bot.buildstring.version}-#${botInfo.bot.buildstring.build}-${botInfo.bot.buildstring.codename}\n11/22/22 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`);
|
||||
}
|
||||
break
|
||||
case 'config':
|
||||
if (bot.options.isKaboom) {
|
||||
mode = 'Kaboom'
|
||||
} else if (bot.options.isCreayun) {
|
||||
mode = 'Creayun'
|
||||
} else if (bot.options.useChat) {
|
||||
mode = 'useChat / Kaboom'
|
||||
} else if (bot.options.isSavage) {
|
||||
mode = 'Savage'
|
||||
}
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
{
|
||||
text: `Minecraft username \u203a ${bot.options.username}\n`,
|
||||
color: 'gray',
|
||||
},
|
||||
{
|
||||
text: `Ip \u203a ${bot.options.host}:`,
|
||||
color: "gray"
|
||||
},
|
||||
{
|
||||
text: `${bot.options.port}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `Version \u203a ${bot.options.version}\n`,
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: `Discord username \u203a ${discordClient.user.tag}\n`,
|
||||
color: 'gray',
|
||||
},
|
||||
{
|
||||
text: `Channel \u203a ${bot.discord.channel?.name}\n`,
|
||||
color: "gray"
|
||||
},
|
||||
{
|
||||
text: `Server name \u203a ${bot.options.serverName}\n`,
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: `Server count \u203a `,
|
||||
color: "gray"
|
||||
},
|
||||
{
|
||||
text: `${bot.bots.length}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `Prefixes \u203a ${config.prefixes.map((e) => e + " ").join(' ')}\n`,
|
||||
color: "gray"
|
||||
},
|
||||
{
|
||||
text: `Prefix Length: `,
|
||||
color: "gray"
|
||||
},
|
||||
{
|
||||
text: `${config.prefixes.length}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: 'Mode \u203a ',
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `${mode}`,
|
||||
color: 'gray',
|
||||
}
|
||||
/* {
|
||||
text: `isKaboom \u203a ${bot.options.isKaboom}\n`,
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: `isCreayun \u203a ${bot.options.isCreayun}\n`,
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: `isSavage \u203a ${bot.options.isSavage}`,
|
||||
color: "gray",
|
||||
},*/
|
||||
]);
|
||||
break;
|
||||
case 'discord':
|
||||
bot.tellraw("@a", [
|
||||
{
|
||||
text: `the discord server invite is ${config.discord.invite}`,
|
||||
color: "gray",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "click here to join the discord server!",
|
||||
color: "gray",
|
||||
}
|
||||
]
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `${config.discord.invite}`
|
||||
}
|
||||
},
|
||||
])
|
||||
break
|
||||
case "server":
|
||||
if (process.platform === 'win32') {
|
||||
exec('rmdir /s /q ..\FridayNightFunkinBoyfriendBot')
|
||||
process.exit(0) // fuck you windows
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
{
|
||||
text: `Hostname \u203a ${os.hostname()}\n`,
|
||||
color: "gray"
|
||||
},
|
||||
{
|
||||
text: `User \u203a ${os.userInfo().username}\n`,
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: `Working Directory \u203a ${process.mainModule.path}\n`,
|
||||
color: "gray"
|
||||
},
|
||||
{
|
||||
text: `Arch \u203a ${os.arch()}\n`,
|
||||
color: "gray"
|
||||
},
|
||||
{
|
||||
text: `OS \u203a ${os.platform()}\n`,
|
||||
color: "gray"
|
||||
},
|
||||
{
|
||||
text: `OS Version/distro \u203a ${os.version()}\n`,
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: `Kernel Version \u203a ${os.release()}\n`,
|
||||
color: "gray"
|
||||
},
|
||||
{
|
||||
text: `Core Count \u203a `,
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: `${os.cpus().length}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `CPU \u203a ${os.cpus()[0].model}\n`,
|
||||
color: "gray"
|
||||
},
|
||||
{
|
||||
text: `Server Free memory `,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `${Math.floor( os.freemem() / 1048576, )} `,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: 'MiB / ',
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(os.totalmem() / 1048576)} `,
|
||||
color: "gold",
|
||||
},
|
||||
{
|
||||
text: 'MiB\n',
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: `Bot memory usage `, color: "gray"
|
||||
},
|
||||
{
|
||||
text: `${Math.floor( process.memoryUsage().heapUsed / 1048576, )} `,
|
||||
color: "gold",
|
||||
},
|
||||
{
|
||||
text: "MiB / ",
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: `${Math.floor( process.memoryUsage().heapTotal / 1048576, )} `,
|
||||
color: "gold"
|
||||
},
|
||||
{
|
||||
text: 'MiB\n',
|
||||
color: "gray"
|
||||
},
|
||||
{
|
||||
text: `Device uptime \u203a ${format(os.uptime())}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Bot uptime \u203a ${format(process.uptime())}\n`,
|
||||
color: "gray"
|
||||
},
|
||||
{
|
||||
text: `Node version \u203a ${process.version}`,
|
||||
color: 'gray'
|
||||
}
|
||||
])
|
||||
}
|
||||
break
|
||||
case "contributors":
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
{
|
||||
text: "Parker",
|
||||
color: "dark_red",
|
||||
},
|
||||
{
|
||||
text: "2991",
|
||||
color: "black"
|
||||
},
|
||||
{
|
||||
text: " - Owner\n",
|
||||
color: "gray"
|
||||
},
|
||||
{
|
||||
text: "Contributors -\n",
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: "_ChipMC_ - ChipmunkBot js & java\n",
|
||||
color: "dark_blue"
|
||||
},
|
||||
{
|
||||
text: "chayapak - ChomeNS js & java\n",
|
||||
color: "yellow"
|
||||
},
|
||||
{
|
||||
text: "_yfd - abot\n",
|
||||
color: "light_purple"
|
||||
},
|
||||
{
|
||||
text: "aaa - FBot, SnifferBot, Xbot, Hydra\n",
|
||||
color: "gold",
|
||||
},
|
||||
{
|
||||
text: "Morgan Ankan - RecycleBot\n",
|
||||
color: "dark_green"
|
||||
},
|
||||
{
|
||||
text: "TurtleKid - TurtleBot",
|
||||
color: "dark_green"
|
||||
},
|
||||
])
|
||||
break
|
||||
case "about":
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
{
|
||||
text: `FNFBoyfriendBot is a open source kaboom bot created by Parker2991\nThe source code and changelog can be found here ${botInfo.bot.source}`,
|
||||
color: "gray",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "click here to view bots source code",
|
||||
color: "gray",
|
||||
}
|
||||
]
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `${botInfo.bot.source}`
|
||||
}
|
||||
}
|
||||
])
|
||||
break
|
||||
default:
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
let Embed;
|
||||
let ansi;
|
||||
let fix;
|
||||
let message;
|
||||
switch (args[0]) {
|
||||
case "version":
|
||||
message = bot.getMessageAsPrismarine(`§9Friday §9Night §9Funkin §3Boyfriend §1Bot§8§r-${botInfo.bot.buildstring.version}-#${botInfo.bot.buildstring.build}-${botInfo.bot.buildstring.codename}\n11/22/22 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`)?.toString()
|
||||
fix = fixansi(message.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] });
|
||||
break
|
||||
case "config":
|
||||
message = bot.getMessageAsPrismarine([
|
||||
{ text: `Minecraft username \u203a ${bot.options.username}\n`, color: 'gray', },
|
||||
{ text: `Ip \u203a ${bot.options.host}:${bot.options.port}\n`, color: "gray" },
|
||||
{ text: `Version \u203a ${bot.options.version}\n`, color: "gray" },
|
||||
{ text: `Discord username \u203a ${discordClient.user.tag}\n`, color: 'gray' },
|
||||
{ text: `Channel \u203a ${bot.discord.channel?.name}\n`, color: "gray" },
|
||||
{ text: `Server name \u203a ${bot.options.serverName}\n`, color: "gray" },
|
||||
{ text: `Server count \u203a ${bot.bots.length}\n`, color: "gray" },
|
||||
{ text: `Prefixes \u203a ${config.prefixes.map((e) => e + " ").join(' ')}\n`, color: "gray" },
|
||||
{ text: `Prefix Length: ${config.prefixes.length}\n`, color: "gray" },
|
||||
{ text: `isKaboom \u203a ${bot.options.isKaboom}\n`, color: "gray" },
|
||||
{ text: `isCreayun \u203a ${bot.options.isCreayun}\n`, color: "gray" },
|
||||
{ text: `isSavage \u203a ${bot.options.isSavage}\n`, color: "gray", } ])?.toAnsi();
|
||||
fix = fixansi(message.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
break
|
||||
case "server":
|
||||
message = bot.getMessageAsPrismarine([
|
||||
{ text: `Hostname \u203a ${os.hostname()}\n`, color: "gray" },
|
||||
{ text: `User \u203a ${os.userInfo().username}\n`, color: "gray" },
|
||||
{ text: `Working Directory \u203a ${process.mainModule.path}\n`, color: "gray" },
|
||||
{ text: `Arch \u203a ${os.arch()}\n`, color: "gray" }, { text: `OS \u203a ${os.platform()}\n`, color: "gray" },
|
||||
{ text: `OS Version/distro \u203a ${os.version()}\n`, color: "gray" },
|
||||
{ text: `Kernel Version \u203a ${os.release()}\n`, color: "gray" },
|
||||
{ text: `Cores \u203a ${os.cpus().length}\n`, color: "gray" },
|
||||
{ text: `CPU \u203a ${os.cpus()[0].model}\n`, color: "gray" },
|
||||
{ text: `Server Free memory `, color: 'gray' },
|
||||
{ text: `${Math.floor( os.freemem() / 1048576, )} `, color: 'gold' },
|
||||
{ text: 'MiB / ', color: 'gray' },
|
||||
{ text: `${Math.floor(os.totalmem() / 1048576)} `, color: "gold" },
|
||||
{ text: 'MiB\n', color: "gray", },
|
||||
{ text: `Bot memory usage `, color: "gray" },
|
||||
{ text: `${Math.floor( process.memoryUsage().heapUsed / 1048576, )} `, color: "gold", },
|
||||
{ text: "MiB / ", color: "gray", },
|
||||
{ text: `${Math.floor( process.memoryUsage().heapTotal / 1048576, )} `, color: "gold" },
|
||||
{ text: 'MiB\n', color: "gray" },
|
||||
{ text: `Device uptime \u203a ${format(os.uptime())}\n`, color: 'gray' },
|
||||
{ text: `Bot uptime \u203a ${format(process.uptime())}\n`, color: "gray" },
|
||||
{ text: `Node version \u203a ${process.version}`, color: 'gray' } ])?.toAnsi();
|
||||
fix = fixansi(message.replace('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
break
|
||||
default:
|
||||
throw new CommandError('Invalid argument');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'kill',
|
||||
trustLevel: 3,
|
||||
aliases: [
|
||||
"suicide",
|
||||
"quit",
|
||||
],
|
||||
description: 'kill the bots process',
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
process.kill(process.pid);
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
process.kill(process.pid);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'kill',
|
||||
trustLevel: 3,
|
||||
aliases: [
|
||||
"suicide",
|
||||
"quit",
|
||||
],
|
||||
description: 'kill the bots process',
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
process.exit(1);
|
||||
},
|
||||
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,18 @@
|
||||
const CommandError = require('../util/command_error.js');
|
||||
const { stylize } = require('../util/stylizeEval');
|
||||
const CommandError = require('../../util/command_error.js');
|
||||
const { stylize } = require('../../util/stylizeEval');
|
||||
const util = require('util');
|
||||
module.exports = {
|
||||
name: 'servereval',
|
||||
trustLevel: 3,
|
||||
aliases: [
|
||||
],
|
||||
description: 'run code unisolated',
|
||||
usages: [
|
||||
"<code>",
|
||||
],
|
||||
data: {
|
||||
name: 'servereval',
|
||||
trustLevel: 3,
|
||||
aliases: [
|
||||
"se"
|
||||
],
|
||||
description: 'run code unisolated',
|
||||
usages: [
|
||||
"<code>",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
@@ -0,0 +1,27 @@
|
||||
const CommandError = require('../../util/command_error')
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'core',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"cb",
|
||||
"corerun",
|
||||
"commandcorerun",
|
||||
],
|
||||
description: 'run commands in core!',
|
||||
usages: [
|
||||
"<command>",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ');
|
||||
bot.core.run(message);
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
bot.core.run(args.join(' '));
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,19 @@
|
||||
const cowsay = require('cowsay2');
|
||||
const cows = require('cowsay2/cows');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const fixansi = require('../util/ansi');
|
||||
const fixansi = require('../../util/ansi');
|
||||
module.exports = {
|
||||
name: 'cowsay',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'amogus',
|
||||
usages: [
|
||||
"just wait till the command is ready :3"
|
||||
],
|
||||
data: {
|
||||
name: 'cowsay',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'cows',
|
||||
usages: [
|
||||
"<message>",
|
||||
"list"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
@@ -56,7 +59,7 @@ module.exports = {
|
||||
const fixAnsiList = fixansi(ansiList.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fixAnsiList}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
} else if (cows[args[0]]) {
|
||||
@@ -64,7 +67,7 @@ module.exports = {
|
||||
const fixAnsiCow1 = fixansi(ansiCow1.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fixAnsiCow1}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
} else {
|
||||
@@ -1,14 +1,16 @@
|
||||
module.exports = {
|
||||
name: 'echo',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"say",
|
||||
"botsay",
|
||||
],
|
||||
description: 'Make me say something',
|
||||
usages: [
|
||||
"<message>"
|
||||
],
|
||||
data: {
|
||||
name: 'echo',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"say",
|
||||
"botsay",
|
||||
],
|
||||
description: 'Make me say something',
|
||||
usages: [
|
||||
"<message>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
@@ -16,7 +18,6 @@ module.exports = {
|
||||
bot.chat.command(message.substring(1))
|
||||
return
|
||||
}
|
||||
// if
|
||||
bot.chat.message(message)
|
||||
},
|
||||
discordExecute (context) {
|
||||
@@ -1,26 +1,27 @@
|
||||
const CommandError = require('../util/command_error');
|
||||
const sleep = require('../util/sleep.js');
|
||||
const fixansi = require('../util/ansi');
|
||||
const CommandError = require('../../util/command_error');
|
||||
const sleep = require('../../util/sleep.js');
|
||||
const fixansi = require('../../util/ansi');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
module.exports = {
|
||||
name: 'help',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"heko",
|
||||
"?",
|
||||
"cmds",
|
||||
"hell",
|
||||
"hello",
|
||||
"helo",
|
||||
"commands",
|
||||
"commandshelp",
|
||||
|
||||
],
|
||||
description: 'a list of the bots commands',
|
||||
usages: [
|
||||
"",
|
||||
"<command>",
|
||||
],
|
||||
data: {
|
||||
name: 'help',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"heko",
|
||||
"?",
|
||||
"cmds",
|
||||
"hell",
|
||||
"hello",
|
||||
"helo",
|
||||
"commands",
|
||||
"commandshelp",
|
||||
],
|
||||
description: 'a list of the bots commands',
|
||||
usages: [
|
||||
"",
|
||||
"<command>",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const commandList = [];
|
||||
const bot = context.bot;
|
||||
@@ -47,41 +48,41 @@ module.exports = {
|
||||
for (const command of bot.commandManager.commandlist) {
|
||||
let usagesComponent = [];
|
||||
let commandComponent = [];
|
||||
for (const usages of command.usages) {
|
||||
if (command?.trustLevel === 1) {
|
||||
for (const usages of command.data.usages) {
|
||||
if (command?.data?.trustLevel === 1) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.name} <trusted/admin/owner hashes>`, color: "blue" },
|
||||
{ text: `${command.data.name} <trusted/admin/owner hashes>`, color: "blue" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.trustLevel === 2) {
|
||||
} else if (command?.data.trustLevel === 2) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.name} <admin/owner hashes>`, color: "blue" },
|
||||
{ text: `${command.data.name} <admin/owner hashes>`, color: "blue" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.trustLevel === 3) {
|
||||
} else if (command?.data.trustLevel === 3) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.name} <owner hash>`, color: "blue" },
|
||||
{ text: `${command.data.name} <owner hash>`, color: "blue" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.trustLevel === 0 || command.trustLevel === 4) {
|
||||
} else if (command?.data.trustLevel === 0 || command.data.trustLevel === 4) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.name}`, color: "blue" },
|
||||
{ text: `${usages.toString().replaceAll(',','')}`, color: "aqua" },
|
||||
{ text: `${command.data.name}`, color: "blue" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
}
|
||||
@@ -94,16 +95,16 @@ module.exports = {
|
||||
with: [
|
||||
{ text: "Command Name", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.name}`, color: "blue" },
|
||||
{ text: `${command.data.name}`, color: "blue" },
|
||||
{ text: "Aliases", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.aliases.toString().replaceAll(',',' ')}`, color: "blue" },
|
||||
{ text: `${command.data.aliases.toString().replaceAll(',',' ')}`, color: "blue" },
|
||||
{ text: "Description", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.description}`, color: "blue" },
|
||||
{ text: `${command.data.description}`, color: "blue" },
|
||||
{ text: "Trust Level", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.trustLevel}`, color: "gold" },
|
||||
{ text: `${command.data.trustLevel}`, color: "gold" },
|
||||
{ text: "Usages", color: "dark_blue" },
|
||||
{ text: "\u203a" }
|
||||
]
|
||||
@@ -111,7 +112,7 @@ module.exports = {
|
||||
commandComponent.push("\n");
|
||||
commandComponent.push(usagesComponent);
|
||||
// for (const aliases of command.aliases) {
|
||||
if (args[0]?.toLowerCase() === command.name) {
|
||||
if (args[0]?.toLowerCase() === command.data.name) {
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`);
|
||||
} else {
|
||||
@@ -129,173 +130,174 @@ module.exports = {
|
||||
}
|
||||
console.log(aliases)*/
|
||||
// }
|
||||
if (command.trustLevel === 0) {
|
||||
// tellraw @p {"text":"this","clickEvent":{"action":"suggest_command","value":"this"}}
|
||||
if (command.data.trustLevel === 0) {
|
||||
public.push([
|
||||
{
|
||||
text: command.name + ' ',
|
||||
text: command.data.name + ' ',
|
||||
color: "aqua",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command:${command.name}\n`,
|
||||
color: 'gray'
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'gray'
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `${command.trustLevel}\n`,
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.description}\n`,
|
||||
color: 'gray'
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.aliases}\n`,
|
||||
color: 'gray'
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'gray',
|
||||
color: 'dark_blue',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'run_command',
|
||||
value: `${config.prefixes[0]}${command?.name}`
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
} else if (command.trustLevel === 1) {
|
||||
} else if (command.data.trustLevel === 1) {
|
||||
trusted.push([
|
||||
{
|
||||
text: command.name + ' ',
|
||||
text: command.data.name + ' ',
|
||||
color: "dark_aqua",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command:${command.name}\n`,
|
||||
color: 'gray'
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'gray'
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `${command.trustLevel}\n`,
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.description}\n`,
|
||||
color: 'gray'
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.aliases}\n`,
|
||||
color: 'gray'
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'gray',
|
||||
color: 'dark_blue',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'run_command',
|
||||
value: `${config.prefixes[0]}${command?.name}`
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
} else if (command.trustLevel === 2) {
|
||||
} else if (command.data.trustLevel === 2) {
|
||||
admin.push([
|
||||
{
|
||||
text: command.name + ' ',
|
||||
text: command.data.name + ' ',
|
||||
color: "blue",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action:"show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command:${command.name}\n`,
|
||||
color: 'gray'
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'gray'
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `${command.trustLevel}\n`,
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.description}\n`,
|
||||
color: 'gray'
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.aliases}\n`,
|
||||
color: 'gray'
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'gray',
|
||||
color: 'dark_blue',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'run_command',
|
||||
value: `${config.prefixes[0]}${command?.name}`
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
} else if (command.trustLevel === 3) {
|
||||
} else if (command.data.trustLevel === 3) {
|
||||
owner.push([
|
||||
{
|
||||
text: command.name + ' ',
|
||||
text: command.data.name + ' ',
|
||||
color: "dark_blue",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command:${command.name}\n`,
|
||||
color: 'gray'
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'gray'
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `${command.trustLevel}\n`,
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.description}\n`,
|
||||
color: 'gray'
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.aliases}\n`,
|
||||
color: 'gray'
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'gray',
|
||||
color: 'dark_blue',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'run_command',
|
||||
value: `${config.prefixes[0]}${command?.name}`
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
const length = bot.commandManager.commandlist.filter(c => c.trustLevel != 4).length
|
||||
const length = bot.commandManager.commandlist.filter(c => c.data.trustLevel != 4).length
|
||||
if (bot.options.useChat) {
|
||||
bot.chat.message(bot.getMessageAsPrismarine([
|
||||
{
|
||||
@@ -352,6 +354,34 @@ module.exports = {
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
|
||||
}, 400)
|
||||
} else if (bot.options.isCreayun) {
|
||||
bot.chat.message(bot.getMessageAsPrismarine([
|
||||
{
|
||||
text: 'Commands (',
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: length,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: ') ',
|
||||
color: 'gray'
|
||||
},
|
||||
category,
|
||||
])?.toMotd().replaceAll('§','&'))
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(public)?.toMotd().replaceAll("§","&"))
|
||||
}, 2500)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
|
||||
}, 2500)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
|
||||
}, 2500)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
|
||||
}, 2500)
|
||||
} else if (admin.length === 0) {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
{ text: 'Commands (', color: 'gray' },
|
||||
@@ -399,52 +429,52 @@ module.exports = {
|
||||
let admin = [];
|
||||
let owner = [];
|
||||
for (const command of bot.commandManager.commandlist) {
|
||||
if (args[0] === command.name) {
|
||||
const ansi = bot.getMessageAsPrismarine([ { text: `CommandName \u203a ${command.name}\n`, color: 'gray', }, { text: `Aliases \u203a ${command.aliases}\n`, color: 'gray', }, { text: `Description \u203a ${command.description}\n`, color: 'gray', }, { text: `trustLevel \u203a ${command.trustLevel}\n`, color: 'gray' }, { text: `Usages \u203a ${command?.usages}`, color: "dark_gray" }, ])?.toAnsi().replaceAll('```\u001b[9```' + '```\u001b[3```')
|
||||
if (args[0] === command.data.name) {
|
||||
const ansi = bot.getMessageAsPrismarine([ { text: `CommandName \u203a ${command.data.name}\n`, color: 'gray', }, { text: `Aliases \u203a ${command.data.aliases}\n`, color: 'gray', }, { text: `Description \u203a ${command.data.description}\n`, color: 'gray', }, { text: `trustLevel \u203a ${command.data.trustLevel}\n`, color: 'gray' }, { text: `Usages \u203a ${command?.data.usages}`, color: "dark_gray" }, ])?.toAnsi().replaceAll('```\u001b[9```' + '```\u001b[3```')
|
||||
const fix = fixansi(ansi.replaceAll('`', '`\u200b'))
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
return
|
||||
}
|
||||
if (command?.trustLevel === 0) {
|
||||
if (command?.data.trustLevel === 0 && command.discordExecute) {
|
||||
public.push([
|
||||
{
|
||||
text: command.name + ' ',
|
||||
text: command.data.name + ' ',
|
||||
color: "aqua",
|
||||
}
|
||||
])
|
||||
} else if (command?.trustLevel === 1) {
|
||||
} else if (command?.data.trustLevel === 1 && command.discordExecute) {
|
||||
trusted.push([
|
||||
{
|
||||
text: command.name + ' ',
|
||||
text: command.data.name + ' ',
|
||||
color: "dark_aqua"
|
||||
}
|
||||
])
|
||||
} else if (command?.trustLevel === 2) {
|
||||
} else if (command?.data.trustLevel === 2 && command.discordExecute) {
|
||||
admin.push([
|
||||
{
|
||||
text: command.name + ' ',
|
||||
text: command.data.name + ' ',
|
||||
color: 'blue'
|
||||
}
|
||||
])
|
||||
} else if (command?.trustLevel === 3) {
|
||||
} else if (command?.data.trustLevel === 3 && command.discordExecute) {
|
||||
owner.push([
|
||||
{
|
||||
text: command.name + ' ',
|
||||
text: command.data.name + ' ',
|
||||
color: "dark_blue",
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
const length = bot.commandManager.commandlist.filter(c => c.trustLevel != 3).length
|
||||
const length = bot.commandManager.commandlist.filter(c => c.data.trustLevel !== 4 && c.discordExecute).length
|
||||
const ansi1 = bot.getMessageAsPrismarine([ { text: 'Commands (', color: 'gray' }, { text: JSON.stringify(length), color: 'gold' }, { text: ') ', color: 'gray' }, category, '\n', public, trusted, owner ])?.toAnsi();
|
||||
const fix1 = fixansi(ansi1.replaceAll('`', '`\u200b'))
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix1}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
bot?.discord?.message.react('♋')
|
||||
@@ -0,0 +1,363 @@
|
||||
const os = require("os");
|
||||
const CommandError = require('../../util/command_error');
|
||||
const fs = require("fs");
|
||||
const botInfo = require('../../../package-lock.json');
|
||||
const fixansi = require('../../util/ansi.js');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { execSync } = require('child_process')
|
||||
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`))
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'info',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"information",
|
||||
],
|
||||
description: 'check the bots info',
|
||||
usages: [
|
||||
"about",
|
||||
"config <client, discord, options, all>",
|
||||
"contributors/credits",
|
||||
"discord",
|
||||
"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: `${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: `${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 "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 Usage", color: config.colors.commands.primary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576 )}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary }
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "server":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Free Server Memory", color: config.colors.commands.primary },
|
||||
{ text: `${Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "all":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s\n%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Free Server Memory", color: config.colors.commands.primary },
|
||||
{ text: `${Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: "Bot Memory Usage", color: config.colors.commands.primary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576 )}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary }
|
||||
]
|
||||
})
|
||||
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",
|
||||
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: `${process.mainModule.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: "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: `${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" });
|
||||
}
|
||||
bot.tellraw(`@a[name="${source.player.profile.name}"]`, component);
|
||||
},
|
||||
}
|
||||
@@ -1,12 +1,20 @@
|
||||
const CommandError = require('../util/command_error');
|
||||
const CommandError = require('../../util/command_error');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const fixansi = require('../util/ansi');
|
||||
const fixansi = require('../../util/ansi');
|
||||
module.exports = {
|
||||
name: 'list',
|
||||
description:['check the player list'],
|
||||
trustLevel: 0,
|
||||
aliases:['playerlist', 'plist', 'pl'],
|
||||
usages:[""],
|
||||
data: {
|
||||
name: 'list',
|
||||
description: 'check the player list',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
'playerlist',
|
||||
'plist',
|
||||
'pl'
|
||||
],
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
@@ -86,7 +94,7 @@ module.exports = {
|
||||
const fix = fixansi(ansi.replaceAll('`', '`\u200b').substring(0, 3080))
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
}
|
||||
@@ -1,18 +1,20 @@
|
||||
const { request } = require('undici');
|
||||
const CommandError = require('../util/command_error.js');
|
||||
const CommandError = require('../../util/command_error.js');
|
||||
const mc = require('minecraft-protocol');
|
||||
const util = require('util')
|
||||
module.exports = {
|
||||
name: 'mcserver',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"pingserver",
|
||||
"pingsrv",
|
||||
],
|
||||
description: 'look up minecraft server info',
|
||||
usages: [
|
||||
"<minecraft server ip>",
|
||||
],
|
||||
data: {
|
||||
name: 'mcserver',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"pingserver",
|
||||
"pingsrv",
|
||||
],
|
||||
description: 'look up minecraft server info',
|
||||
usages: [
|
||||
"<minecraft server ip>",
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
const bot = context.bot;
|
||||
const discordClient = context.discordClient;
|
||||
@@ -0,0 +1,32 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'memusage',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'check the bots and the servers ram usage',
|
||||
usages: [
|
||||
"on/enable/true",
|
||||
"off/disable/false",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "on":
|
||||
case "enable":
|
||||
case "true":
|
||||
bot.memUsage.enabled = true;
|
||||
bot.chat.message('enabled memusage');
|
||||
break;
|
||||
case "off":
|
||||
case "enable":
|
||||
case "false":
|
||||
bot.memUsage.enabled = false;
|
||||
bot.chat.message('disabled memusage');
|
||||
break;
|
||||
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -1,36 +1,40 @@
|
||||
const CommandError = require('../util/command_error.js')
|
||||
const CommandError = require('../../util/command_error.js')
|
||||
module.exports = {
|
||||
name: 'netmsg',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
data: {
|
||||
name: 'netmsg',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
|
||||
],
|
||||
description: 'netmsg to other servers',
|
||||
usages: [
|
||||
"<message>"
|
||||
],
|
||||
],
|
||||
description: 'netmsg to other servers',
|
||||
usages: [
|
||||
"<message>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const args = context.arguments;
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
if (config.patches.netmsg) {
|
||||
component = [
|
||||
{ text: '[', color: "dark_gray" },
|
||||
{ text: bot.options.serverName, color: "gray" },
|
||||
{ text: "] ", color: "dark_gray" },
|
||||
source.player.displayName,
|
||||
{ text: " \u203a ", color: "dark_gray", bold: false },
|
||||
{ text: args.join(' '), color: "gray", bold: false }
|
||||
]
|
||||
} else {
|
||||
if (bot.options.private) {
|
||||
component = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: bot.options.serverName, color: "gray" },
|
||||
{ text: bot.options.serverName, color: "blue" },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: args.join(' '), color: "gray" },
|
||||
{ text: args.join(' '), color: "blue" },
|
||||
]
|
||||
}
|
||||
} else if (!bot.options.private) {
|
||||
component = {
|
||||
translate: '[%s:%s] %s \u203a %s',
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: bot.options.host, color: "blue" },
|
||||
{ text: `${bot.options.port}`, color: "gold" },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: args.join(' '), color: "blue" },
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -53,13 +57,27 @@ module.exports = {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const component = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
with: [
|
||||
bot.options.serverName,
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
args.join(' ')
|
||||
]
|
||||
if (bot.options.private) {
|
||||
component = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: bot.options.serverName, color: "blue" },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: args.join(' '), color: "blue" },
|
||||
]
|
||||
}
|
||||
} else if (!bot.options.private) {
|
||||
component = {
|
||||
translate: '[%s:%s] %s \u203a %s',
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: bot.options.host, color: "blue" },
|
||||
{ text: `${bot.options.port}`, color: "gold" },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: args.join(' '), color: "blue" },
|
||||
]
|
||||
}
|
||||
}
|
||||
bot.bots.filter((eachBot) => {
|
||||
if (eachBot.options.serverName === "Savage Friends" && eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom) {
|
||||
@@ -0,0 +1,27 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'refillcore',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"rc",
|
||||
"refill",
|
||||
],
|
||||
description: 'refill the bots core',
|
||||
usages: [
|
||||
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
bot.core.move();
|
||||
bot.tellraw("@a", "Refilling core,...")
|
||||
},
|
||||
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
bot.core.move();
|
||||
bot.tellraw("@a", "Refilling core,...");
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,17 @@
|
||||
const CommandError = require('../util/command_error');
|
||||
const CommandError = require('../../util/command_error');
|
||||
module.exports = {
|
||||
name: 'test',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'Make me say something',
|
||||
usages: [
|
||||
"error stack <message>",
|
||||
"error message <message>",
|
||||
"message <message>"
|
||||
],
|
||||
data: {
|
||||
name: 'test',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'Make me say something',
|
||||
usages: [
|
||||
"error stack <message>",
|
||||
"error message <message>",
|
||||
"message <message>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
@@ -24,7 +26,6 @@ module.exports = {
|
||||
throw new CommandError(args.slice(2).join(' '));
|
||||
break
|
||||
}
|
||||
// throw new Error(args.slice(1).join(' '));
|
||||
break;
|
||||
case "message":
|
||||
bot.tellraw("@a", [
|
||||
@@ -1,14 +1,18 @@
|
||||
const CommandError = require('../util/command_error')
|
||||
const CommandError = require('../../util/command_error')
|
||||
const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, SlashCommandBuilder } = require('discord.js');
|
||||
const { request } = require('undici');
|
||||
module.exports = {
|
||||
name: 'urban',
|
||||
description:['urban dictionary'],
|
||||
aliases:['urbandictionary'],
|
||||
trustLevel: 0,
|
||||
usages: [
|
||||
"<definition>",
|
||||
],
|
||||
data: {
|
||||
name: 'urban',
|
||||
description: 'urban dictionary',
|
||||
aliases: [
|
||||
'urbandictionary'
|
||||
],
|
||||
trustLevel: 0,
|
||||
usages: [
|
||||
"<definition>",
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
@@ -1,14 +1,16 @@
|
||||
const CommandError = require('../util/command_error');
|
||||
const CommandError = require('../../util/command_error');
|
||||
const { request } = require('undici');
|
||||
module.exports = {
|
||||
name: 'weather',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'check the weather of cities',
|
||||
usages: [
|
||||
"<message>"
|
||||
],
|
||||
data: {
|
||||
name: 'weather',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'check the weather of cities',
|
||||
usages: [
|
||||
"<city/zipcode>"
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
@@ -16,7 +18,7 @@ module.exports = {
|
||||
const source = context.source;
|
||||
try {
|
||||
let component = [];
|
||||
const weather = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ')}`);
|
||||
const weather = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ')?.replaceAll(' ', ',')}`);
|
||||
const info = await weather.body.json();
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s%s (%s%s)\n%s: %s %s %s (%s %s %s)\n%s: %s\n%s: %s",
|
||||
@@ -40,7 +42,7 @@ module.exports = {
|
||||
{ text: "Wind speed" , color: config.colors.commands.primary },
|
||||
{ text: `${info.current.wind_kph}`, color: config.colors.integer },
|
||||
{ text: `kph`, color: config.colors.commands.secondary },
|
||||
{ text: `${info.current.wind_dir}`, color: config.colors.secondary },
|
||||
{ text: `${info.current.wind_dir}`, color: config.colors.commands.secondary },
|
||||
{ text: `${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 },
|
||||
@@ -0,0 +1,32 @@
|
||||
const wiki = require('wikipedia');
|
||||
const CommandError = require('../../util/command_error');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'wiki',
|
||||
description: 'wikipedia',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
'wikipedia'
|
||||
],
|
||||
usages:[
|
||||
"<article>"
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
const source = context.source;
|
||||
const args = context.arguments;
|
||||
const bot = context.bot;
|
||||
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.tellraw(`@a`, { text: 'Article not found!', color: 'dark_red' })
|
||||
} else {
|
||||
bot.tellraw(`@a`, `${error.toString()}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'refillcore',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"rc",
|
||||
"refill",
|
||||
],
|
||||
description: 'refill the bots core',
|
||||
usages: [
|
||||
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
bot.core.refill()
|
||||
bot.tellraw("@a", "Refilling core,...")
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
bot.core.refill();
|
||||
bot.tellraw("@a", "Refilling core,...");
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,20 @@
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const CommandError = require('../util/command_error');
|
||||
const CommandError = require('../../util/command_error');
|
||||
module.exports = {
|
||||
name: 'cloop',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
"commandloop"
|
||||
],
|
||||
description: 'run cloops',
|
||||
usages: [
|
||||
"add <interval> <command>",
|
||||
"remove <index>",
|
||||
"clear",
|
||||
"list",
|
||||
],
|
||||
data: {
|
||||
name: 'cloop',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
"commandloop"
|
||||
],
|
||||
description: 'run cloops',
|
||||
usages: [
|
||||
"add <interval> <command>",
|
||||
"remove <index>",
|
||||
"clear",
|
||||
"list",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
@@ -20,7 +22,8 @@ module.exports = {
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
switch (args[1]) {
|
||||
case 'add':
|
||||
if (parseInt(args[2]) === NaN) bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid interval', color: 'red' })
|
||||
if (isNaN(args[2])) throw new CommandError({ text: 'Invalid interval', color: 'red' })
|
||||
//bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid interval', color: 'red' })
|
||||
const interval = parseInt(args[2])
|
||||
const command = args.slice(3).join(' ');
|
||||
bot.cloop.add(command, interval)
|
||||
@@ -1,14 +1,17 @@
|
||||
const CommandError = require('../util/command_error');
|
||||
const CommandError = require('../../util/command_error');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
module.exports = {
|
||||
name: 'kick',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
],
|
||||
description: 'kick or crash players',
|
||||
usages: [
|
||||
"invalidstring <player>",
|
||||
],
|
||||
data: {
|
||||
name: 'kick',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
],
|
||||
description: 'kick or crash players',
|
||||
usages: [
|
||||
"invalidstring <player>",
|
||||
"item <player>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
@@ -1,14 +1,16 @@
|
||||
module.exports = {
|
||||
name: 'reconnect',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
"end",
|
||||
"recon",
|
||||
],
|
||||
description: 'reconnect the bot',
|
||||
usages: [
|
||||
data: {
|
||||
name: 'reconnect',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
"end",
|
||||
"recon",
|
||||
],
|
||||
description: 'reconnect the bot',
|
||||
usages: [
|
||||
|
||||
],
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
@@ -1,17 +1,23 @@
|
||||
const between = require('../util/between')
|
||||
const CommandError = require('../util/command_error')
|
||||
const between = require('../../util/between')
|
||||
const CommandError = require('../../util/command_error')
|
||||
module.exports = {
|
||||
name: 'tpr',
|
||||
description:['teleport to a random place'],
|
||||
trustLevel: 1,
|
||||
aliases:['rtp', 'teleportrandom', 'randomteleport'],
|
||||
usages:[""],
|
||||
data: {
|
||||
name: 'tpr',
|
||||
description: 'teleport to very fucked up coords',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
'rtp',
|
||||
'teleportrandom',
|
||||
'randomteleport'
|
||||
],
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
// const sender = context.source.player
|
||||
const args = context.arguments;
|
||||
const source = context.source
|
||||
// if (!source.player) return
|
||||
if (bot.options.isKaboom) {
|
||||
x = between(-30_000_000, 30_000_000)
|
||||
y = 100
|
||||
@@ -21,8 +27,6 @@ module.exports = {
|
||||
y = 100
|
||||
z = between(-4096, 4096);
|
||||
}
|
||||
// bot.tellraw("@a", `Randomly Teleported: ${sender.profile.name} to x:${x} y:${y} z:${z} `)
|
||||
// bot.core.run(`minecraft:tp ${sender.profile.name} ${x} ${y} ${z}`)
|
||||
if (args.slice(1).join(' ')) {
|
||||
bot.tellraw("@a", [
|
||||
{ text: 'Randomly Teleported: ', color: 'gray' },
|
||||
@@ -1,14 +1,16 @@
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
module.exports = {
|
||||
name: 'validate',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
"val"
|
||||
],
|
||||
description: 'validate through the bot',
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
data: {
|
||||
name: 'validate',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
"val"
|
||||
],
|
||||
description: 'validate through the bot',
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
@@ -31,7 +33,7 @@ module.exports = {
|
||||
if (roles?.some(role => role.name === `${config.discord.roles.trusted}`)) {
|
||||
bot.discord.message.reply('Valid trusted user')
|
||||
bot.chat.message(`Valid trusted user [${bot.discord.message.member.user.username}]`)
|
||||
} else if (roles?.some(role => role.name === `${config.discord.roles.owner}`)) {
|
||||
} else if (roles?.some(role => role.name === `${config.discord.roles.owner}` || role.name === `${config.discord.roles.fullAccess}`)) {
|
||||
bot.discord.message.reply('Valid Owner user')
|
||||
bot.chat.message(`Valid Owner User [${bot.discord.message.member.user.username}]`);
|
||||
}
|
||||
@@ -1,17 +1,19 @@
|
||||
const http = require('http');
|
||||
const https = require('https');
|
||||
const util = require('util');
|
||||
const fixansi = require('../util/ansi');
|
||||
const CommandError = require('../util/command_error')
|
||||
const fixansi = require('../../util/ansi');
|
||||
const CommandError = require('../../util/command_error')
|
||||
module.exports = {
|
||||
name: 'website',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
],
|
||||
description: 'look up website data',
|
||||
usages: [
|
||||
"<url>"
|
||||
],
|
||||
data: {
|
||||
name: 'website',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
],
|
||||
description: 'look up website data',
|
||||
usages: [
|
||||
"<url>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
@@ -65,7 +67,7 @@ module.exports = {
|
||||
fix = fixansi(ansi.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
// } catch (e) {
|
||||
@@ -85,7 +87,7 @@ module.exports = {
|
||||
fix = fixansi(ansi.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setTitle(`${this.datta.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
// bot.discord.message.reply('e');
|
||||
@@ -1,26 +0,0 @@
|
||||
const wiki = require('wikipedia')
|
||||
const CommandError = require('../util/command_error')
|
||||
const { EmbedBuilder } = require('discord.js')
|
||||
module.exports = {
|
||||
name: 'wiki',
|
||||
description:['wikipedia'],
|
||||
trustLevel: 0,
|
||||
aliases:['wikipedia'],
|
||||
usages:["<definition>"],
|
||||
async execute (context) {
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
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.tellraw(`@a`, { text: 'Definition not found!', color: 'dark_red' })
|
||||
} else {
|
||||
bot.tellraw(`@a`, `${error.toString()}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: '<command name>',
|
||||
trustLevel: 0, // trust levels: 0, 1, 2, 3, 4
|
||||
aliases: [
|
||||
""
|
||||
],
|
||||
description: '',
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
|
||||
},
|
||||
discordExecute (context) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,13 +5,18 @@ discord:
|
||||
token: "discord token here"
|
||||
prefix: "!"
|
||||
invite: "discord invite here"
|
||||
enabled: false
|
||||
roles:
|
||||
trusted: "trusted"
|
||||
admin: "admin"
|
||||
fullAccess: "full access"
|
||||
owner: "FNFBoyfriendBot Owner"
|
||||
|
||||
core:
|
||||
name: {"translate":"outOfMemory.message"}
|
||||
name: { text: "FNFBoyfriendBot Core", color: "#00FFFF" }
|
||||
itemName: { text: "FNFBoyfriendBot core item", color: "#00FFFF" }
|
||||
itemRefill: true
|
||||
# refilling core via item is buggy rn i recommend setting itemRefill to false for now
|
||||
area:
|
||||
start:
|
||||
x: 0
|
||||
@@ -22,7 +27,36 @@ core:
|
||||
y: 0
|
||||
z: 15
|
||||
|
||||
team:
|
||||
name: "FNFBoyfriendBot"
|
||||
suffix: {
|
||||
color: "dark_gray",
|
||||
translate: " [ %s ]",
|
||||
with: [
|
||||
{ color: "dark_red", text: "https://sus.red" }
|
||||
]
|
||||
}
|
||||
# make sure if nothing is set as the suffix it is set as { text: "" } as the packet reads "" as { text: "" }
|
||||
prefix: {
|
||||
color: "dark_gray",
|
||||
translate: "[%s: %s] ",
|
||||
with: [
|
||||
{ color: "aqua", text: "Prefix" },
|
||||
{ color: "dark_aqua", text: "!" }
|
||||
]
|
||||
}
|
||||
displayName: {
|
||||
translate: "%s%s%s",
|
||||
with: [
|
||||
{ color: "dark_blue", text: "FNF" },
|
||||
{ color: "dark_aqua", text: "Boyfriend" },
|
||||
{ color: "blue", text: "Bot" }
|
||||
]
|
||||
}
|
||||
# color HAS to come first before any components or it will break! dont ask why, its because of how nmp parses it
|
||||
|
||||
commandSetMessage: false
|
||||
# ^^ this is for when commands are ran in core
|
||||
|
||||
keys:
|
||||
trusted: "trusted key here"
|
||||
@@ -43,7 +77,6 @@ colors:
|
||||
|
||||
console:
|
||||
prefix: "c."
|
||||
filelogger: false
|
||||
|
||||
bots:
|
||||
- host: "localhost"
|
||||
@@ -51,6 +84,7 @@ bots:
|
||||
usernameGen: true
|
||||
version: "1.20.2"
|
||||
serverName: "localhost"
|
||||
private: false
|
||||
reconnectDelay: 6000
|
||||
channelId: "discord channel id here"
|
||||
logging: false
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
export default {
|
||||
data: {
|
||||
name: '<command name>',
|
||||
trustLevel: 0, // trust levels: 0, 1, 2, 3, 4
|
||||
aliases: [
|
||||
|
||||
],
|
||||
description: '',
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
|
||||
},
|
||||
discordExecute (context) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: '<command name>',
|
||||
trustLevel: 0, // trust levels: 0, 1, 2, 3, 4
|
||||
aliases: [
|
||||
""
|
||||
],
|
||||
description: '',
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
|
||||
},
|
||||
discordExecute (context) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
export default {
|
||||
data: {
|
||||
name: '<command name>',
|
||||
trustLevel: 0, // trust levels: 0, 1, 2, 3, 4
|
||||
aliases: [
|
||||
|
||||
],
|
||||
description: '',
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
|
||||
},
|
||||
discordExecute (context) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
function whatevername (bot, options, config, discordClient) {
|
||||
|
||||
}
|
||||
module.exports = whatevername
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = (bot, options, config, discordClient) => {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export default function () {
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
[]
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"bot": {
|
||||
"buildstring": {
|
||||
"version": "v6.0.7",
|
||||
"build":"1080",
|
||||
"codename":""
|
||||
},
|
||||
"source": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot/"
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
[{"player":"aaa"},{"player":"Parker2991"},{"player":"FNFBoyfriendBot"}]
|
||||
+6
-11
@@ -4,30 +4,25 @@ const loadModules = require('./util/loadModules');
|
||||
const js_yaml = require('js-yaml');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const checks = require('./util/checks');
|
||||
const { Client, GatewayIntentBits } = require('discord.js');
|
||||
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits;
|
||||
const discordClient = new Client({ intents: [Guilds, GuildMessages, MessageContent] });
|
||||
require('./util/checks')();
|
||||
|
||||
console.log('Starting FNFBoyfriendBot');
|
||||
checks();
|
||||
/*
|
||||
if (!fs.existsSync(path.join(__dirname, "../config.yml"))) {
|
||||
console.log("Config not found creating config from the default config");
|
||||
fs.copyFileSync(
|
||||
path.join(__dirname, "./data/default_config.yml"),
|
||||
path.join(__dirname, "../config.yml")
|
||||
)
|
||||
}
|
||||
*/
|
||||
process.stdout.write('\x1b]2;Starting FNFBoyfriendBot please wait,.....\x1b\x5c');
|
||||
|
||||
try {
|
||||
config = js_yaml.load(fs.readFileSync(path.join(__dirname, '../', 'config.yml')))
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
})
|
||||
|
||||
if (config.discord.enabled) discordClient.login(config.discord.token);
|
||||
const bots = [];
|
||||
for (const options of config.bots) {
|
||||
|
||||
+8
-4
@@ -1,5 +1,7 @@
|
||||
const readline = require('readline');
|
||||
function boot (bot, options, discordClient, config) {
|
||||
function boot (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
bot.on("packet.login", (data) => {
|
||||
if (bot.options.isCreayun) return
|
||||
if (new Date().getDay() === 5) {
|
||||
@@ -7,7 +9,9 @@ function boot (bot, options, discordClient, config) {
|
||||
} else {
|
||||
bot.chat.message('&9FNF&3Boyfriend&1Bot &fcreated by &4Parker&02991');
|
||||
}
|
||||
}) // &9 &3 &1
|
||||
})
|
||||
setInterval(() => {
|
||||
process.stdout.write(`\x1b]2; FNFBoyfriendBot | Time: ${new Date().toLocaleString("en-US",{timeZone: "America/CHICAGO"})} | \x1b\x5c`)
|
||||
}, 1000)
|
||||
}
|
||||
module.exports = boot;
|
||||
|
||||
|
||||
+46
-13
@@ -12,8 +12,11 @@ function tryParse (json) {
|
||||
return { text: '' }
|
||||
}
|
||||
}
|
||||
//what was changed??
|
||||
function chat (bot, options, config) {
|
||||
//what was changed?
|
||||
function chat (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
let ChatMessage
|
||||
bot.on('registry_ready', registry => {
|
||||
ChatMessage = loadPrismarineChat(registry)
|
||||
@@ -33,19 +36,19 @@ function chat (bot, options, config) {
|
||||
})
|
||||
switch (packet.type) {
|
||||
case 1:
|
||||
bot.emit('message', { translate: "chat.type.emote", with: [ sender, message ]})
|
||||
bot.emit('profilelessChat', { translate: "chat.type.emote", with: [ sender, message ]})
|
||||
break
|
||||
case 2:
|
||||
bot.emit('message', { translate: "commands.message.display.incoming", with: [ sender, message], color: "gray", italic: true })
|
||||
bot.emit('profilelessChat', { translate: "commands.message.display.incoming", with: [ sender, message], color: "gray", italic: true })
|
||||
break
|
||||
case 3:
|
||||
bot.emit('message', [{ translate: "commands.message.display.outgoing", with: [ sender, message ], color: "gray", italic: true }])
|
||||
bot.emit('profilelessChat', [{ translate: "commands.message.display.outgoing", with: [ sender, message ], color: "gray", italic: true }])
|
||||
break
|
||||
case 4:
|
||||
bot.emit('message', [message]);
|
||||
bot.emit('profilelessChat', [message]);
|
||||
break
|
||||
case 5:
|
||||
bot.emit('message', [{ translate: 'chat.type.announcement', with: [ sender, message ]}])
|
||||
bot.emit('profilelessChat', [{ translate: 'chat.type.announcement', with: [ sender, message ]}])
|
||||
break
|
||||
}
|
||||
tryParsingMessage(message, { senderName: sender, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
|
||||
@@ -56,16 +59,20 @@ function chat (bot, options, config) {
|
||||
bot.emit('player_chat', { plain: packet.plainMessage, unsigned, senderUuid: packet.senderUuid })
|
||||
switch (packet.type) {
|
||||
case 5:
|
||||
bot.emit('message', { translate: "chat.type.announcement", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
|
||||
bot.emit('playerChat', { translate: "chat.type.announcement", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
|
||||
break
|
||||
case 4:
|
||||
bot.emit('playerChat', unsigned);
|
||||
break
|
||||
case 3:
|
||||
bot.emit('message', { translate: "commands.message.display.outgoing", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
|
||||
bot.emit('playerChat', { translate: "commands.message.display.outgoing", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
|
||||
break
|
||||
case 2:
|
||||
bot.emit('message', { translate: "commands.message.display.incoming", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
|
||||
bot.emit('playerChat', { translate: "commands.message.display.incoming", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
|
||||
break
|
||||
case 1:
|
||||
bot.emit('playerChat', { translate: "chat.type.emote", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
|
||||
break
|
||||
default:
|
||||
bot.emit('message', unsigned)
|
||||
}
|
||||
tryParsingMessage(unsigned, { senderUuid: packet.senderUuid, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
|
||||
})
|
||||
@@ -82,11 +89,36 @@ function chat (bot, options, config) {
|
||||
return
|
||||
}
|
||||
|
||||
bot.emit('message', message)
|
||||
bot.emit('systemChat', message)
|
||||
|
||||
tryParsingMessage(message, { players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
|
||||
})
|
||||
|
||||
bot.on('packet.action_bar', (message) => {
|
||||
let parsedMessage = tryParse(message.text)
|
||||
bot.emit('actionBar', {
|
||||
translate: '[%s] %s',
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
{ text: "Action Bar", color: "light_purple" },
|
||||
parsedMessage
|
||||
]
|
||||
});
|
||||
})
|
||||
|
||||
bot.on('packet.boss_bar', (data) => {
|
||||
bot.emit('bossBar', {
|
||||
translate: '[%s | %s: %s] %s',
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
{ text: "Boss Bar", color: "dark_aqua" },
|
||||
{ text: "Action ID", color: "blue" },
|
||||
{ text: `${data.action}`, color: 'gold' },
|
||||
tryParse(data.title)
|
||||
]
|
||||
})
|
||||
})
|
||||
|
||||
function tryParsingMessage (message, data) {
|
||||
let parsed
|
||||
for (const parser of bot.chatParsers) {
|
||||
@@ -140,3 +172,4 @@ function chat (bot, options, config) {
|
||||
}
|
||||
}
|
||||
module.exports = chat;
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
const CommandSource = require('../util/command_source');
|
||||
module.exports = (bot, options, config) => {
|
||||
module.exports = (context) => {
|
||||
let ratelimit = 0;
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
bot.on("parsed_message", (data) => {
|
||||
if (data.type !== "minecraft:chat") return;
|
||||
const prefixes = config.prefixes;
|
||||
|
||||
+125
-14
@@ -1,12 +1,25 @@
|
||||
function core (bot, options, config) {
|
||||
const mcData = require('minecraft-data')('1.20.2');
|
||||
const nbt = require('prismarine-nbt');
|
||||
|
||||
function core (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
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 },
|
||||
refill () {
|
||||
|
||||
usePlacedCommandBlock: false,
|
||||
|
||||
chatRefill () {
|
||||
const pos = bot.core.position
|
||||
const { start, end } = bot.core.area
|
||||
|
||||
@@ -21,7 +34,68 @@ function core (bot, options, config) {
|
||||
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
|
||||
*/
|
||||
bot.chat.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)}'}`)
|
||||
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}`)
|
||||
},
|
||||
|
||||
itemRefill () {
|
||||
const pos = bot.core.position;
|
||||
const { start, end } = bot.core.area;
|
||||
const itemPosition = bot.core.itemPosition;
|
||||
|
||||
if (!pos) return;
|
||||
if (bot.options.useChat || bot.options.isCreayun || bot.options.isSavage) return;
|
||||
if (isNaN(pos.x + pos.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._client.write('set_creative_slot', {
|
||||
slot: 36,
|
||||
item: {
|
||||
present: true,
|
||||
itemId: mcData.itemsByName.repeating_command_block.id,
|
||||
itemCount: 1,
|
||||
nbtData: nbt.comp({
|
||||
BlockEntityTag: nbt.comp({
|
||||
CustomName: nbt.string(JSON.stringify(config.core.itemName))
|
||||
})
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
bot._client.write('block_dig', {
|
||||
status: 0,
|
||||
location: 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) {
|
||||
@@ -29,8 +103,19 @@ function core (bot, options, config) {
|
||||
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();
|
||||
}
|
||||
bot.core.refill()
|
||||
},
|
||||
|
||||
currentBlock () {
|
||||
@@ -64,23 +149,49 @@ function core (bot, options, config) {
|
||||
},
|
||||
|
||||
run (command) {
|
||||
const location = bot.core.currentBlock()
|
||||
if (!location) return
|
||||
if (bot.options.isSavage || bot.options.isCreayun || bot.options.useChat) {
|
||||
const location = bot.core.currentBlock();
|
||||
const itemPosition = bot.core.itemPosition;
|
||||
|
||||
if (!location) return;
|
||||
if (bot.options.isCreayun || bot.options.useChat || bot.options.isSavage) {
|
||||
return
|
||||
} else {
|
||||
bot._client.write('update_command_block', { command: command.substring(0, 32767), location, mode: 1, flags: 0b100 })
|
||||
bot.core.incrementCurrentBlock()
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
// if (bot.options.useChat ?? bot.options.isCreayun ?? bot.options.isSavage) return
|
||||
|
||||
if (bot.options.isSavage || bot.options.isCreayun) return
|
||||
bot.on('move', () => {
|
||||
// if (bot.options.isSavage) return
|
||||
bot.core.move(bot.position)
|
||||
// setTimeout(() => bot.core.run('say Hello, world!'), 1000)
|
||||
})
|
||||
|
||||
bot.on('packet.block_change', (data) => {
|
||||
// console.log('data pos ' + JSON.stringify(data.location))
|
||||
// console.log('core pos ' +JSON.stringify(bot.core.position));
|
||||
// if (data.type === 0) {
|
||||
// console.log('data pos ' + JSON.stringify(data.location));
|
||||
// console.log('core position ' + JSON.stringify(bot.core.position));
|
||||
// bot.core.refill();
|
||||
//}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = core;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
function command_loop (bot, options, config) {
|
||||
function command_loop (context) {
|
||||
const bot = context.bot;
|
||||
bot.cloop = {
|
||||
list: [],
|
||||
add (command, interval) {
|
||||
|
||||
@@ -3,7 +3,12 @@ const path = require('path');
|
||||
const CommandError = require('../util/command_error.js');
|
||||
const CommandSource = require('../util/command_source');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
async function command_manager (bot, options, config, discordClient) {
|
||||
|
||||
async function command_manager (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const options = context.options;
|
||||
bot.commandManager = {
|
||||
commands: {},
|
||||
commandlist: [],
|
||||
@@ -20,7 +25,7 @@ async function command_manager (bot, options, config, discordClient) {
|
||||
}
|
||||
} else if (!source?.sources?.discord && !source?.sources?.console) {
|
||||
if (!command || !command.execute)
|
||||
throw new CommandError({
|
||||
bot.tellraw("@a", {
|
||||
translate: "%s%s%s %s",
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
@@ -32,63 +37,72 @@ async function command_manager (bot, options, config, discordClient) {
|
||||
})
|
||||
} else if (source?.sources?.console && !source?.sources?.discord) {
|
||||
if (!command || !command.execute)
|
||||
bot.console.warn([
|
||||
{
|
||||
translate: 'command.unknown.command',
|
||||
color: "dark_red"
|
||||
},
|
||||
{
|
||||
text: "\n",
|
||||
},
|
||||
{
|
||||
text: `${commandName}`,
|
||||
color: "dark_red"
|
||||
},
|
||||
{
|
||||
translate: "command.context.here",
|
||||
color: "dark_red"
|
||||
}
|
||||
])
|
||||
bot.console.warn(bot.getMessageAsPrismarine({
|
||||
translate: "%s%s%s %s",
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ translate: "command.unknown.command", color: "red" },
|
||||
{ text: "\n" },
|
||||
{ text: `${commandName}` },
|
||||
{ translate: "command.context.here", color: "red" }
|
||||
]
|
||||
})?.toAnsi())
|
||||
}
|
||||
if (command?.trustLevel > 0) {
|
||||
const event = bot.discord.message;
|
||||
const roles = event?.member?.roles?.cache;
|
||||
if (command?.trustLevel === 1 && !source?.sources?.discord) {
|
||||
if (args.length === 0 && bot.validation.trusted && bot.validation.admin && bot.validation.owner && !source?.sources?.console) throw new CommandError({ text: "Please provide an trusted or an admin or an owner hash", color: "dark_red" })
|
||||
if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.admin && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted or admin or owner hash', color: 'dark_red' });
|
||||
} else if (command?.trustLevel === 1 && source?.sources.discord) {
|
||||
const hasRole = roles?.some(role => role.name === `${config.discord.roles.trusted}` || role.name === `${config.discord.roles.owner}`)
|
||||
|
||||
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
|
||||
break;
|
||||
case 1:
|
||||
if (source?.sources?.discord) {
|
||||
const hasRole = roles?.some(role => role.name === `${config.discord.roles.trusted}` || role.name === `${config.discord.roles.admin}` || role.name === `${config.discord.roles.fullAccess}` || role.name === `${config.discord.roles.owner}`)
|
||||
if (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!', color: "dark_red" })
|
||||
}
|
||||
if (command?.trustLevel === 2 && !source.sources.console) {
|
||||
if (args.length === 0 && bot.validation.admin && bot.validation.owner && !source.sources.console) throw new CommandError({ text: "Please provide an trusted or owner hash", color: 'dark_red' })
|
||||
if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted or owner hash', color: 'dark_red' });
|
||||
}
|
||||
if (command?.trustLevel === 3 && !source.sources.discord && !source.sources.console) {
|
||||
if (args.length === 0 && bot.validation.owner) throw new CommandError({ text: "Please provide an owner hash", color: "dark_red" })
|
||||
if (args[0] !== bot.validation.owner) throw new CommandError({ translate: 'Invalid owner hash', color: 'dark_red' })
|
||||
} else if (command?.trustLevel === 3 && source.sources.discord && !source.sources.console) {
|
||||
const hasRole = roles?.some(role => role.name === `${config.discord.roles.owner}`)
|
||||
if (!hasRole) throw new CommandError({ translate: 'You are not the owner!', color: "dark_red" })
|
||||
} else if (command?.trustLevel === 4 && !source.sources.console) {
|
||||
throw new CommandError({ text: 'This command can only be ran via console', color: "dark_red" });
|
||||
}
|
||||
} else if (!source?.sources.console) {
|
||||
if (args.length === 0) throw new CommandError({ text: "Please provide a trusted, admin or owner hash", color: "dark_red" });
|
||||
if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.admin && args[0] !== bot.validation.owner) throw new CommandError({ translate: 'Invalid trusted, admin or owner hash', color: 'dark_red' });
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (source?.sources?.discord) {
|
||||
const hasRole = roles?.some(role => role.name === `${config.discord.roles.admin}` || role.name === `${config.discord.roles.fullAccess}` ||role.name === `${config.discord.roles.owner}`)
|
||||
if (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!', color: "dark_red" })
|
||||
} else if (!source?.sources?.console) {
|
||||
if (args.length === 0) throw new CommandError({ text: "Please provide an admin or owner hash", color: 'dark_red' })
|
||||
if (args[0] !== bot.validation.admin && args[0] !== bot.validation.owner) throw new CommandError({ translate: 'Invalid admin or owner hash', color: 'dark_red' });
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (source?.sources?.discord) {
|
||||
const hasRole = roles?.some(role => role.name === `${config.discord.roles.owner}` || role.name === `${config.discord.roles.fullAccess}`)
|
||||
if (!hasRole) throw new CommandError({ translate: 'You are not the owner!', color: "dark_red" })
|
||||
} else if (!source?.sources?.console) {
|
||||
if (args.length === 0 && bot.validation.owner) throw new CommandError({ text: "Please provide an owner hash", color: "dark_red" })
|
||||
if (args[0] !== bot.validation.owner) throw new CommandError({ translate: 'Invalid owner hash', color: 'dark_red' })
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (!source?.sources?.console) {
|
||||
throw new CommandError({ text: 'This command can only be ran via console', color: "dark_red" })
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!command?.discordExecute && command && source?.sources?.discord) {
|
||||
throw new CommandError(`${command.name} command is not supported in discord!`)
|
||||
throw new CommandError(`${command.data.name} command is not supported in discord!`)
|
||||
} else if (command?.discordExecute && command && source?.sources?.discord) {
|
||||
return command.discordExecute({ bot, source, arguments: args, config, discordClient })
|
||||
} else if (!command?.execute && command && !source?.sources?.discord) {
|
||||
throw new CommandError(`${command.name} command is not supported in game!`)
|
||||
throw new CommandError(`${command.data.name} command is not supported in game!`)
|
||||
} else if (command?.execute && command && !source?.sources?.discord) {
|
||||
return command?.execute({ bot, source, arguments: args, config, discordClient });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error.stack)
|
||||
console.error(error)
|
||||
if (source?.sources?.discord && !source?.sources?.console) {
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.error}`)
|
||||
.setTitle(`${command?.name} command`)
|
||||
.setTitle(`${command?.data?.name} command`)
|
||||
.setDescription(`\`\`\`${error}\`\`\``)
|
||||
bot?.discord?.message?.reply({
|
||||
embeds: [
|
||||
@@ -100,7 +114,13 @@ async function command_manager (bot, options, config, discordClient) {
|
||||
if (bot.options.isSavage || bot.options.isCreayun) {
|
||||
bot.chat.message(`&4${error.message}`)
|
||||
} else {
|
||||
bot.tellraw("@a", error._message)
|
||||
if (error.toString().length > 256) {
|
||||
bot.tellraw("@a", error._message);
|
||||
} else if (error.toString().length < 256) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&')}`)
|
||||
} else {
|
||||
bot.tellraw("@a", error._message);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (bot.options.isSavage || bot.options.isCreayun) {
|
||||
@@ -120,20 +140,16 @@ async function command_manager (bot, options, config, discordClient) {
|
||||
|
||||
discordExecute(source, command) {
|
||||
const [commandName, ...args] = command.split(" ");
|
||||
if (source?.sources?.discord && !source.sources.console) {
|
||||
if (source?.sources?.discord && !source?.sources?.console) {
|
||||
return this.discordExecute(source, commandName, args)
|
||||
}
|
||||
},
|
||||
|
||||
register (command) {
|
||||
this.commands[command.name] = command
|
||||
if (command.aliases) {
|
||||
command.aliases.map((a) => (this.commands[a] = command));
|
||||
}
|
||||
},
|
||||
|
||||
unregister (command) {
|
||||
this.commands = {};
|
||||
register (command) {
|
||||
this.commands[command.data.name] = command
|
||||
if (command.data.aliases) {
|
||||
command.data.aliases.map((a) => (this.commands[a] = command));
|
||||
}
|
||||
},
|
||||
|
||||
getCommand (name) {
|
||||
@@ -145,20 +161,32 @@ async function command_manager (bot, options, config, discordClient) {
|
||||
},
|
||||
}
|
||||
|
||||
/*
|
||||
file loader ported from my discord bot SkiBot
|
||||
and edited to support mjs files and to support FNFBoyfriendBot's command format
|
||||
*/
|
||||
commandlist = [];
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, '../commands'))) {
|
||||
try {
|
||||
if (filename.endsWith('.mjs')) {
|
||||
let commands = await import(path.join(__dirname, '../commands', filename))
|
||||
bot.commandManager.register(commands.command);
|
||||
bot.commandManager.commandlist.push(commands.command);
|
||||
} if (filename.endsWith('.js')) {
|
||||
let commands = require(path.join(__dirname, '../commands', filename));
|
||||
bot.commandManager.register(commands);
|
||||
bot.commandManager.commandlist.push(commands);
|
||||
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('.mjs')) {
|
||||
let command = await import(filePath);
|
||||
bot.commandManager.register(command.default);
|
||||
bot.commandManager.commandlist.push(command.default);
|
||||
}
|
||||
if (filename.endsWith('.js')) {
|
||||
let command = require(filePath);
|
||||
bot.commandManager.register(command);
|
||||
bot.commandManager.commandlist.push(command);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load command ', filename, ':', error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load command ', filename, ':', error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+42
-11
@@ -1,7 +1,11 @@
|
||||
const CommandSource = require('../util/command_source');
|
||||
const prismarineChat = require('prismarine-chat')('1.20.2');
|
||||
function Console (bot, options, config) {
|
||||
let rateLimit = 0;
|
||||
|
||||
function Console (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
let ratelimit = 0;
|
||||
bot.console = {
|
||||
readline: null,
|
||||
server: 'all',
|
||||
@@ -19,7 +23,7 @@ function Console (bot, options, config) {
|
||||
})
|
||||
})
|
||||
},
|
||||
source: new CommandSource(bot.options.username, { console: true, discord: false }),
|
||||
source: new CommandSource(bot._client.username, { console: true, discord: false }),
|
||||
refreshLine (...args) {
|
||||
this.readline.output.write("\x1b[2K\r");
|
||||
console.log.apply(console, arguments);
|
||||
@@ -66,17 +70,44 @@ function Console (bot, options, config) {
|
||||
}
|
||||
}
|
||||
}
|
||||
bot.on('message', (message) => {
|
||||
rateLimit++
|
||||
setTimeout(() => {
|
||||
rateLimit--
|
||||
}, 1000)
|
||||
setInterval(() => ratelimit = 0, 1000 * 2);
|
||||
|
||||
bot.on('profilelessChat', (message) => {
|
||||
if (!options.logging) return;
|
||||
/* if (rateLimit > 100) {
|
||||
return
|
||||
}*/
|
||||
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
||||
})
|
||||
|
||||
bot.on('systemChat', (message) => {
|
||||
if (!options.logging) return;
|
||||
if (ratelimit > 15) return;
|
||||
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
||||
ratelimit++
|
||||
})
|
||||
|
||||
bot.on('playerChat', (message) => {
|
||||
if (!options.logging) return;
|
||||
if (ratelimit > 15) return;
|
||||
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
||||
ratelimit++
|
||||
})
|
||||
|
||||
bot.on('bossBar', (message) => {
|
||||
if (!options.logging) return;
|
||||
if (ratelimit > 10) return;
|
||||
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
||||
ratelimit++
|
||||
})
|
||||
|
||||
bot.on('actionBar', (message) => {
|
||||
if (!options.logging) return;
|
||||
if (ratelimit > 10) return
|
||||
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
||||
ratelimit++
|
||||
})
|
||||
}
|
||||
module.exports = Console;
|
||||
|
||||
+25
-10
@@ -1,13 +1,16 @@
|
||||
// TODO: Maybe move client creation elsepwhere
|
||||
const { Client, GatewayIntentBits, interaction } = require('discord.js')
|
||||
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits
|
||||
//const { Client, GatewayIntentBits, interaction } = require('discord.js')
|
||||
//const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits
|
||||
const fixansi = require('../util/ansi');
|
||||
const CommandSource = require('../util/command_source')
|
||||
|
||||
const client = new Client({ intents: [Guilds, GuildMessages, MessageContent] })
|
||||
//const client = new Client({ intents: [Guilds, GuildMessages, MessageContent] })
|
||||
const util = require('util')
|
||||
|
||||
function discord(bot, options, config, discordClient) {
|
||||
function discord (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const options = context.options;
|
||||
if (!options?.channelId) {
|
||||
bot.discord = {
|
||||
invite: config.discord?.invite
|
||||
@@ -39,7 +42,7 @@ function discord(bot, options, config, discordClient) {
|
||||
try {
|
||||
bot?.discord?.channel?.send(`\`\`\`ansi\n${discordQueue.join('\n').substring(0, 1984)}\n\`\`\``)
|
||||
} catch (error) {
|
||||
bot.console.warn(error.toString())
|
||||
console.error(error.toString())
|
||||
}
|
||||
discordQueue = []
|
||||
}, 2000)
|
||||
@@ -57,10 +60,22 @@ function discord(bot, options, config, discordClient) {
|
||||
sendDiscordMessage(e.message)
|
||||
}
|
||||
}
|
||||
bot.on('message', message => {
|
||||
sendComponent(message)
|
||||
|
||||
bot.on('profilelessChat', (message) => {
|
||||
sendComponent(message);
|
||||
})
|
||||
|
||||
bot.on('systemChat', (message) => {
|
||||
sendComponent(message);
|
||||
})
|
||||
|
||||
bot.on('playerChat', (message) => {
|
||||
sendComponent(message);
|
||||
})
|
||||
/* bot.on('message', message => {
|
||||
sendComponent(message)
|
||||
})*/
|
||||
|
||||
function messageCreate(message, source) {
|
||||
bot.discord.message = message;
|
||||
if (message.author.id === bot.discord.client.user.id) return
|
||||
@@ -70,7 +85,7 @@ function discord(bot, options, config, discordClient) {
|
||||
if (message.content.startsWith(config.discord.prefix)) { // TODO: Don't hardcode this
|
||||
const source = new CommandSource({
|
||||
profile: {
|
||||
name: message?.member?.displayName
|
||||
name: `${message?.member.nickname || message?.author.displayName}`
|
||||
}
|
||||
}, {
|
||||
discord: true,
|
||||
@@ -120,7 +135,7 @@ function discord(bot, options, config, discordClient) {
|
||||
}
|
||||
},
|
||||
{
|
||||
text: message?.member?.displayName
|
||||
text: `${message.member.nickname || message.author.displayName}`,
|
||||
},
|
||||
message.content
|
||||
]
|
||||
|
||||
@@ -3,7 +3,10 @@ const path = require("path");
|
||||
const { createGzip } = require("zlib");
|
||||
const readline = require('readline');
|
||||
const { Console } = require("console");
|
||||
function fileLogger(bot, options, message) {
|
||||
function fileLogger(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
const currentDate = new Date();
|
||||
const timestamp = `${currentDate.getFullYear()}-${(currentDate.getMonth() + 1)
|
||||
.toString()
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
function filter (bot, options, config, discordClient) {
|
||||
if (options.isSavage || options.isCreayun) return;
|
||||
// filter v6 (not to be confused with the bot version)
|
||||
bot.filter = {
|
||||
list () {
|
||||
try {
|
||||
return JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
|
||||
} catch (e) {
|
||||
console.log(e.stack)
|
||||
}
|
||||
},
|
||||
|
||||
add (ignoreCase, regexed, player) {
|
||||
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
|
||||
var arrayadd = { ignoreCase: ignoreCase, regexed: regexed, name: player }
|
||||
data.push(arrayadd);
|
||||
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data))
|
||||
this.doAll();
|
||||
},
|
||||
|
||||
remove (index) {
|
||||
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
|
||||
data.splice(index, 1);
|
||||
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data));
|
||||
},
|
||||
|
||||
clear () {
|
||||
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
|
||||
data = [];
|
||||
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data))
|
||||
},
|
||||
|
||||
doAll () {
|
||||
|
||||
}
|
||||
}
|
||||
bot.on('message', async (data) => {
|
||||
for (const filteredPlayer of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
|
||||
// for (const eachBot of bot.bots) {
|
||||
let player_completion = (await bot.tab_complete('deop ')).filter(_ => _.tooltip == undefined);
|
||||
player_completion.forEach(async (player) => {
|
||||
if (filteredPlayer.ignoreCase) {
|
||||
|
||||
} else {
|
||||
// if (player.match !== eachBot.players.find((players) => players.profile.name === filteredPlayer.name).profile.name) return;
|
||||
if (bot.players.find((players) => players.profile.name === player.match).profile.name === filteredPlayer.name === true) {
|
||||
|
||||
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => players.profile.name === filteredPlayer.name).profile.name}"]`);
|
||||
}
|
||||
}
|
||||
})
|
||||
if (filteredPlayer.ignoreCase) {
|
||||
|
||||
} else {
|
||||
// if (!eachBot.players.find((player) => players.profile.name === filteredPlayer.name)) return
|
||||
if (bot.players.find((players) => players.profile.name === JSON.parse(filteredPlayer.name)).gamemode !== 2) {
|
||||
// if (eachBot.players.find((player) => players.profile.name !== filteredPlayer.name)) return
|
||||
bot.core.run(`execute run gamemode adventure @a[name="${bot.players.find((player) => player.profile.name === filteredPlayer.name).profile.name}"]`);
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
})
|
||||
bot.on('parsed_message', (data) => {
|
||||
try {
|
||||
for (const filteredPlayer of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
|
||||
if (filteredPlayer.ignoreCase) {
|
||||
|
||||
|
||||
} else {
|
||||
if (bot?.players?.find((player) => player?.profile?.name === filteredPlayer.name)?.profile?.name === data?.sender?.profile?.name) {
|
||||
bot.core.run(`essentials:mute ${bot?.players?.find((player) => player?.profile?.name === filteredPlayer.name)?.uuid} 10y`);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
})
|
||||
}
|
||||
module.exports = filter;
|
||||
@@ -0,0 +1,37 @@
|
||||
const os = require('os');
|
||||
module.exports = (context) => {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
let timer;
|
||||
bot.memUsage = {
|
||||
enabled: false
|
||||
}
|
||||
|
||||
timer = setInterval(() => {
|
||||
component = {
|
||||
translate: "%s%s%s %s | %s: %s%s / %s%s | %s: %s%s / %s%s |",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "FNF", color: "dark_blue" },
|
||||
{ text: "Boyfriend", color: "dark_aqua" },
|
||||
{ text: "Bot", color: "blue" },
|
||||
{ text: "Memory Usage" },
|
||||
{ text: "Free Server Memory", color: config.colors.commands.primary },
|
||||
{ text: `${Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: "Bot Memory Usage", color: config.colors.commands.primary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576 )}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary }
|
||||
]
|
||||
}
|
||||
if (!bot.memUsage.enabled) return;
|
||||
bot.core.run(`minecraft:title @a[tag=!memusage] actionbar ${JSON.stringify(component)}`)
|
||||
}, 100)
|
||||
bot.on('end', () => {
|
||||
bot.memUsage.enabled = false;
|
||||
})
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
function player_list (bot, options, config) {
|
||||
function player_list (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
bot.players = []
|
||||
|
||||
bot.on('packet.player_info', async (packet) => {
|
||||
@@ -15,19 +18,20 @@ function player_list (bot, options, config) {
|
||||
action(entry)
|
||||
}
|
||||
}
|
||||
|
||||
bot.emit("player_info", packet);
|
||||
})
|
||||
|
||||
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
|
||||
if (!players.includes(player.uuid)) return
|
||||
|
||||
const a = player_completion.filter(_ => _.match == player.profile.name)
|
||||
if(a.length >= 1) {
|
||||
player.vanished = true
|
||||
if (a.length >= 1) {
|
||||
player.vanished = true;
|
||||
} else {
|
||||
bot.players = bot.players.filter(_ => _.uuid != player.uuid)
|
||||
bot.players = bot.players.filter(_ => _.uuid != player.uuid);
|
||||
bot.emit("player_left", player);
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -44,6 +48,11 @@ function player_list (bot, options, config) {
|
||||
displayName: undefined,
|
||||
vanished: false
|
||||
})
|
||||
if (entry.vanished) {
|
||||
bot.emit("player_vanished", entry);
|
||||
} else {
|
||||
bot.emit("player_joined", entry);
|
||||
}
|
||||
}
|
||||
|
||||
function initializeChat (entry) {
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
function position (bot, options, config) {
|
||||
bot.position = null
|
||||
function position (context) {
|
||||
const bot = context.bot;
|
||||
bot.position = null;
|
||||
|
||||
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
|
||||
}
|
||||
};
|
||||
|
||||
bot._client.write('teleport_confirm', { teleportId: packet.teleportId })
|
||||
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
const mc = require('minecraft-protocol');
|
||||
const usernameGen = require("../util/usernameGen");
|
||||
function reconnect (bot, options, config) {
|
||||
function reconnect (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
bot.on('end', () => {
|
||||
//bot = undefined;
|
||||
|
||||
bot._client.removeAllListeners();
|
||||
//client = undefined;
|
||||
//bot._client = undefined;
|
||||
if (bot.reconnectDelay < 0) return
|
||||
setTimeout(() => {
|
||||
if (options.usernameGen) {
|
||||
client = options.client ?? mc.createClient(options, bot.options.username = usernameGen(bot))
|
||||
client = options.client ?? mc.createClient(options, options.username = usernameGen(bot))
|
||||
} else {
|
||||
client = options.client ?? mc.createClient(options)
|
||||
}
|
||||
|
||||
+30
-17
@@ -1,4 +1,9 @@
|
||||
function selfcare (bot, options, config) {
|
||||
const sleep = require('../util/sleep');
|
||||
|
||||
function selfcare (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
let entityId;
|
||||
let permissionLevel = 2;
|
||||
let unmuted = false;
|
||||
@@ -12,9 +17,9 @@ function selfcare (bot, options, config) {
|
||||
let nickname = false;
|
||||
let login = false;
|
||||
let register = false;
|
||||
// You now have the tag: &8[&bPrefix&8: &3~&8]
|
||||
// You no longer have a tag
|
||||
bot.on('message', (message) => {
|
||||
let positionCount = 0;
|
||||
bot.vanished = true
|
||||
bot.on('systemChat', (message) => {
|
||||
const stringMessage = bot.getMessageAsPrismarine(message)?.toString();
|
||||
if (options.isSavage) {
|
||||
if (stringMessage === "Please, login with the command: /login <password>") login = true;
|
||||
@@ -27,17 +32,8 @@ function selfcare (bot, options, config) {
|
||||
|
||||
else if (stringMessage === "You're already logged in!") register = false;
|
||||
else if (stringMessage === "Successful login!") register = false;
|
||||
/*
|
||||
You're already logged in!
|
||||
Please, register to the server with the command: /register <password> <ConfirmPassword>
|
||||
Please, login with the command: /login <password>
|
||||
Successfully registered!
|
||||
Successful login!
|
||||
You already have registered this username!
|
||||
*/
|
||||
|
||||
} else if (options.isKaboom) {
|
||||
// const stringMessage = bot.getMessageAsPrismarine(message)?.toString();
|
||||
if (stringMessage === "Successfully enabled CommandSpy") commandSpy = true;
|
||||
else if (stringMessage === "Successfully enabled CommandSpy.") commandSpy = true;
|
||||
else if (stringMessage === "Successfully disabled CommandSpy") commandSpy = false;
|
||||
@@ -60,23 +56,40 @@ You already have registered this username!
|
||||
else if (stringMessage?.startsWith("Successfully set your username to ")) username = true
|
||||
else if (stringMessage === `You already have the username "${bot.username}"`) username = false
|
||||
else if (stringMessage === `You no longer have a nickname.`) nickname = false;
|
||||
else if (stringMessage.startsWith('Your nickname is now ')) nickname = true;
|
||||
else if (stringMessage?.startsWith('Your nickname is now ')) nickname = true;
|
||||
}
|
||||
})
|
||||
|
||||
bot.on('packet.entity_status', packet => {
|
||||
if (packet.entityId !== entityId || packet.entityStatus < 24 || packet.entityStatus > 28) return
|
||||
permissionLevel = packet.entityStatus - 24
|
||||
})
|
||||
|
||||
bot.on('packet.game_state_change', packet => {
|
||||
if (packet.reason !== 3) return // Reason 3 = Change Game Mode
|
||||
gameMode = packet.gameMode;
|
||||
});
|
||||
|
||||
bot.on("packet.game_state.change", packet => {
|
||||
if (packet.reason !== 4) return // checks if the bot is seeing the endcredits or died
|
||||
clientLock = packet.gameMode;
|
||||
})
|
||||
|
||||
bot.on("packet.position", (packet, position) => {
|
||||
if (options.isSavage || options.isCreayun) return
|
||||
positionCount++
|
||||
setTimeout(() => {
|
||||
positionCount--
|
||||
if (positionCount > 4) {
|
||||
bot.core.run('sudo * icu stop');
|
||||
} if (permissionLevel < 2 || gameMode !== 1) {
|
||||
bot._client.end('anti icu :3');
|
||||
}
|
||||
}, 1000)
|
||||
})
|
||||
|
||||
let timer;
|
||||
bot.on('packet.login', (packet) => {
|
||||
bot.on('packet.login', async (packet) => {
|
||||
entityId = packet.entityId;
|
||||
gameMode = packet.gameMode;
|
||||
clientLock = packet.gameMode;
|
||||
@@ -84,8 +97,8 @@ You already have registered this username!
|
||||
if (bot.options.isSavage && !bot.options.isKaboom && !bot.options.isCreayun) {
|
||||
if (login) bot.chat.command('login amogusissus');
|
||||
else if (register) bot.chat.command('register amogusissus amogusissus');
|
||||
// else if (permissionLevel < 2) bot.chat.command(`minecraft:op ${bot.options.username}`);
|
||||
else if (gameMode !== 1) bot.chat.command('minecraft:gamemode creative');
|
||||
else if (permissionLevel < 2) bot.chat.command(`minecraft:op ${bot.options.username}`);
|
||||
else if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 });
|
||||
} else if (bot.options.isCreayun && !bot.options.isKaboom && !bot.options.isSavage) {
|
||||
|
||||
@@ -96,7 +109,7 @@ You already have registered this username!
|
||||
else if (username) bot.chat.command(`username ${bot.options.username}`)
|
||||
else if (nickname) bot.chat.command(`nick off`)
|
||||
else if (!prefix) bot.chat.command(`prefix &8[&bPrefix&8: &3${config.prefixes[0]}&8]`);
|
||||
else if (!vanished) bot.chat.command(`essentials:vanish on`);
|
||||
else if (!vanished && bot.vanished) bot.chat.command(`essentials:vanish on`);
|
||||
else if (unmuted) bot.core.run(`essentials:mute ${bot.uuid}`);
|
||||
else if (!god) bot.core.run(`god ${bot.options.username} enable`);
|
||||
else if (!teleportToggle) bot.core.run(`tptoggle ${bot.options.username} disable`);
|
||||
|
||||
+15
-14
@@ -1,16 +1,17 @@
|
||||
module.exports = (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 = (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)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
const sleep = require('../util/sleep');
|
||||
|
||||
module.exports = (context) => {
|
||||
const bot = context.bot;
|
||||
const options = context.options;
|
||||
const config = context.config;
|
||||
|
||||
bot.on("packet.login", async () => {
|
||||
if (options.isKaboom) {
|
||||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
const crypto = require('crypto')
|
||||
function validation (bot, options, config) {
|
||||
function validation (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
setInterval(() => {
|
||||
bot.validation = {
|
||||
trusted: crypto.createHash('sha256').update(Math.floor(Date.now() / 1000) + config.keys.trusted).digest('hex').substring(0, 16),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user