forked from afspiegeling/NitoriBot
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
229f4c5664 | ||
|
|
37e19521a4 | ||
|
|
799b49569e | ||
|
|
c522270815 | ||
|
|
e92153bb81 | ||
|
|
25ee0ce1e4 | ||
|
|
b9ae2a3bf7 | ||
|
|
3a1d335753 | ||
|
|
668312461f | ||
|
|
18e2278ebd | ||
|
|
1fd50ab7fa | ||
|
|
6d43ecc249 | ||
|
|
7eadb4eccd | ||
|
|
59ab5966c4 | ||
|
|
697eed1616 | ||
|
|
ffbe6f72a8 | ||
|
|
124778fd4b | ||
|
|
e690e1006c | ||
|
|
2075f57443 | ||
|
|
2e50641297 | ||
|
|
3a5b5bdbbc | ||
|
|
122e8e7df0 | ||
|
|
23288717ab | ||
|
|
639a2b0eaa | ||
|
|
f60f5c4a15 | ||
|
|
572e09989c | ||
|
|
ad4f35bb4c | ||
|
|
e655f831d3 | ||
|
|
a140a2d12e | ||
|
|
8f61177250 | ||
|
|
ab87e748f9 | ||
|
|
ca45444dd5 | ||
|
|
ac2f59d14d | ||
|
|
ee887d5081 | ||
|
|
0a637e0c8f | ||
|
|
3344fc6e2e | ||
|
|
0aed4d7d7a | ||
|
|
831fda8607 |
+1
-6
@@ -1,9 +1,4 @@
|
||||
node_modules
|
||||
config.yml
|
||||
config.js
|
||||
.git
|
||||
src/modules/exploits.js
|
||||
logs/*
|
||||
src/data/filter.json
|
||||
data/filter.json
|
||||
prototyping-crap
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# FNFBoyfriendBot
|
||||
|
||||
some things were git ignored from the repo that are needed for some things to work so you gotta recreate them
|
||||
|
||||
|
||||
FNFBoyfriendBot is a minecraft java bot made for the server kaboom.pw
|
||||
|
||||
# Setup:
|
||||
1. make sure to have nodejs npm and git installed
|
||||
|
||||
2. run npm i
|
||||
|
||||
3. fix some modules and stuff
|
||||
|
||||
4. edit the config
|
||||
|
||||
5. node src
|
||||
|
||||
Generated
+904
-4146
File diff suppressed because it is too large
Load Diff
+10
-16
@@ -1,22 +1,16 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"cowsay": "^1.6.0",
|
||||
"cowsay2": "^2.0.4",
|
||||
"discord.js": "^14.11.0",
|
||||
"java-parser": "^2.3.2",
|
||||
"@tonejs/midi": "^2.0.28",
|
||||
"axios": "^1.8.2",
|
||||
"discord.js": "^14.17.3",
|
||||
"js-yaml": "^4.1.0",
|
||||
"json-stringify": "^1.0.0",
|
||||
"json5": "^2.2.3",
|
||||
"jvm": "^0.5.3",
|
||||
"man-db": "^1.0.3",
|
||||
"minecraft-data": "^3.36.1",
|
||||
"minecraft-protocol": "^1.47.0",
|
||||
"mojangson": "^2.0.4",
|
||||
"node-gyp": "^10.2.0",
|
||||
"prismarine-auth": "^2.2.0",
|
||||
"matrix-js-sdk": "^36.2.0",
|
||||
"minecraft-data": "^3.83.1",
|
||||
"minecraft-protocol": "^1.54.0",
|
||||
"prismarine-chat": "^1.10.1",
|
||||
"prismarine-registry": "^1.7.0",
|
||||
"wikipedia": "^2.1.2",
|
||||
"xml2js": "^0.6.2"
|
||||
"prismarine-registry": "^1.11.0",
|
||||
"request": "^2.88.2",
|
||||
"undici": "^7.3.0",
|
||||
"wikipedia": "^2.1.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)
|
||||
|
||||
}
|
||||
+46
-43
@@ -1,8 +1,9 @@
|
||||
const mc = require('minecraft-protocol')
|
||||
const { EventEmitter } = require('events')
|
||||
//require("events").EventEmitter.defaultMaxListeners = Infinity;
|
||||
EventEmitter.defaultMaxListeners = Infinity
|
||||
const util = require('util');
|
||||
const mc = require('minecraft-protocol');
|
||||
const { EventEmitter } = require('events');
|
||||
const ChatMessage = require("prismarine-chat");
|
||||
EventEmitter.defaultMaxListeners = Infinity;
|
||||
let disconnectCount = 0;
|
||||
|
||||
function createBot(options = {}, config) {
|
||||
const bot = new EventEmitter();
|
||||
bot.options = {
|
||||
@@ -12,60 +13,62 @@ function createBot(options = {}, config) {
|
||||
hideErrors: options.hideErrors ??= true, // HACK: Hide errors by default as a lazy fix to console being spammed with them
|
||||
};
|
||||
bot.options = options;
|
||||
const ChatMessage = require('prismarine-chat')(bot.options.version);
|
||||
// Create our client object, put it on the bot, and register some events
|
||||
bot.on('init_client', client => {
|
||||
client.on('packet', (data, meta) => {
|
||||
bot.emit('packet', data, meta)
|
||||
bot.emit('packet.' + meta.name, data)
|
||||
bot.emit('packet.' + meta.name, data);
|
||||
})
|
||||
|
||||
client.on('login', () => {
|
||||
bot.uuid = client.uuid
|
||||
bot.username = client.username
|
||||
client.on('login', (data) => {
|
||||
bot.uuid = client.uuid;
|
||||
bot.username = client.username;
|
||||
})
|
||||
client.on('disconnect', (data) => {
|
||||
bot.emit("disconnect", data)
|
||||
// bot.console.info(JSON.stringify(data))
|
||||
// bot?.discord?.channel?.send(util.inspect(data.reason))
|
||||
if (config.console.filelogger) {
|
||||
// bot?.console?.filelogging(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ` + '[Client Reconnect] ' + util.inspect(data.reason))
|
||||
|
||||
client.on("disconnect", (data) => {
|
||||
bot.console.warn(`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`);
|
||||
bot?.discord?.channel?.send(ChatMessage(bot._client.version).fromNotch(data.reason)?.toString());
|
||||
});
|
||||
|
||||
client.on("end", (reason) => {
|
||||
bot.emit("end", reason);
|
||||
disconnectCount++;
|
||||
});
|
||||
|
||||
client.on("error", (error) => {
|
||||
try {
|
||||
if (disconnectCount === 10) {
|
||||
bot.console.info("stopped logging disconnect messages for now...");
|
||||
bot?.discord?.channel?.send("stopped logging disconnect messages for now...");
|
||||
return;
|
||||
} else if (disconnectCount > 10) {
|
||||
return;
|
||||
} else {
|
||||
bot.console.warn(ChatMessage(bot._client.version).fromNotch(`§8[§bClient Reconnect§8]§r ${error.toString()}`)?.toAnsi());
|
||||
bot?.discord?.channel?.send(error.toString());
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
})
|
||||
client.on('end', reason => {
|
||||
bot.emit('end', reason);
|
||||
})
|
||||
});
|
||||
|
||||
client.on('error', error => {
|
||||
bot.console.warn(ChatMessage.fromNotch('§8[§bClient Reconnect§8]§r ')?.toAnsi() + util.inspect(error.toString()))
|
||||
// bot?.discord?.channel?.send(error.toString())
|
||||
if (config.console.filelogger) {
|
||||
// bot?.console?.filelogging(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ` + '[Client Reconnect] ' + util.inspect(error.toString()))
|
||||
}
|
||||
})
|
||||
|
||||
client.on("keep_alive", ({ keepAliveId }) => {
|
||||
bot.emit("keep_alive", { keepAliveId })
|
||||
})
|
||||
|
||||
client.on('kick_disconnect', (data) => {
|
||||
bot.emit("kick_disconnect", data.reason)
|
||||
bot.console?.warn(ChatMessage.fromNotch(`§8[§bClient Reconnect§8]§r `)?.toAnsi() + util.inspect(data.reason))
|
||||
bot?.discord?.channel?.send(util.inspect(data.reason))
|
||||
if (config.console.filelogger) {
|
||||
// bot?.console?.filelogging(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ` + '[Client Reconnect] ' + util.inspect(data.reason))
|
||||
}
|
||||
})
|
||||
client.on("kick_disconnect", (data) => {
|
||||
bot.console.warn(`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`);
|
||||
bot?.discord?.channel?.send(ChatMessage(bot._client.version).fromNotch(data.reason)?.toString());
|
||||
});
|
||||
|
||||
process.on("uncaughtException", (e) => {
|
||||
// console?.warn(e.stack)
|
||||
});
|
||||
|
||||
client.on("success", () => {
|
||||
disconnectCount = 0;
|
||||
});
|
||||
})
|
||||
|
||||
const client = options.client ?? new mc.createClient(options)
|
||||
const client = options.client ?? new mc.createClient(bot.options)
|
||||
bot._client = client
|
||||
bot.emit('init_client', client)
|
||||
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,55 @@
|
||||
const CommandError = require('../../util/command_error');
|
||||
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "kick",
|
||||
description: "kick a player from the server",
|
||||
aliases: [
|
||||
|
||||
],
|
||||
trustLevel: 2,
|
||||
usages: [
|
||||
"invalidstring",
|
||||
"item"
|
||||
]
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
|
||||
if (!args && !args[0] && !args[1] && !args[2]) return;
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "invalidstring":
|
||||
bot.exploits.crashes.invalidString(args[2]);
|
||||
bot.chat.message(`crashing ${args[2]}`)
|
||||
break;
|
||||
case "item":
|
||||
bot.exploits.kicks.item(args[2]);
|
||||
bot.chat.message(`kicking ${args[2]}`)
|
||||
break;
|
||||
default:
|
||||
throw new CommandError('invalid argument')
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
|
||||
if (!args && !args[0] && !args[1] && !args[2]) return;
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "invalidstring":
|
||||
bot.exploits.crashes.invalidString(args[1]);
|
||||
bot?.discord?.message?.reply(`crashing ${args[1]}`)
|
||||
break;
|
||||
case "item":
|
||||
bot.exploits.kicks.item(args[1]);
|
||||
bot?.discord?.message?.reply(`kicking ${args[1]}`)
|
||||
break;
|
||||
default:
|
||||
throw new CommandError('invalid argument')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "reconnect",
|
||||
aliases: [
|
||||
"end"
|
||||
],
|
||||
description: "reconnects the bot",
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
trustLevel: 2,
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
bot._client.end();
|
||||
bot.chat.message('reconnecting')
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
|
||||
bot._client.end();
|
||||
bot?.discord?.message?.reply('reconnecting');
|
||||
}
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
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",
|
||||
],
|
||||
execute (context) {
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
const source = context.source
|
||||
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' })
|
||||
const interval = parseInt(args[2])
|
||||
const command = args.slice(3).join(' ');
|
||||
bot.cloop.add(command, interval)
|
||||
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
|
||||
translate: 'Added \'%s\' with interval %s to the cloops',
|
||||
color: 'gray',
|
||||
with: [ command, { text: `${interval}`, color: 'gold' } ]
|
||||
})
|
||||
break
|
||||
case 'remove':
|
||||
if (parseInt(args[2]) === NaN) bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid index', color: 'red' })
|
||||
|
||||
const index = parseInt(args[2])
|
||||
|
||||
bot.cloop.remove(index)
|
||||
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
|
||||
translate: 'Removed cloop %s',
|
||||
color: 'gray',
|
||||
with: [ { text: `${index}`, color: 'gold' } ]
|
||||
})
|
||||
break
|
||||
case 'clear':
|
||||
bot.cloop.clear()
|
||||
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Cleared all cloops' })
|
||||
break
|
||||
case 'list':
|
||||
const component = []
|
||||
|
||||
const listComponent = []
|
||||
let i = 0
|
||||
for (const cloop of bot.cloop.list) {
|
||||
listComponent.push({
|
||||
translate: '%s \u203a %s (%s)',
|
||||
color: 'gray',
|
||||
with: [
|
||||
{ text: `${i}`, color: 'gold' },
|
||||
cloop.command,
|
||||
{ text: `${cloop.interval}`, color: 'gold'},
|
||||
]
|
||||
})
|
||||
listComponent.push('\n')
|
||||
i++
|
||||
}
|
||||
|
||||
listComponent.pop()
|
||||
|
||||
component.push({
|
||||
translate: 'Cloops (%s):',
|
||||
with: [ { text: `${bot.cloop.list.length}`, color: 'gold' } ]
|
||||
})
|
||||
component.push('\n')
|
||||
component.push(listComponent)
|
||||
if (bot.cloop.list.length === 0) {
|
||||
bot.tellraw(`@a[name="${source?.player.profile?.name}"]`, {
|
||||
translate: 'Cloops (%s):',
|
||||
color: 'gray',
|
||||
with: [ { text: `${bot.cloop.list.length}`, color: 'gold' } ]
|
||||
})
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)
|
||||
}
|
||||
break
|
||||
default:
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid action', color: 'red' })
|
||||
break
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
let Embed;
|
||||
switch (args[0]) {
|
||||
case "add":
|
||||
const interval = parseInt(args[1])
|
||||
const command = args.slice(2).join(' ')
|
||||
bot.cloop.add(command, interval)
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`Added ${command} with the interval ${interval} to the cloops`)
|
||||
bot?.discord?.message?.reply({ embeds: [Embed] })
|
||||
break;
|
||||
case "remove":
|
||||
var index = (args[1])
|
||||
if (parseInt(args[1]) === NaN) throw new CommandError("invalid index");
|
||||
bot.cloop.remove(index)
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`removed cloop ${index}`)
|
||||
bot?.discord?.message?.reply({ embeds: [Embed] })
|
||||
break
|
||||
case 'clear':
|
||||
bot.cloop.clear()
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`cleared cloops`)
|
||||
bot?.discord?.message?.reply({ embeds: [Embed] })
|
||||
break
|
||||
case 'list':
|
||||
const component = []
|
||||
const listComponent = []
|
||||
let i = 0
|
||||
for (const cloop of bot.cloop.list) {
|
||||
listComponent.push({
|
||||
translate: '%s \u203a %s (%s)',
|
||||
with: [
|
||||
`id ${i}`,
|
||||
cloop.command,
|
||||
cloop.interval
|
||||
]
|
||||
})
|
||||
listComponent.push('\n')
|
||||
i++
|
||||
}
|
||||
listComponent.pop()
|
||||
component.push({
|
||||
translate: 'Cloops (%s):',
|
||||
with: [ bot.cloop.list.length ]
|
||||
})
|
||||
component.push('\n')
|
||||
component.push(listComponent)
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(bot.getMessageAsPrismarine(component)?.toString())
|
||||
bot?.discord?.message?.reply({ embeds: [Embed] })
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'console',
|
||||
trustLevel: 4,
|
||||
aliases: [
|
||||
|
||||
],
|
||||
usages: [],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return;
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "server":
|
||||
case "svr":
|
||||
const servers = bot.bots.map(eachBot => eachBot.options.serverName);
|
||||
for (const eachBot of bot.bots) {
|
||||
if (args.slice(1).join(' ').toLowerCase() === 'all') {
|
||||
eachBot.console.server = 'all'
|
||||
bot.console.info("Set the console server to all");
|
||||
continue
|
||||
}
|
||||
const server = servers.find(server => server.toLowerCase().includes(args[1]))
|
||||
if (!server) {
|
||||
bot.console.info("Invalid server");
|
||||
return
|
||||
}
|
||||
bot.console.info(`Set the console server to ` + server);
|
||||
eachBot.console.server = server;
|
||||
}
|
||||
break
|
||||
case 'customchat':
|
||||
if (args[1] === 'off' || args[1] === 'false' || args[1] === 'disable') {
|
||||
bot.console.customChat.enabled = false
|
||||
bot.console.info('Custom Chat disabled');
|
||||
} if (args[1] === 'on' || args[1] === 'true' || args[1] === 'enable') {
|
||||
bot.console.customChat.enabled = true;
|
||||
bot.console.info('Custom Chat enabled');
|
||||
}
|
||||
break
|
||||
case 'say':
|
||||
if (!bot.console.customChat.enabled) {
|
||||
bot.commandManager.executeString(bot.console.source, `echo ${args.slice(1).join(' ')}`)
|
||||
} else if (bot.console.customChat.enabled) {
|
||||
if (args.slice(1).join(' ').startsWith('/')) {
|
||||
bot.chat.command(`${args.slice(1).join(' ').substring(1)}`)
|
||||
return;
|
||||
}
|
||||
bot.console.customChat.chat(args.slice(1).join(' '));
|
||||
}
|
||||
|
||||
break
|
||||
case "validate":
|
||||
case "validation":
|
||||
case "val":
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "owner":
|
||||
case "o":
|
||||
if (bot.console.customChat.enabled) {
|
||||
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":
|
||||
case "a":
|
||||
if (bot.console.customChat.enabled) {
|
||||
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
|
||||
} else if (!bot.console.customChat.enabled) {
|
||||
// bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
|
||||
}
|
||||
break
|
||||
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(' ')}`);
|
||||
} else if (!bot.console.customChat.enabled) {
|
||||
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`);
|
||||
}
|
||||
break
|
||||
default:
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
|
||||
}
|
||||
break
|
||||
case 'logging':
|
||||
case 'togglelogging':
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case 'on':
|
||||
case 'enable':
|
||||
case 'enabled':
|
||||
case 'true':
|
||||
if (bot.options.logging === true) {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is already enabled!`);
|
||||
} else {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is now enabled`);
|
||||
bot.options.logging = true;
|
||||
}
|
||||
break
|
||||
case 'off':
|
||||
case 'disable':
|
||||
case 'disabled':
|
||||
case 'false':
|
||||
if (bot.options.logging === false) {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is already disabled!`);
|
||||
} else {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is now disabled`);
|
||||
bot.options.logging = false;
|
||||
}
|
||||
break
|
||||
}
|
||||
break
|
||||
default:
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
const CommandError = require('../../util/command_error');
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'console',
|
||||
trustLevel: 4,
|
||||
description: "runs commands made for the bots console",
|
||||
aliases: [
|
||||
"c"
|
||||
],
|
||||
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;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return;
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "server":
|
||||
case "svr":
|
||||
const servers = bot.bots.map(eachBot => eachBot.options.serverName);
|
||||
for (const eachBot of bot.bots) {
|
||||
if (args.slice(1).join(' ').toLowerCase() === 'all') {
|
||||
eachBot.console.server = 'all'
|
||||
bot.console.info("Set the console server to all");
|
||||
continue
|
||||
}
|
||||
const server = servers.find(server => server.toLowerCase().includes(args[1]))
|
||||
if (!server) {
|
||||
bot.console.info("Invalid server");
|
||||
return
|
||||
}
|
||||
bot.console.info(`Set the console server to ` + server);
|
||||
eachBot.console.server = server;
|
||||
}
|
||||
break
|
||||
case 'say':
|
||||
bot.chat.send(args.slice(1).join(' '));
|
||||
break
|
||||
case "validate":
|
||||
case "validation":
|
||||
case "val":
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "owner":
|
||||
case "o":
|
||||
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
|
||||
break
|
||||
case "admin":
|
||||
case "a":
|
||||
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
|
||||
break
|
||||
case "trusted":
|
||||
case "t":
|
||||
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`);
|
||||
break
|
||||
default:
|
||||
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" })
|
||||
}
|
||||
break
|
||||
case 'logging':
|
||||
case 'togglelogging':
|
||||
case 'logtoconsole':
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case 'on':
|
||||
case 'enable':
|
||||
case 'enabled':
|
||||
case 'true':
|
||||
if (bot.options.logging === true) {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is already enabled!`);
|
||||
} else {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is now enabled`);
|
||||
bot.options.logging = true;
|
||||
}
|
||||
break
|
||||
case 'off':
|
||||
case 'disable':
|
||||
case 'disabled':
|
||||
case 'false':
|
||||
if (bot.options.logging === false) {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is already disabled!`);
|
||||
} else {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is now disabled`);
|
||||
bot.options.logging = false;
|
||||
}
|
||||
break
|
||||
}
|
||||
break
|
||||
default:
|
||||
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" })
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,78 +0,0 @@
|
||||
const cowsay = require('cowsay2');
|
||||
const cows = require('cowsay2/cows');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const fixansi = require('../util/ansi');
|
||||
module.exports = {
|
||||
name: 'cowsay',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'amogus',
|
||||
usages: [
|
||||
"just wait till the command is ready :3"
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
if (args[0]?.toLowerCase() === "list") {
|
||||
const list = Object.keys(cows);
|
||||
let content = [];
|
||||
let color = true;
|
||||
for (const value of list) {
|
||||
content.push([
|
||||
{
|
||||
text: value + ' ',
|
||||
color: (!((color = !color)) ? 'blue' : 'dark_blue'),
|
||||
}
|
||||
])
|
||||
}
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, content)
|
||||
} else if (cows[args[0]]) {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
|
||||
text: cowsay.say(args.slice(1).join(' '),
|
||||
{ cow: cows[args[0]] })
|
||||
})
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: cowsay.say(args.slice(0).join(' ')) })
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
let Embed
|
||||
if (args[0] === "list") {
|
||||
const list = Object.keys(cows);
|
||||
let content = [];
|
||||
let color = true;
|
||||
for (const value of list) {
|
||||
content.push([
|
||||
{
|
||||
text: value + ' ',
|
||||
}
|
||||
])
|
||||
}
|
||||
const ansiList = bot.getMessageAsPrismarine(content)?.toString();
|
||||
const fixAnsiList = fixansi(ansiList.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fixAnsiList}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
} else if (cows[args[0]]) {
|
||||
const ansiCow1 = bot.getMessageAsPrismarine({ text: cowsay.say(args.slice(1).join(' '), { cow: cows[args[0]] }) })?.toAnsi()
|
||||
const fixAnsiCow1 = fixansi(ansiCow1.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fixAnsiCow1}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
} else {
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${cowsay.say(args.slice(0).join(' '))}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
module.exports = {
|
||||
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(' ')
|
||||
if (message.startsWith('/')) {
|
||||
bot.chat.command(message.substring(1))
|
||||
return
|
||||
}
|
||||
// if
|
||||
bot.chat.message(message)
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
if (args.join(' ').startsWith('/')) {
|
||||
bot.chat.command(args.join(' ').substring(1))
|
||||
return
|
||||
}
|
||||
bot.chat.message(args.join(' '))
|
||||
}
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
const CommandError = require('../util/command_error');
|
||||
module.exports = {
|
||||
name: 'filter',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
],
|
||||
description: '',
|
||||
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":
|
||||
bot.filter.add(true, false, args.slice(2).join(' '))
|
||||
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,450 +0,0 @@
|
||||
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>",
|
||||
],
|
||||
execute (context) {
|
||||
const commandList = [];
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const args = context.arguments;
|
||||
const category = {
|
||||
translate: '(%s%s%s%s%s%s%s) \u203a ',
|
||||
bold: false,
|
||||
color: 'gray',
|
||||
with: [
|
||||
{ color: "aqua", text: 'Public'},
|
||||
{ color: "gray", text: ' | '},
|
||||
{ color: "dark_aqua", text: 'Trusted'},
|
||||
{ color: 'gray', text: ' | '},
|
||||
{ color: "blue", text: "Admin" },
|
||||
{ color: "gray", text: " | " },
|
||||
{ color: "dark_blue", text: 'Owner'},
|
||||
]
|
||||
}
|
||||
let public = [];
|
||||
let trusted = [];
|
||||
let admin = [];
|
||||
let owner = [];
|
||||
for (const command of bot.commandManager.commandlist) {
|
||||
let usagesComponent = [];
|
||||
let commandComponent = [];
|
||||
for (const usages of command.usages) {
|
||||
if (command?.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.usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.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.usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.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.usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.name}`, color: "blue" },
|
||||
{ text: `${command.usages.toString().replaceAll(',','')}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
}
|
||||
usagesComponent.push('\n');
|
||||
}
|
||||
usagesComponent.pop();
|
||||
commandComponent.push({
|
||||
translate: "%s %s %s\n%s %s %s\n%s %s %s\n%s %s %s\n%s %s",
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: "Command Name", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.name}`, color: "blue" },
|
||||
{ text: "Aliases", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.aliases.toString().replaceAll(',',' ')}`, color: "blue" },
|
||||
{ text: "Description", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.description}`, color: "blue" },
|
||||
{ text: "Trust Level", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.trustLevel}`, color: "gold" },
|
||||
{ text: "Usages", color: "dark_blue" },
|
||||
{ text: "\u203a" }
|
||||
]
|
||||
})
|
||||
commandComponent.push("\n");
|
||||
commandComponent.push(usagesComponent);
|
||||
for (const aliases of command.aliases) {
|
||||
if (args[0]?.toLowerCase() === command.name) {
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`);
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, commandComponent)
|
||||
}
|
||||
return;
|
||||
} if (args[0]?.toLowerCase() === aliases) {
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`)
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, commandComponent)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
if (command.trustLevel === 0) {
|
||||
public.push([
|
||||
{
|
||||
text: command.name + ' ',
|
||||
color: "aqua",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command:${command.name}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `${command.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.description}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.aliases}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'gray',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'run_command',
|
||||
value: `${config.prefixes[0]}${command?.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
} else if (command.trustLevel === 1) {
|
||||
trusted.push([
|
||||
{
|
||||
text: command.name + ' ',
|
||||
color: "dark_aqua",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command:${command.name}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `${command.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.description}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.aliases}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'gray',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'run_command',
|
||||
value: `${config.prefixes[0]}${command?.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
} else if (command.trustLevel === 2) {
|
||||
admin.push([
|
||||
{
|
||||
text: command.name + ' ',
|
||||
color: "blue",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action:"show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command:${command.name}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `${command.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.description}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.aliases}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'gray',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'run_command',
|
||||
value: `${config.prefixes[0]}${command?.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
} else if (command.trustLevel === 3) {
|
||||
owner.push([
|
||||
{
|
||||
text: command.name + ' ',
|
||||
color: "dark_blue",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command:${command.name}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `${command.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.description}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.aliases}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'gray',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'run_command',
|
||||
value: `${config.prefixes[0]}${command?.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
const length = bot.commandManager.commandlist.filter(c => c.trustLevel != 4).length
|
||||
if (bot.options.useChat) {
|
||||
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("§","&"))
|
||||
}, 300)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
|
||||
}, 300)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
|
||||
}, 300)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
|
||||
}, 300)
|
||||
} else if (bot.options.isSavage) {
|
||||
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("§","&"))
|
||||
}, 400)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
|
||||
}, 400)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
|
||||
}, 400)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
|
||||
}, 400)
|
||||
} else if (admin.length === 0) {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
{ text: 'Commands (', color: 'gray' },
|
||||
{ text: JSON.stringify(length), color: 'gold' },
|
||||
{ text: ') ', color: 'gray' },
|
||||
category,
|
||||
'\n',
|
||||
public,
|
||||
trusted,
|
||||
owner
|
||||
])
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
{ text: 'Commands (', color: 'gray' },
|
||||
{ text: JSON.stringify(length), color: 'gold' },
|
||||
{ text: ') ', color: 'gray' },
|
||||
category,
|
||||
'\n',
|
||||
public,
|
||||
trusted,
|
||||
admin,
|
||||
owner
|
||||
])
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const category = {
|
||||
translate: '(%s%s%s%s%s%s%s) \u203a ',
|
||||
bold: false,
|
||||
color: 'gray',
|
||||
with: [
|
||||
{ color: "aqua", text: 'Public'},
|
||||
{ color: "gray", text: ' | '},
|
||||
{ color: "dark_aqua", text: 'Trusted'},
|
||||
{ color: 'gray', text: ' | '},
|
||||
{ color: 'blue', text: 'Admin' },
|
||||
{ color: 'gray', text: ' | ' },
|
||||
{ color: "dark_blue", text: 'Owner'},
|
||||
]
|
||||
}
|
||||
let public = [];
|
||||
let trusted = [];
|
||||
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```')
|
||||
const fix = fixansi(ansi.replaceAll('`', '`\u200b'))
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
return
|
||||
}
|
||||
if (command?.trustLevel === 0) {
|
||||
public.push([
|
||||
{
|
||||
text: command.name + ' ',
|
||||
color: "aqua",
|
||||
}
|
||||
])
|
||||
} else if (command?.trustLevel === 1) {
|
||||
trusted.push([
|
||||
{
|
||||
text: command.name + ' ',
|
||||
color: "dark_aqua"
|
||||
}
|
||||
])
|
||||
} else if (command?.trustLevel === 2) {
|
||||
admin.push([
|
||||
{
|
||||
text: command.name + ' ',
|
||||
color: 'blue'
|
||||
}
|
||||
])
|
||||
} else if (command?.trustLevel === 3) {
|
||||
owner.push([
|
||||
{
|
||||
text: command.name + ' ',
|
||||
color: "dark_blue",
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
const length = bot.commandManager.commandlist.filter(c => c.trustLevel != 3).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`)
|
||||
.setDescription(`\`\`\`ansi\n${fix1}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
bot?.discord?.message.react('♋')
|
||||
}
|
||||
}
|
||||
@@ -1,386 +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':
|
||||
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: `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,44 +0,0 @@
|
||||
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>",
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
if (bot.options.useChat || bot.options.isSavage || bot.options.isCreayun) throw new CommandError('Cannot execute command due to smth in the config being enabled');
|
||||
|
||||
switch (args[1]) {
|
||||
case 'invalidstring':
|
||||
bot.exploits.crashes.invalidString(`${args.slice(2).join(' ')}`);
|
||||
break
|
||||
case 'item':
|
||||
bot.exploits.kicks.item(`${args.slice(2).join(' ')}`)
|
||||
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;
|
||||
if (bot.options.useChat || bot.options.isSavage || bot.options.isCreayun) throw new CommandError('Cannot execute command!');
|
||||
switch (args[0]) {
|
||||
case "invalidstring":
|
||||
bot.exploits.crashes.invalidString(`${args.slice(1).join(' ')}`)
|
||||
break
|
||||
case 'item':
|
||||
bot.exploits.kicks.item(`${args.slice(1).join(' ')}`)
|
||||
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.exit(69);
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
process.exit(69);
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
const CommandError = require('../util/command_error');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const fixansi = require('../util/ansi');
|
||||
module.exports = {
|
||||
name: 'list',
|
||||
description:['check the player list'],
|
||||
trustLevel: 0,
|
||||
aliases:['playerlist', 'plist', 'pl'],
|
||||
usages:[""],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
const players = bot.players
|
||||
const source = context.source
|
||||
const component = []
|
||||
for (const player of players) {
|
||||
component.push({
|
||||
translate: `%s \u203a %s [%s: %s %s %s: %s]`,
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
player.displayName ?? player.profile.name,
|
||||
{
|
||||
text: `${player.uuid}`,
|
||||
color: 'dark_blue',
|
||||
clickEvent: {
|
||||
action: 'copy_to_clipboard',
|
||||
value: `${player.uuid}`
|
||||
},
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
contents: [{
|
||||
text: 'click here to copy the player\'s uuid',
|
||||
color: 'aqua'
|
||||
}]
|
||||
}
|
||||
},
|
||||
{ text: `Ping`, color: 'dark_blue' },
|
||||
{ text: `${player.latency}`, color: 'gold' },
|
||||
{ text: '/', color: 'dark_gray' },
|
||||
{ text: `Gamemode`, color: 'dark_blue' },
|
||||
{ text: `${player.gamemode}`, color: 'gold' },
|
||||
]
|
||||
})
|
||||
component.push('\n')
|
||||
}
|
||||
component.pop()
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine([{ text: `Players: `, color:'gray' }, { text: '(' , color: 'gray' }, { text: `${JSON.stringify(bot.players.length)}`, color: 'gold' }, { text: ')\n', color: 'gray' }])?.toMotd().replaceAll('§','&')}`)
|
||||
setTimeout(() => {
|
||||
for (const player of bot.players) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine([player.displayName ?? player.profile.name, ' &8', player.uuid,` &r&8[&2Ping: &6${player.latency}&8 / &5Gamemode: &6${player.gamemode}&8]`]).toMotd().replaceAll('§', '&')}`)
|
||||
}
|
||||
}, 300)
|
||||
} else if (bot.options.isKaboom) {
|
||||
bot.tellraw(`@a[name="${source.player.profile.name}"]`, [
|
||||
{ text: `Players`, color: 'dark_blue' },
|
||||
{ text: ': ', color: 'dark_gray' },
|
||||
{ text: '(' , color: 'dark_gray' },
|
||||
{ text: `${JSON.stringify(bot.players.length)}`, color: 'gold' },
|
||||
{ text: ')\n', color: 'dark_gray' },
|
||||
component
|
||||
])
|
||||
}
|
||||
},
|
||||
discordExecute(context) {
|
||||
const bot = context.bot
|
||||
const players = bot.players
|
||||
const component = []
|
||||
for (const player of players) {
|
||||
component.push({
|
||||
translate: `%s \u203a %s [%s %s %s %s %s]`,
|
||||
with: [
|
||||
player.displayName ?? player.profile.name,
|
||||
player.uuid,
|
||||
{ text: `Ping:`, color: 'dark_green' },
|
||||
{ text: `${player.latency}`, color: 'gold' },
|
||||
{ text: '/', color: 'gray' },
|
||||
{ text: `Gamemode:`, color: 'dark_purple' },
|
||||
{ text: `${player.gamemode}`, color: 'gold' },
|
||||
]
|
||||
})
|
||||
component.push('\n')
|
||||
}
|
||||
component.pop()
|
||||
const ansi = bot.getMessageAsPrismarine([{ text: `Players: `, color:'gray' }, { text: '(' , color: 'gray' }, { text: `${JSON.stringify(bot.players.length)}`, color: 'gold' }, { text: ')\n', color: 'gray' }, component])?.toAnsi()
|
||||
const fix = fixansi(ansi.replaceAll('`', '`\u200b'))
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
const { request } = require('undici');
|
||||
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>",
|
||||
],
|
||||
async execute (context) {
|
||||
const bot = context.bot;
|
||||
const discordClient = context.discordClient;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
try {
|
||||
const [host, port] = args[0].split(':')
|
||||
const server = await mc.ping({ host, port: Number(port ?? 25565) })
|
||||
component.push({
|
||||
translate: '%s %s %s:%s\n%s %s %s / %s\n%s %s %s\n%s %s %s',
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
{ text: 'Ip', color: 'dark_blue' },
|
||||
{ text: '\u203a' },
|
||||
{ text: `${host}`, color: 'dark_blue' },
|
||||
{ text: `${Number(port ?? 25565)}`, color: 'gold' },
|
||||
{ text: 'Players', color: 'dark_blue' },
|
||||
{ text: '\u203a' },
|
||||
{ text: `${server.players.online}`, color: 'gold' },
|
||||
{ text: `${server.players.max}`, color: 'gold' },
|
||||
{ text: 'Version', color: 'dark_blue' },
|
||||
{ text: '\u203a' },
|
||||
{ text: `${server.version.name}`, color: 'blue' },
|
||||
{ text: 'Motd', color: 'dark_blue' },
|
||||
{ text: '\u203a' },
|
||||
server.description
|
||||
]
|
||||
})
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component);
|
||||
/* bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
{
|
||||
text: `Ip \u203a ${host}:${Number(port ?? 25565)}\n`,
|
||||
color: 'gray',
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
contents: [{
|
||||
text: 'click here for the servers ip',
|
||||
color: 'gray'
|
||||
}]
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'copy_to_clipboard',
|
||||
value: `${host}:${Number(port ?? 25565)}`
|
||||
}
|
||||
},
|
||||
{
|
||||
text: `Players \u203a `,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `${server.players.online}`,
|
||||
color: "gold"
|
||||
},
|
||||
{
|
||||
text: ' / ',
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `${server.players.max}\n`,
|
||||
color: "gold"
|
||||
},
|
||||
{
|
||||
text: `Version \u203a ${server.version.name}\n`,
|
||||
color: 'gray',
|
||||
},
|
||||
{
|
||||
text: "Motd \u203a\n",
|
||||
color: 'gray',
|
||||
},
|
||||
server.description,
|
||||
])*/
|
||||
} catch (e) {
|
||||
bot.chat.message(`${e.toString()}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
const CommandError = require('../util/command_error.js')
|
||||
module.exports = {
|
||||
name: 'netmsg',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
|
||||
],
|
||||
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 {
|
||||
component = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: bot.options.serverName, color: "gray" },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: args.join(' '), color: "gray" },
|
||||
]
|
||||
}
|
||||
}
|
||||
bot.bots.filter((eachBot) => {
|
||||
if (eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom || eachBot.options.isCreayun && !eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom) {
|
||||
eachBot.chat.message(`[${bot.options.serverName}] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} \u203a ${args.join(' ')}`)
|
||||
} else if (!eachBot.options.serverName !== "Savage Friends" && !eachBot.options.isSavage && !eachBot.options.useChat && eachBot.options.isKaboom) {
|
||||
eachBot.tellraw("@a", component);
|
||||
} else if (!eachBot.options.serverName !== "Savage Friends" && !eachBot.options.isSavage && eachBot.options.useChat && eachBot.options.isKaboom) {
|
||||
eachBot.chat.message(`&7[&7${bot.options.serverName}&7] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} &7\u203a ${args.join(' ')}`)
|
||||
} else if (eachBot.options.useChat && !eachBot.options.isSavage) {
|
||||
// eachBot.chat.message(bot.getMessageAsPrismarine(`[${bot.options.host}:${bot.options.port}] ${source.player.displayName ?? source.player.profile.name} \u203a ${args.join(' ')}`)?.toMotd().replaceAll('§','&'))
|
||||
eachBot.chat.message(`&7[&7${bot.options.serverName}&7] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} &7\u203a ${args.join(' ')}`)
|
||||
} else if (!eachBot.options.useChat && !eachBot.options.isSavage) {
|
||||
eachBot.tellraw("@a", component);
|
||||
}
|
||||
})
|
||||
},
|
||||
discordExecute (context) {
|
||||
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(' ')
|
||||
]
|
||||
}
|
||||
bot.bots.filter((eachBot) => {
|
||||
if (eachBot.options.serverName === "Savage Friends" && eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom) {
|
||||
eachBot.chat.message(`[${bot.options.serverName}] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} \u203a ${args.join(' ')}`)
|
||||
} else if (!eachBot.options.serverName !== "Savage Friends" && !eachBot.options.isSavage && !eachBot.options.useChat && eachBot.options.isKaboom) {
|
||||
eachBot.tellraw("@a", component);
|
||||
} else if (!eachBot.options.serverName !== "Savage Friends" && !eachBot.options.isSavage && eachBot.options.useChat && eachBot.options.isKaboom) {
|
||||
eachBot.chat.message(`&7[&7${bot.options.serverName}&7] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} &7\u203a ${args.join(' ')}`)
|
||||
} else if (eachBot.options.useChat && !eachBot.options.isSavage) {
|
||||
eachBot.chat.message(`&7[&7${bot.options.serverName}&7] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} &7\u203a ${args.join(' ')}`)
|
||||
} else if (!eachBot.options.useChat && !eachBot.options.isSavage) {
|
||||
eachBot.tellraw("@a", component);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'kill',
|
||||
trustLevel: 4,
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
const CommandError = require('../../util/command_error.js');
|
||||
const { stylize } = require('../../util/stylizeEval');
|
||||
const util = require('util');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'servereval',
|
||||
trustLevel: 4,
|
||||
aliases: [
|
||||
"se"
|
||||
],
|
||||
description: 'run code unisolated',
|
||||
usages: [
|
||||
"<code>",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const args = context.arguments;
|
||||
const script = args.slice(1).join(' ');
|
||||
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
|
||||
try {
|
||||
if (source.sources.console) {
|
||||
bot.console.log(bot.getMessageAsPrismarine({ text: util.inspect(eval(args.join(' ')), { stylize })})?.toAnsi())
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(`minecraft:tellraw @a ${JSON.stringify(util.inspect(eval(script), { stylize }).substring(0, 32700))}`)
|
||||
// bot.tellraw('@a', `${util.inspect(eval(script), { stylize }).substring(0, 32700)}`);
|
||||
// bot.chat.message(bot.getMessageAsPrismarine({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })?.toMotd().replaceAll('§','&'))
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source.player.profile.name}"]`, {
|
||||
text: `${util.inspect(eval(script), { stylize }).substring(0, 32700)}`
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
throw new CommandError(e.toString())
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
try {
|
||||
bot?.discord?.message?.reply(`\`\`\`js\n${util.inspect(eval(args.join(' '))).toString().substring(0, 1980)}\`\`\``);
|
||||
} catch (e) {
|
||||
throw new CommandError(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "core",
|
||||
aliases: [
|
||||
"cb",
|
||||
"cbrun",
|
||||
"corerun"
|
||||
],
|
||||
trustLevel: 0,
|
||||
description: "run commands in core",
|
||||
usages: [
|
||||
"<message>"
|
||||
]
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(args.join(' '));
|
||||
} else if (bot.options.mode === "kaboom") {
|
||||
bot.core.runTracked(args.join(' '));
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(args.join(' '));
|
||||
} else if (bot.options.mode === "kaboom") {
|
||||
bot.core.runTracked(args.join(' '));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'echo',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"say",
|
||||
"botsay",
|
||||
],
|
||||
description: 'Make me say something',
|
||||
usages: [
|
||||
"<message>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
bot.chat.send(args.join(' '));
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
if (args.includes("@everyone") || args.includes("@here")) {
|
||||
bot.discord.message.reply("go fuck yourself");
|
||||
} else {
|
||||
bot.discord.message.channel.send(args.join(' '));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
function commandListComponent (commands, config, public, trusted, admin, owner, Console) {
|
||||
switch (commands.data.trustLevel) {
|
||||
case 0:
|
||||
public.push({
|
||||
text: commands.data.name + ' ',
|
||||
color: config.colors.help.public,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Command Name", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
|
||||
{ text: "Trust Level", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
|
||||
{ text: "Description", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.aliases}`, color: config.colors.commands.secondary },
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.usages}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 1:
|
||||
trusted.push({
|
||||
text: commands.data.name + ' ',
|
||||
color: config.colors.help.trusted,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Command Name", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
|
||||
{ text: "Trust Level", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
|
||||
{ text: "Description", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.aliases}`, color: config.colors.commands.secondary },
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.usages}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 2:
|
||||
admin.push({
|
||||
text: commands.data.name + ' ',
|
||||
color: config.colors.help.admin,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Command Name", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
|
||||
{ text: "Trust Level", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
|
||||
{ text: "Description", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.aliases}`, color: config.colors.commands.secondary },
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.usages}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
owner.push({
|
||||
text: commands.data.name + ' ',
|
||||
color: config.colors.help.owner,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Command Name", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
|
||||
{ text: "Trust Level", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
|
||||
{ text: "Description", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.aliases}`, color: config.colors.commands.secondary },
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.usages}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 4:
|
||||
Console.push({
|
||||
text: commands.data.name + ' ',
|
||||
color: config.colors.help.console,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Command Name", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
|
||||
{ text: "Trust Level", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
|
||||
{ text: "Description", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.aliases}`, color: config.colors.commands.secondary },
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.usages}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bot.chat.message(`fuck you ${commands.data.name} has a invalid trust level`);
|
||||
};
|
||||
}
|
||||
|
||||
function infoComponents (commands, config, infoComponent, usagesComponent) {
|
||||
for (const usages of commands.data.usages) {
|
||||
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
|
||||
{ text: `${usages}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
});
|
||||
|
||||
usagesComponent.push('\n');
|
||||
|
||||
};
|
||||
|
||||
infoComponent.push({
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s:\n",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Name", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.aliases.toString().replaceAll(',',' ')}`, color: config.colors.commands.secondary },
|
||||
{ text: "Description", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
|
||||
{ text: "Trust Level", color: config.colors.commands.primary },
|
||||
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
]
|
||||
});
|
||||
|
||||
infoComponent.push(usagesComponent);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "help",
|
||||
description: "see the list of commands",
|
||||
aliases: [
|
||||
"heko",
|
||||
"?",
|
||||
"cmds",
|
||||
"commands",
|
||||
"hell",
|
||||
],
|
||||
usages: [
|
||||
"<command>"
|
||||
],
|
||||
trustLevel: 0,
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
|
||||
let component = [];
|
||||
let infoComponent = [];
|
||||
let usagesComponent = [];
|
||||
let public = [];
|
||||
let trusted = [];
|
||||
let admin = [];
|
||||
let owner = [];
|
||||
let Console = [];
|
||||
|
||||
component.push({
|
||||
translate: "%s: (%s) \u203a\n",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Commands", color: config.colors.commands.secondary },
|
||||
{ text: `${bot.commandManager.commandlist.length}`, color: config.colors.integer },
|
||||
]
|
||||
});
|
||||
for (const commands of bot.commandManager.commandlist) {
|
||||
commandListComponent(commands, config, public, trusted, admin, owner, Console);
|
||||
|
||||
if (args[0] === commands.data.name) {
|
||||
infoComponents(commands, config, infoComponent, usagesComponent);
|
||||
bot.tellraw(`@a`, infoComponent);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (public.length > 0) {
|
||||
component.push(public);
|
||||
}
|
||||
|
||||
if (trusted.length > 0) {
|
||||
component.push(trusted);
|
||||
}
|
||||
|
||||
if (admin.length > 0) {
|
||||
component.push(admin);
|
||||
}
|
||||
|
||||
if (owner.length > 0) {
|
||||
component.push(owner);
|
||||
}
|
||||
|
||||
|
||||
if (source.sources.console) {
|
||||
component.push(Console);
|
||||
}
|
||||
bot.tellraw("@a", component);
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const fixansi = context.fixansi;
|
||||
const args = context.arguments;
|
||||
let infoComponent = [];
|
||||
let usagesComponent = [];
|
||||
let public = [];
|
||||
let trusted = [];
|
||||
let admin = [];
|
||||
let owner = [];
|
||||
let Console = [];
|
||||
let component = [];
|
||||
|
||||
component.push({
|
||||
translate: "%s: (%s) \u203a\n",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Commands", color: config.colors.commands.secondary },
|
||||
{ text: `${bot.commandManager.commandlist.length}`, color: config.colors.integer },
|
||||
]
|
||||
});
|
||||
|
||||
for (const commands of bot.commandManager.commandlist) {
|
||||
commandListComponent(commands, config, public, trusted, admin, owner, Console);
|
||||
|
||||
if (args[0] === commands.data.name) {
|
||||
infoComponents(commands, config, infoComponent, usagesComponent);
|
||||
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(infoComponent)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
component.push(public);
|
||||
component.push(trusted);
|
||||
component.push(admin);
|
||||
component.push(owner);
|
||||
|
||||
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,397 @@
|
||||
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 { 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`))
|
||||
}
|
||||
|
||||
function componentPush (bot, args, config, discordClient, source, component) {
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "about":
|
||||
component.push({
|
||||
text: `FNFBoyfriendBot is a kaboom bot created by Parker2991\nThe source code and changelog can be found here ${botInfo.buildstring.url}`,
|
||||
color: `${config.colors.commands.primary}`,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{ text: "click here to view bots source code", color: `${config.colors.commands.primary}` }
|
||||
]
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `${botInfo.buildstring.url}`
|
||||
}
|
||||
})
|
||||
break;
|
||||
case "config":
|
||||
if (bot.options.isKaboom) {
|
||||
mode = "Kaboom";
|
||||
} if (bot.options.useChat && bot.options.isKaboom) {
|
||||
mode = "Kaboom/Coreless";
|
||||
} if (bot.options.isSavage) {
|
||||
mode = "Savage";
|
||||
} if (bot.options.isCreayun) {
|
||||
mode = "Creayun";
|
||||
}
|
||||
switch (args.slice(1).join(' ')?.toLowerCase()) {
|
||||
case "client":
|
||||
component.push({
|
||||
translate: "%s: %s:%s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.host}`, color: config.colors.commands.secondary },
|
||||
{ text: `${bot.options.port}`, color: config.colors.integer },
|
||||
{ text: "Server Name", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.serverName}`, color: config.colors.commands.secondary },
|
||||
{ text: "Minecraft Username", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.username}`, color: config.colors.commands.secondary },
|
||||
{ text: "Version", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.version}`, color: config.colors.integer },
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "discord":
|
||||
if (!config.discord.enabled || discordClient.user === null) {
|
||||
throw new CommandError('Token is incorrect or discord isnt enabled!')
|
||||
} else {
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Discord Username", color: config.colors.commands.primary },
|
||||
{ text: `${discordClient.user.tag}`, color: config.colors.commands.secondary },
|
||||
{ text: "Discord Channel", color: config.colors.commands.primary },
|
||||
{ text: `${bot.discord?.channel?.name}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
}
|
||||
break;
|
||||
case "options":
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server Count", color: config.colors.commands.primary },
|
||||
{ text: `${bot.bots.length}`, color: config.colors.integer },
|
||||
{ text: "Prefixes", color: config.colors.commands.primary },
|
||||
{ text: `${config.prefixes.map((e) => e + " ").join(' ')}`, color: config.colors.commands.secondary },
|
||||
{ text: "Mode", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.mode}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "all":
|
||||
component.push({
|
||||
translate: "%s: %s:%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.host}`, color: config.colors.commands.secondary },
|
||||
{ text: `${bot.options.port}`, color: config.colors.integer },
|
||||
{ text: "Server Name", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.serverName}`, color: config.colors.commands.secondary },
|
||||
{ text: "Minecraft Username", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.username}`, color: config.colors.commands.secondary },
|
||||
{ text: "Version", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.version}`, color: config.colors.commands.secondary },
|
||||
{ text: "Discord Username", color: config.colors.commands.primary },
|
||||
{ text: `${discordClient.user?.tag}`, color: config.colors.commands.secondary },
|
||||
{ text: "Discord Channel", color: config.colors.commands.primary },
|
||||
{ text: `${bot.discord.channel?.name}`, color: config.colors.commands.secondary },
|
||||
{ text: "Server Count", color: config.colors.commands.primary },
|
||||
{ text: `${bot.bots.length}`, color: config.colors.integer },
|
||||
{ text: "Prefixes", color: config.colors.commands.primary },
|
||||
{ text: `${config.prefixes.map((e) => e + " ").join(' ')}`, color: config.colors.commands.secondary },
|
||||
{ text: "Mode", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.mode}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
})
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
|
||||
}
|
||||
break;
|
||||
case "contributors":
|
||||
case "credits":
|
||||
component.push({
|
||||
translate: "%s%s - %s\n%s:\n%s\n%s\n%s\n%s\n%s %s\n%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Parker", color: "dark_red" },
|
||||
{ text: "2991", color: "black" },
|
||||
{ text: "Owner" },
|
||||
{ text: "Contributors" },
|
||||
{ text: "_ChipMC_", color: "dark_blue" },
|
||||
{ text: "chayapak", color: "yellow" },
|
||||
{ text: "_yfd", color: "light_purple" },
|
||||
{ text: "aaa", color: "gold" },
|
||||
{ text: "Morgan", color: "green" },
|
||||
{ text: "Ankan", color: "dark_green" },
|
||||
{ text: "TurtleKid", color: "green" },
|
||||
{ text: "Ploat/ImGloriz", color: "#cd8ccb" },
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "discord":
|
||||
component.push({
|
||||
text: `the discord server invite is ${config.discord.invite}`,
|
||||
color: config.colors.commands.primary,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "click here to join the discord server!",
|
||||
color: config.colors.commands.secondary,
|
||||
}
|
||||
]
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `${config.discord.invite}`
|
||||
}
|
||||
})
|
||||
break;
|
||||
case "loaded":
|
||||
component.push({
|
||||
translate: "%s %s\n%s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: `${bot.commandManager.commandlist.length}`, color: config.colors.integer },
|
||||
{ text: "Commands", color: config.colors.commands.primary },
|
||||
{ text: `${bot.modules.length}`, color: config.colors.integer },
|
||||
{ text: "Modules", color: config.colors.commands.primary }
|
||||
]
|
||||
});
|
||||
break;
|
||||
case "usages":
|
||||
case "usage":
|
||||
switch (args.slice(1).join(' ')?.toLowerCase()) {
|
||||
case "bot":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Bot Memory 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: `${require.main.path}`, color: config.colors.commands.secondary },
|
||||
{ text: "Arch", color: config.colors.commands.primary },
|
||||
{ text: `${os.arch()}`, color: config.colors.commands.secondary },
|
||||
{ text: "OS", color: config.colors.commands.primary },
|
||||
{ text: `${os.platform}`, color: config.colors.commands.secondary },
|
||||
{ text: "OS Version", color: config.colors.commands.primary },
|
||||
{ text: `${os.version()}`, color: config.colors.commands.secondary },
|
||||
{ text: "Kernel Version", color: config.colors.commands.primary },
|
||||
{ text: `${os.release()}`, color: config.colors.commands.secondary },
|
||||
{ text: "CPU", color: config.colors.commands.primary },
|
||||
{ text: `${os.cpus()[0].model}`, color: config.colors.commands.secondary },
|
||||
{ text: "CPU cores", color: config.colors.commands.primary },
|
||||
{ text: `${os.cpus().length}`, color: config.colors.integer },
|
||||
{ text: "Node Version", color: config.colors.commands.primary },
|
||||
{ text: `${process.version}`, color: config.colors.commands.secondary },
|
||||
{ text: "NPM Version", color: config.colors.commands.primary },
|
||||
{ text: `${execSync('npm -v').toString().replaceAll('\n', '')}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "version":
|
||||
case "ver":
|
||||
if (botInfo.buildstring.codename.length > 0) {
|
||||
component.push({
|
||||
translate: "%s %s %s-%s-%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s-%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Friday Night Funkin", color: "dark_blue" },
|
||||
{ text: "Boyfriend", color: "dark_aqua" },
|
||||
{ text: "Bot", color: "blue" },
|
||||
{ text: `${botInfo.buildstring.version}`, color: config.colors.integer },
|
||||
botInfo.buildstring.codename,
|
||||
{ text: "Build", color: config.colors.commands.primary },
|
||||
{ text: `${botInfo.buildstring.build}`, color: config.colors.integer },
|
||||
{ text: "Repo Build", color: config.colors.commands.primary },
|
||||
{ text: `${execSync('git rev-list --count --all').toString().replaceAll('\n','')}`, color: config.colors.integer },
|
||||
{ text: "Version Release Date", color: config.colors.commands.primary },
|
||||
{ text: `${new Date(execSync('git log -1 --format=%ci').toString()).toLocaleString("en-US", {timeZone: "America/CHICAGO"})}`, color: config.colors.commands.secondary },
|
||||
{ text: "Commit", color: config.colors.commands.primary },
|
||||
{ text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`, color: config.colors.commands.secondary },
|
||||
{ text: "11/22/22", color: config.colors.commands.primary },
|
||||
{ text: `${new Date().toLocaleDateString("en-US",{timeZone:"America/CHICAGO"})}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
});
|
||||
} else {
|
||||
component.push({
|
||||
translate: "%s %s %s-%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s-%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Friday Night Funkin", color: "dark_blue" },
|
||||
{ text: "Boyfriend", color: "dark_aqua" },
|
||||
{ text: "Bot", color: "blue" },
|
||||
{ text: `${botInfo.buildstring.version}`, color: config.colors.integer },
|
||||
{ text: "Build", color: config.colors.commands.primary },
|
||||
{ text: `${botInfo.buildstring.build}`, color: config.colors.integer },
|
||||
{ text: "Repo Build", color: config.colors.commands.primary },
|
||||
{ text: `${execSync('git rev-list --count --all').toString().replaceAll('\n','')}`, color: config.colors.integer },
|
||||
{ text: "Version Release Date", color: config.colors.commands.primary },
|
||||
{ text: `${new Date(execSync('git log -1 --format=%ci').toString()).toLocaleString("en-US", {timeZone: "America/CHICAGO"})}`, color: config.colors.commands.secondary },
|
||||
{ text: "Commit", color: config.colors.commands.primary },
|
||||
{ text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`, color: config.colors.commands.secondary },
|
||||
{ text: "11/22/22", color: config.colors.commands.primary },
|
||||
{ text: `${new Date().toLocaleDateString("en-US",{timeZone:"America/CHICAGO"})}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
|
||||
}
|
||||
}
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'info',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"information",
|
||||
],
|
||||
description: 'check the bots info',
|
||||
usages: [
|
||||
"about",
|
||||
"config <client, discord, options, all>",
|
||||
"contributors/credits",
|
||||
"discord",
|
||||
"loaded",
|
||||
"usages <bot, server, all>",
|
||||
"uptimes/uptime <bot, server, all>",
|
||||
"server",
|
||||
"version/ver",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
|
||||
componentPush(bot, args, config, discordClient, source, component);
|
||||
|
||||
bot.tellraw(`@a`, component);
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const EmbedBuilder = context.EmbedBuilder
|
||||
const fixansi = context.fixansi;
|
||||
const args = context.arguments;
|
||||
const discordClient = context.discordClient;
|
||||
const source = context.source;
|
||||
|
||||
let component = [];
|
||||
|
||||
componentPush(bot, args, config, discordClient, source, component);
|
||||
|
||||
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
const CommandError = require('../../util/command_error');
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "list",
|
||||
aliases: [
|
||||
"pl",
|
||||
"playerlist"
|
||||
],
|
||||
description: "check whos online on the server",
|
||||
trustLevel: 0,
|
||||
usages: [
|
||||
""
|
||||
]
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
|
||||
let component = [];
|
||||
let infoComponent = [];
|
||||
let playerCount = [];
|
||||
|
||||
playerCount.push({
|
||||
translate: "%s: (%s)\n",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Players", color: config.colors.commands.primary },
|
||||
{ text: `${bot.players.length}`, color: config.colors.integer },
|
||||
]
|
||||
});
|
||||
|
||||
component.push(playerCount);
|
||||
|
||||
for (const player of bot.players) {
|
||||
component.push({
|
||||
translate: "%s \u203a %s [%s: %s]",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
player.displayName ?? player.profile.name,
|
||||
{ text: `${player.uuid}`, color: config.colors.commands.primary },
|
||||
{ text: "Latency", color: config.colors.commands.primary },
|
||||
{ text: `${player.latency}`, color: config.colors.integer }
|
||||
]
|
||||
});
|
||||
component.push("\n");
|
||||
}
|
||||
component.pop();
|
||||
bot.tellraw("@a", component);
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const fixansi = context.fixansi;
|
||||
|
||||
let component = [];
|
||||
let playerCount = [];
|
||||
|
||||
playerCount.push({
|
||||
translate: "%s: (%s)\n",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Players", color: config.colors.commands.primary },
|
||||
{ text: `${bot.players.length}`, color: config.colors.integer },
|
||||
]
|
||||
});
|
||||
|
||||
component.push(playerCount);
|
||||
|
||||
for (const player of bot.players) {
|
||||
component.push({
|
||||
translate: "%s \u203a %s [%s: %s]",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
player.displayName ?? player.profile.name,
|
||||
{ text: `${player.uuid}`, color: config.colors.commands.primary },
|
||||
{ text: "Latency", color: config.colors.commands.primary },
|
||||
{ text: `${player.latency}`, color: config.colors.integer }
|
||||
]
|
||||
});
|
||||
component.push("\n");
|
||||
};
|
||||
|
||||
component.pop();
|
||||
|
||||
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi())}\`\`\``);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
const mc = require('minecraft-protocol');
|
||||
const util = require('util');
|
||||
|
||||
function componentPush (config, server, host, port, component) {
|
||||
component.push({
|
||||
translate: "%s: %s:%s\n%s: (%s/%s)\n%s: %s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "ip", color: config.colors.commands.primary },
|
||||
{ text: `${host}`, color: config.colors.commands.secondary },
|
||||
{ text: `${Number(port ?? 25565)}`, color: config.colors.commands.secondary },
|
||||
{ text: "players", color: config.colors.commands.primary },
|
||||
{ text: `${server.players.online}`, color: config.colors.integer },
|
||||
{ text: `${server.players.max}`, color: config.colors.integer },
|
||||
{ text: "server version", color: config.colors.commands.primary },
|
||||
{ text: `${server.version.name}`, color: config.colors.commands.secondary },
|
||||
server.description
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "mcserver",
|
||||
aliases: [
|
||||
"pingserver"
|
||||
],
|
||||
description: "pings minecraft servers",
|
||||
trustLevel: 0,
|
||||
usages: [
|
||||
"<ip>"
|
||||
]
|
||||
},
|
||||
async execute (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const [host, port] = args[0].split(':');
|
||||
const server = await mc.ping({ host, port: Number(port ?? 25565) });
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
|
||||
componentPush(config, server, host, port, component);
|
||||
|
||||
bot.tellraw("@a", component);
|
||||
} catch (e) {
|
||||
bot.chat.message(`${e.toString()}`);
|
||||
}
|
||||
},
|
||||
async discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const fixansi = context.fixansi;
|
||||
const config = context.config;
|
||||
const [host, port] = args[0].split(':');
|
||||
const server = await mc.ping({ host, port: Number(port ?? 25565) });
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
|
||||
componentPush(config, server, host, port, component);
|
||||
|
||||
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
|
||||
} catch (e) {
|
||||
bot?.discord?.message?.reply(`${e.toString()}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "netmsg",
|
||||
aliases: [
|
||||
"networkmessage",
|
||||
"netmessage"
|
||||
],
|
||||
description: "send a message to other servers",
|
||||
trustLevel: 1,
|
||||
usages: [
|
||||
"<message>"
|
||||
]
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
|
||||
let component = [];
|
||||
|
||||
if (bot.options.private === true) {
|
||||
component.push({
|
||||
translate: "[%s] %s \u203a %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: `${bot.options.serverName}`, color: config.colors.commands.primary },
|
||||
source?.player?.displayName ?? source?.player?.profile?.name,
|
||||
{ text: `${args.join(' ')}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
})
|
||||
} else {
|
||||
component.push({
|
||||
translate: "[%s:%s] %s \u203a %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: `${bot.options.host}`, color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.port}`, color: config.colors.commands.primary },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: `${args.join(' ')}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
for (const eachBot of bot.bots) {
|
||||
/* if (eachBot.options.mode === "savageFriends" || eachBot.options.mode === "creayun") {
|
||||
eachBot.chat.message(`${bot.getMessageAsPrismarine(component)?.toMotd()?.replaceAll('§','&')}`)
|
||||
} else {*/
|
||||
eachBot.tellraw("@a", component)
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
bot.core.chatRefill();
|
||||
} else {
|
||||
bot.core.move();
|
||||
}
|
||||
bot.tellraw("@a", "Refilling core,...")
|
||||
},
|
||||
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
bot.core.chatRefill();
|
||||
} else {
|
||||
bot.core.move();
|
||||
}
|
||||
bot.tellraw("@a", "Refilling core,...");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
const CommandError = require('../../util/command_error')
|
||||
const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, SlashCommandBuilder } = require('discord.js');
|
||||
const { request } = require('undici');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'urban',
|
||||
description: 'urban dictionary',
|
||||
aliases: [
|
||||
'urbandictionary'
|
||||
],
|
||||
trustLevel: 0,
|
||||
usages: [
|
||||
"<definition>",
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
const prefix = [
|
||||
{ text: '[', color: 'dark_gray' },
|
||||
{ text: 'Urban', color: '#B72A00' },
|
||||
{ text: '] ', color: 'dark_gray'}
|
||||
]
|
||||
let component = [];
|
||||
let term = `${args.join(' ')}`
|
||||
const query = new URLSearchParams({ term });
|
||||
const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`);
|
||||
const { list } = await dictResult.body.json();
|
||||
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
bot.chat.message('this command is disabled for this server for right now sorry!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!list.length) {
|
||||
bot.tellraw("@a", { text: "No results found", color: "dark_red" });
|
||||
}
|
||||
|
||||
|
||||
for (definitions of list) {
|
||||
component.push(prefix, [
|
||||
{
|
||||
text: `${definitions.definition.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray',
|
||||
underlined: false,
|
||||
italic: false,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action:"show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Example \u203a \n ${definitions.example.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Word \u203a ${definitions.word.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray',
|
||||
},
|
||||
{
|
||||
text: `Author \u203a ${definitions.author.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `written on \u203a ${definitions.written_on.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Rating \u203a Thumbs-Up ${definitions.thumbs_up} / Thumbs-Down ${definitions.thumbs_down}`,
|
||||
color: 'gray'
|
||||
}
|
||||
]
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'open_url',
|
||||
value: `${definitions.permalink}`
|
||||
}
|
||||
},
|
||||
])
|
||||
}
|
||||
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(`minecraft:tellraw @a ${JSON.stringify(component)}`);
|
||||
} else {
|
||||
bot.tellraw(`@a`, component)
|
||||
}
|
||||
},
|
||||
async discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const fixansi = context.fixansi;
|
||||
let component = [];
|
||||
let term = `${args.join(' ')}`
|
||||
const query = new URLSearchParams({ term });
|
||||
const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`);
|
||||
const { list } = await dictResult.body.json();
|
||||
|
||||
try {
|
||||
for (definitions of list) {
|
||||
component.push([
|
||||
{
|
||||
text: `${definitions.definition.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77').substring(0, 1950)}\n`,
|
||||
color: 'gray',
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
bot.discord.message.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
|
||||
} catch (e) {
|
||||
bot?.discord?.message?.reply(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
const CommandError = require('../../util/command_error');
|
||||
const { request } = require('undici');
|
||||
|
||||
function components (config, info, component) {
|
||||
component.push({
|
||||
translate: "%s\n%s: %s, %s\n%s: %s (%s)\n%s\n%s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
translate: "%s: %s, %s %s",
|
||||
with: [
|
||||
{ text: "Location", color: config.colors.commands.primary },
|
||||
{ text: `${info.location.name}`, color: config.colors.commands.secondary },
|
||||
{ text: `${info.location.region}`, color: config.colors.commands.secondary },
|
||||
{ text: `${info.location.country}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
},
|
||||
{ text: "Coords", color: config.colors.commands.primary },
|
||||
{ text: `${info.location.lat}`, color: config.colors.integer },
|
||||
{ text: `${info.location.lon}`, color: config.colors.integer },
|
||||
{ text: "Time", color: config.colors.commands.primary },
|
||||
{ text: `${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id, })}`, color: config.colors.commands.secondary },
|
||||
{ text: `${info.location.tz_id}`, color: config.colors.commands.secondary },
|
||||
{
|
||||
translate: "%s: %s (%s), %s (%s)",
|
||||
with: [
|
||||
{ text: "Temp", color: config.colors.commands.primary },
|
||||
{ text: `${Math.floor(info.current.temp_c)}`, color: config.colors.integer },
|
||||
{ text: "\u00b0C", color: config.colors.commands.secondary },
|
||||
{ text: `${Math.floor(info.current.temp_f)}`, color: config.colors.integer },
|
||||
{ text: "\u00b0F", color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "%s: %s (%s, %s), %s (%s, %s)",
|
||||
with: [
|
||||
{ text: "Wind Speed", color: config.colors.commands.primary },
|
||||
{ text: `${Math.floor(info.current.wind_kph)}`, color: config.colors.integer },
|
||||
{ text: "kph", color: config.colors.commands.secondary },
|
||||
{ text: `${info.current.wind_dir}`, color: config.colors.commands.secondary },
|
||||
{ text: `${Math.floor(info.current.wind_mph)}`, color: config.colors.integer },
|
||||
{ text: "mph", color: config.colors.commands.secondary },
|
||||
{ text: `${info.current.wind_dir}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{ text: "Condition", color: config.colors.commands.primary },
|
||||
{ text: `${info.current.condition.text}`, color: config.colors.commands.secondary },
|
||||
{ text: "Humidity", color: config.colors.commands.primary },
|
||||
{ text: `${Math.floor(info.current.humidity)}`, color: config.colors.integer }
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "weather",
|
||||
aliases: [
|
||||
|
||||
],
|
||||
description: "check the weather in locations",
|
||||
trustLevel: 0,
|
||||
usages: [
|
||||
"<weather/zip code>"
|
||||
]
|
||||
},
|
||||
async execute (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
const url = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ').replaceAll(' ','%20')}`);
|
||||
const info = await url.body.json();
|
||||
|
||||
components(config, info, component);
|
||||
bot.tellraw("@a", component);
|
||||
} catch (e) {
|
||||
bot.chat.message(e.toString());
|
||||
}
|
||||
},
|
||||
async discordExecute (context) {
|
||||
const config = context.config;
|
||||
const bot = context.bot;
|
||||
const fixansi = context.fixansi;
|
||||
const args = context.arguments;
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
const url = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ').replaceAll(' ','&')}`);
|
||||
const info = await url.body.json();
|
||||
|
||||
components(config, info, component);
|
||||
|
||||
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
|
||||
} catch (e) {
|
||||
bot?.discord?.message?.reply(e.toString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
const wiki = require('wikipedia');
|
||||
const CommandError = require('../../util/command_error');
|
||||
|
||||
async function components (config, summary, component) {
|
||||
component.push({ text: summary, color: config.colors.commands.primary })
|
||||
}
|
||||
|
||||
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;
|
||||
const config = context.config;
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
const page = await wiki.page(args.join(' '));
|
||||
const summary = await page.intro();
|
||||
|
||||
components(config, summary, component);
|
||||
|
||||
bot.tellraw("@a", component);
|
||||
|
||||
} catch (e) {
|
||||
if (e.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')") {
|
||||
bot.chat.message('&cArticle not found!');
|
||||
} else {
|
||||
bot.tellraw(`@a`, `${e.toString()}`)
|
||||
}
|
||||
}
|
||||
},
|
||||
async discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const fixansi = context.fixansi;
|
||||
const config = context.config;
|
||||
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
const page = await wiki.page(args.join(' '));
|
||||
const summary = await page.intro();
|
||||
|
||||
components(config, summary, component);
|
||||
|
||||
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
|
||||
|
||||
} catch (e) {
|
||||
if (e.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')") {
|
||||
bot?.discord?.message?.reply('Article not found!');
|
||||
} else {
|
||||
bot?.discord?.message?.reply(`${e.stack}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'reconnect',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
"end",
|
||||
"recon",
|
||||
],
|
||||
description: 'reconnect the bot',
|
||||
usages: [
|
||||
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
bot._client.end("disconnect :3")
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
bot._client.end("disconnect :3")
|
||||
}
|
||||
}
|
||||
@@ -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,30 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'reload',
|
||||
trustLevel: 3,
|
||||
aliases: [
|
||||
],
|
||||
description: 'reloads commands',
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
bot.tellraw("@a", [
|
||||
{ text: "Reloading ", color: "gray" },
|
||||
{ text: '(', color: "gray" },
|
||||
{ text: `${bot.commandManager.commandlist.length}`, color: "gold" },
|
||||
{ text: ') ', color: "gray" },
|
||||
{ text: 'commands', color: "gray" },
|
||||
])
|
||||
for (const eachBot of bot.bots) {
|
||||
eachBot.commandManager.reload();
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
bot.discord.message.reply("Reloading Commands,.........");
|
||||
for (const eachBot of bot.bots) {
|
||||
eachBot.commandManager.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
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:[""],
|
||||
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
|
||||
z = between(-30_000_000, 30_000_000)
|
||||
} else if (bot.options.isSavage) {
|
||||
x = between(-4096, 4096);
|
||||
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' },
|
||||
{ text: args.slice(1).join(' '), color: 'blue' },
|
||||
{ text: ' to ', color: 'gray' },
|
||||
{ text: `${x} `, color: 'gold' },
|
||||
{ text: `${y} `, color: 'gold' },
|
||||
{ text: `${z}`, color: 'gold' }
|
||||
])
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.command(`minecraft:tp ${args.slice(1).join(' ')} ${x} ${y} ${z}`)
|
||||
} else if (bot.options.isKaboom) {
|
||||
bot.core.run(`minecraft:tp ${args.slice(1).join(' ')} ${x} ${y} ${z}`);
|
||||
}
|
||||
} else {
|
||||
bot.tellraw("@a", [
|
||||
{ text: 'Randomly Teleported: ', color: 'gray' },
|
||||
{ text: source.player.profile.name, color: 'blue' },
|
||||
{ text: ' to ', color: 'gray' },
|
||||
{ text: `${x} `, color: 'gold' },
|
||||
{ text: `${y} `, color: 'gold' },
|
||||
{ text: `${z}`, color: 'gold' }
|
||||
])
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.command(`minecraft:tp ${source.player.profile.name} ${x} ${y} ${z}`)
|
||||
} else if (bot.options.isKaboom) {
|
||||
bot.core.run(`minecraft:tp ${source.player.profile.name} ${x} ${y} ${z}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
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>",
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const args = context.arguments;
|
||||
const script = args.slice(1).join(' ');
|
||||
try {
|
||||
if (source.sources.console) {
|
||||
bot.console.log(bot.getMessageAsPrismarine({ text: util.inspect(eval(args.join(' ')), { stylize })})?.toAnsi())
|
||||
} else if (bot.options.useChat || bot.options.isSavage) {
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })?.toMotd().replaceAll('§','&'))
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source.player.profile.name}"]`, [
|
||||
{
|
||||
text: util.inspect(eval(script), { stylize }).substring(0, 32700),
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
contents: [{
|
||||
text: 'click here to copy the code input',
|
||||
color: 'gray'
|
||||
}]
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'copy_to_clipboard',
|
||||
value: `${script}`
|
||||
}
|
||||
}
|
||||
]);
|
||||
}
|
||||
} catch (e) {
|
||||
throw new CommandError(e.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
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>"
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
if (!args && !args[0] && !args[1]) return
|
||||
switch (args[0]) {
|
||||
case 'error':
|
||||
switch (args[1]) {
|
||||
case 'stack':
|
||||
throw new Error(args.slice(2).join(' '));
|
||||
break
|
||||
case 'message':
|
||||
throw new CommandError(args.slice(2).join(' '));
|
||||
break
|
||||
}
|
||||
// throw new Error(args.slice(1).join(' '));
|
||||
break;
|
||||
case "message":
|
||||
bot.tellraw("@a", [
|
||||
{
|
||||
text: `Hello, World!, Player: ${bot.getMessageAsPrismarine(context.source.player.displayName ?? context.source.player.profile.name)?.toMotd()}§r`,
|
||||
color: 'gray',
|
||||
bold: false
|
||||
},
|
||||
{
|
||||
text: ` Args: ${args.slice(1).join(' ')}`,
|
||||
color: 'gray',
|
||||
bold: false,
|
||||
}
|
||||
])
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
const CommandError = require('../../util/command_error');
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "cloop",
|
||||
aliases: [
|
||||
"commandloop",
|
||||
"loop"
|
||||
],
|
||||
description: "loops commands",
|
||||
trustLevel: 1,
|
||||
usages: [
|
||||
"add <interval> <command>",
|
||||
"remove <index>",
|
||||
"list",
|
||||
"clear"
|
||||
]
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4] && !args[5]) return;
|
||||
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "add":
|
||||
if (isNaN(args[2]) === true) throw new CommandError("invalid interval");
|
||||
|
||||
const interval = parseInt(args[2]);
|
||||
const command = args.slice(3).join(' ');
|
||||
bot.cloop.add(command, interval);
|
||||
|
||||
bot.chat.message(`added ${command} to the cloops with the interval ${interval}`);
|
||||
break;
|
||||
case "clear":
|
||||
bot.cloop.clear();
|
||||
bot.chat.message('cleared the cloops');
|
||||
break;
|
||||
case "remove":
|
||||
if (isNaN(args[2]) === true) throw new CommandError('argument must be an integer!');
|
||||
|
||||
const index = parseInt(args[2]);
|
||||
bot.cloop.remove(index);
|
||||
|
||||
bot.chat.message(`removed ${index} from cloops`);
|
||||
break;
|
||||
case "list":
|
||||
const component = []
|
||||
|
||||
const listComponent = []
|
||||
let i = 0
|
||||
for (const cloop of bot.cloop.list) {
|
||||
listComponent.push({
|
||||
translate: '%s \u203a %s (%s)',
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${i}`, color: config.colors.integer },
|
||||
cloop.command,
|
||||
{ text: `${cloop.interval}`, color: config.colors.integer },
|
||||
]
|
||||
})
|
||||
listComponent.push('\n')
|
||||
i++
|
||||
}
|
||||
|
||||
listComponent.pop()
|
||||
|
||||
component.push({
|
||||
translate: 'Cloops (%s):',
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${bot.cloop.list.length}`, color: config.colors.integer }
|
||||
]
|
||||
})
|
||||
component.push('\n')
|
||||
|
||||
if (bot.cloop.list.length > 0) {
|
||||
component.push(listComponent)
|
||||
}
|
||||
bot.tellraw("@a", component);
|
||||
/*
|
||||
if (bot.cloop.list.length === 0) {
|
||||
bot.tellraw(`@a[name="${source?.player.profile?.name}"]`, {
|
||||
translate: 'Cloops (%s):',
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${bot.cloop.list.length}`, color: config.colors. }
|
||||
]
|
||||
})
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)
|
||||
}*/
|
||||
break;
|
||||
default:
|
||||
throw new CommandError('invalid argument')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -28,10 +30,12 @@ module.exports = {
|
||||
const event = bot?.discord?.message
|
||||
const roles = event?.member?.roles?.cache
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
|
||||
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,84 +0,0 @@
|
||||
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>",
|
||||
],
|
||||
async execute (context) {
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
const prefix = [
|
||||
{ text: '[', color: 'dark_gray' },
|
||||
{ text: 'Urban', color: '#B72A00' },
|
||||
{ text: '] ', color: 'dark_gray'}
|
||||
]
|
||||
let component = [];
|
||||
let term = `${args.join(' ')}`
|
||||
const query = new URLSearchParams({ term });
|
||||
const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`);
|
||||
const { list } = await dictResult.body.json();
|
||||
if (!list.length) {
|
||||
bot.tellraw('@a', { text: 'No results found', color: 'dark_red' });
|
||||
}
|
||||
for (definitions of list) {
|
||||
component.push(prefix, [
|
||||
{
|
||||
text: `${definitions.definition.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray',
|
||||
underlined: false,
|
||||
italic: false,
|
||||
translate:"",
|
||||
hoverEvent: {
|
||||
action:"show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Example \u203a \n ${definitions.example.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Word \u203a ${definitions.word.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray',
|
||||
},
|
||||
{
|
||||
text: `Author \u203a ${definitions.author.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `written on \u203a ${definitions.written_on.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Rating \u203a Thumbs-Up ${definitions.thumbs_up} / Thumbs-Down ${definitions.thumbs_down}`,
|
||||
color: 'gray'
|
||||
}
|
||||
]
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'open_url',
|
||||
value: `${definitions.permalink}`
|
||||
}
|
||||
},
|
||||
])
|
||||
}
|
||||
if (bot.options.useChat) {
|
||||
for (const definitions of list) {
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ text: `${definitions.example.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`})?.toMotd().replaceAll("§","&"));
|
||||
// bot.chat.message(definitions.example.replaceAll("\r", ""));
|
||||
}
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)
|
||||
}
|
||||
},
|
||||
async discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const component = [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
const http = require('http');
|
||||
const https = require('https');
|
||||
const util = require('util');
|
||||
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>"
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
if (args.slice(1).join(' ').toLowerCase().startsWith("http://")) {
|
||||
http.get(args.slice(1).join(' '), (res) => {
|
||||
const { statusCode } = res;
|
||||
const contentType = res.headers['content-type'];
|
||||
res.setEncoding('utf8');
|
||||
let rawData = '';
|
||||
res.on('data', (chunk) => { rawData += chunk; });
|
||||
res.on('end', () => {
|
||||
try {
|
||||
bot.tellraw("@a", { text: util.inspect(rawData.toString().substring(0, 32750)), color: "dark_green" })
|
||||
} catch (e) {
|
||||
bot.tellraw("@a", e.toString());
|
||||
}
|
||||
});
|
||||
}).on('error', (e) => {
|
||||
bot.chat.message(`&4${e.toString()}`);
|
||||
});
|
||||
} else {
|
||||
https.get(args.slice(1).join(' '), (res) => {
|
||||
res.on('data', (d) => {
|
||||
bot.tellraw("@a", { text: util.inspect(d.toString().substring(0, 32750)), color: "dark_green", })
|
||||
// console.log(Object.keys(d.toString().length));
|
||||
});
|
||||
}).on('error', (e) => {
|
||||
bot.chat.message(`&4${e.toString()}`);
|
||||
});
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
let Embed;
|
||||
let fix;
|
||||
let ansi;
|
||||
//bot.discord.message.reply('e');
|
||||
if (args.join(' ').toLowerCase().startsWith("http://")) {
|
||||
http.get(args.join(' '), (res) => {
|
||||
const { statusCode } = res;
|
||||
const contentType = res.headers['content-type'];
|
||||
res.setEncoding('utf8');
|
||||
let rawData = '';
|
||||
res.on('data', (chunk) => { rawData += chunk; });
|
||||
res.on('end', () => {
|
||||
// try {
|
||||
// bot.tellraw("@a", { text: util.inspect(rawData), color: "dark_green" })
|
||||
ansi = bot.getMessageAsPrismarine({ text: util.inspect(rawData.toString()), color: 'dark_green'})?.toAnsi()
|
||||
fix = fixansi(ansi.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] })
|
||||
// } catch (e) {
|
||||
// bot.tellraw("@a", e.toString());
|
||||
//throw new CommandError(e.toString())
|
||||
// }
|
||||
});
|
||||
}).on('error', (e) => {
|
||||
//bot.chat.message(`&4${e.toString()}`);
|
||||
});
|
||||
} else {
|
||||
https.get(args.join(' '), (res) => {
|
||||
res.on('data', (d) => {
|
||||
// bot.tellraw("@a", { text: util.inspect(d.toString()), color: "dark_green", })
|
||||
// console.log(Object.keys(d.toString().length));
|
||||
ansi = bot.getMessageAsPrismarine({ text: util.inspect(d.toString()), color: 'dark_green'})?.toAnsi()
|
||||
fix = fixansi(ansi.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] })
|
||||
// bot.discord.message.reply('e');
|
||||
});
|
||||
}).on('error', (e) => {
|
||||
//bot.chat.message(`&4${e.toString()}`);
|
||||
//throw new CommandError(e.toString())
|
||||
});
|
||||
/*
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix1}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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()}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
const { parseString } = require('xml2js');
|
||||
const CommandError = require('../util/command_error')
|
||||
const util = require('util');
|
||||
module.exports = {
|
||||
name: 'xml',
|
||||
trustLevel: 3,
|
||||
aliases: [
|
||||
],
|
||||
description: 'eval xml shit',
|
||||
usages: [
|
||||
"<xml code>"
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
parseString(args.slice(1).join(' '), function (err, result) {
|
||||
if (err) throw new CommandError(err.toString())
|
||||
bot.tellraw("@a", [
|
||||
{
|
||||
text: "Result \u203a \n",
|
||||
color: "gray"
|
||||
},
|
||||
{
|
||||
text: `${util.inspect(result)}`
|
||||
}
|
||||
])
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,681 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": {
|
||||
"text": "HBot",
|
||||
"color": "aqua",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"hhhzzzsss"
|
||||
],
|
||||
"exclaimer": "HBOT HARRYBUTT LMAOOOOOOOOOOOOOOOOO",
|
||||
"foundation": "java/mcprotocollib",
|
||||
"prefixes": [
|
||||
"#"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "FBot",
|
||||
"color": "gold"
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
"popbob/aaa"
|
||||
],
|
||||
"exclaimer": "",
|
||||
"foundation": "nodejs/node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"+"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "Hydra",
|
||||
"color": "dark_red"
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
"popbob/aaa"
|
||||
],
|
||||
"exclaimer": "",
|
||||
"foundation": "nodejs/node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"+",
|
||||
"$",
|
||||
"h:",
|
||||
"hydra:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "JokerBot",
|
||||
"color": "green"
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
"zXzy",
|
||||
"12alex12"
|
||||
],
|
||||
"exclaimer": "",
|
||||
"foundation": "nodejs/mineflayer",
|
||||
"prefixes": [
|
||||
"\\"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "CddehhBot",
|
||||
"color": "red",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"CaydennO1",
|
||||
"spyingcreeper09"
|
||||
],
|
||||
"exclaimer": "WHAT IS THIS GOOFY AAAH FUCKING BOT FUCKING PIECE OF RETARDED ASS SHIT BOT ITS SO FUCKING SHIT I WANNA IPFILTER IT WITH FUCKING CHOMENS",
|
||||
"foundation": "nodejs/mineflayer",
|
||||
"prefixes": [
|
||||
","
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "TurtleBot",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"TurtleKid"
|
||||
],
|
||||
"exclaimer": "nmp when?",
|
||||
"foundation": "nodejs/mineflayer",
|
||||
"prefixes": [
|
||||
"\\"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "NothingBot",
|
||||
"color": "dark_red",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"Yaode_owo"
|
||||
],
|
||||
"exclaimer": "uwu",
|
||||
"foundation": "nodejs/mineflayer",
|
||||
"prefixes": [
|
||||
"?"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "SC09Bot",
|
||||
"color": "dark_gray",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"spyingcreeper09"
|
||||
],
|
||||
"exclaimer": ":3",
|
||||
"foundation": "nodejs/node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"@"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "HorizonBot",
|
||||
"color": "gold",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"ZenZoya",
|
||||
"Yaode_owo",
|
||||
"Parker2991",
|
||||
"and others"
|
||||
],
|
||||
"exclaimer": "originally called §5FleamBot§r",
|
||||
"foundation": "nodejs/node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"^"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "64Bot",
|
||||
"color": "gold",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"64Will64"
|
||||
],
|
||||
"exclaimer": "NINTENDO 64?!?!??!?! 69Bot when??????",
|
||||
"foundation": "NodeJS/Mineflayer",
|
||||
"prefixes": [
|
||||
"w="
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "Nebulabot",
|
||||
"color": "dark_purple",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"IuCC"
|
||||
],
|
||||
"exclaimer": "the void",
|
||||
"foundation": "NodeJS/Node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"["
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "Prism",
|
||||
"color": "#00FF9C",
|
||||
"bold": true
|
||||
},
|
||||
{
|
||||
"text": "Bot",
|
||||
"color": "white",
|
||||
"bold": true
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
"IuCC"
|
||||
],
|
||||
"exclaimer": "prismarine :3",
|
||||
"foundation": "NodeJS/Node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"["
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "SharpBot",
|
||||
"color": "aqua",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"64Will64"
|
||||
],
|
||||
"exclaimer": "sharp as in the tv? idfk im out of jokes also the first c# bot on the list??",
|
||||
"foundation": "C#/MineSharp",
|
||||
"prefixes": [
|
||||
"s="
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "MoonBot",
|
||||
"color": "red",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"64Will64"
|
||||
],
|
||||
"exclaimer": "stop mooning/mooing me ",
|
||||
"foundation": "NodeJS/Mineflayer",
|
||||
"prefixes": [
|
||||
"m="
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "TableBot",
|
||||
"color": "yellow",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"12alex12"
|
||||
],
|
||||
"exclaimer": "TABLE CLOTH BOT?!?! ",
|
||||
"foundation": "NodeJS/Node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"t!"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "Evil",
|
||||
"color": "dark_red",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": "Bot",
|
||||
"color": "dark_purple"
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
"FusseligerDev"
|
||||
],
|
||||
"exclaimer": "",
|
||||
"foundation": "Java/Custom",
|
||||
"prefixes": [
|
||||
"!"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "SBot Java",
|
||||
"color": "white",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"evkc"
|
||||
],
|
||||
"foundation": "Java/MCProtocolLib",
|
||||
"prefixes": [
|
||||
":"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "SBot Rust",
|
||||
"color": "white",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"evkc"
|
||||
],
|
||||
"foundation": "Rust",
|
||||
"prefixes": [
|
||||
"re:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "Z-Boy-Bot",
|
||||
"color": "dark_purple",
|
||||
"bold": false
|
||||
},
|
||||
"exclaimer": "Most likely skidded along with kbot that the dev used",
|
||||
"authors": [
|
||||
"Romnci"
|
||||
],
|
||||
"foundation": "NodeJS/mineflayer or Java/mcprotocollib idfk",
|
||||
"prefixes": [
|
||||
"Z]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "ABot",
|
||||
"color": "gold",
|
||||
"bold": true
|
||||
},
|
||||
"exclaimer": "not used anymore (replaced by V2)",
|
||||
"authors": [
|
||||
{
|
||||
"text": "_yfd",
|
||||
"color": "light_purple"
|
||||
}
|
||||
],
|
||||
"foundation": "NodeJS/Node-Minecraft-Protocol",
|
||||
"prefixes": [
|
||||
"<"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "ABot-V2",
|
||||
"color": "gold",
|
||||
"bold": true
|
||||
},
|
||||
"exclaimer": "",
|
||||
"authors": [
|
||||
{
|
||||
"text": "_yfd",
|
||||
"color": "light_purple"
|
||||
}
|
||||
],
|
||||
"foundation": "NodeJS/Node-Minecraft-Protocol",
|
||||
"prefixes": [
|
||||
"<"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "FardBot",
|
||||
"color": "light_purple",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"_yfd"
|
||||
],
|
||||
"exclaimer": "bot is dead lol",
|
||||
"foundation": "NodeJS/Mineflayer",
|
||||
"prefixes": [
|
||||
"<"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "ChipmunkBot Java",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"_ChipMC_"
|
||||
],
|
||||
"exclaimer": "chips? also shoutout to chip and chayapak for helping in the rewrite",
|
||||
"foundation": "Java/MCProtocolLib",
|
||||
"prefixes": [
|
||||
"'",
|
||||
"/'"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "ChipmunkBot NodeJS",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"_ChipMC_"
|
||||
],
|
||||
"foundation": "NodeJS/Node-Minecraft-Protocol"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "TestBot",
|
||||
"color": "aqua",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"Blackilykat"
|
||||
],
|
||||
"foundation": "Java/MCProtocolLib",
|
||||
"prefixes": [
|
||||
"-"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "UBot",
|
||||
"color": "gray",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"HexWoman"
|
||||
],
|
||||
"exclaimer": "UwU OwO",
|
||||
"foundation": "NodeJS/node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "ChomeNS Bot Java",
|
||||
"color": "yellow",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"chayapak"
|
||||
],
|
||||
"exclaimer": "wow its my bot !! ! 4374621q43567%^&#%67868-- chayapak \n rip ChomeNS bot i wonder what chayapak is currently doing -- Parker2991",
|
||||
"foundation": "Java/MCProtocolLib",
|
||||
"prefixes": [
|
||||
"*",
|
||||
"cbot ",
|
||||
"/cbot "
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "ChomeNS Bot NodeJS",
|
||||
"color": "yellow",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"chayapak"
|
||||
],
|
||||
"foundation": "NodeJS/Node-Minecraft-Protocol",
|
||||
"prefixes": [
|
||||
"*",
|
||||
"cbot",
|
||||
"/cbot"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "RecycleBot",
|
||||
"color": "dark_green",
|
||||
"bold": false
|
||||
},
|
||||
"foundation": [
|
||||
"MorganAnkan"
|
||||
],
|
||||
"exclaimer": "nice bot",
|
||||
"language": "NodeJS/node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"="
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "neobot",
|
||||
"color": "blue",
|
||||
"bold": false
|
||||
},
|
||||
"exclaimer": "n e o b o t ;oslkdfj;salkdfj;ladsjf",
|
||||
"authors": [
|
||||
"mirkokral"
|
||||
],
|
||||
"foundation": "java/MCProtocolLib",
|
||||
"prefixes": [
|
||||
"_"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "ManBot",
|
||||
"color": "dark_green",
|
||||
"bold": false
|
||||
},
|
||||
"exclaimer": "(more like men bot :skull:) OH HAAAAAAAAAAAAAAIIILL LOGINTIMEDOUT",
|
||||
"authors": [
|
||||
"Man/LogintimedOut"
|
||||
],
|
||||
"foundation": "NodeJS/mineflayer",
|
||||
"prefixes": [
|
||||
"(Note:I dont remember!!)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "Useless",
|
||||
"color": "red",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": "Bot",
|
||||
"color": "gray",
|
||||
"bold": false
|
||||
}
|
||||
],
|
||||
"exclaimer": "it isnt useless its a good bot................",
|
||||
"authors": [
|
||||
"IuCC"
|
||||
],
|
||||
"foundation": "NodeJS/node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"["
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "SnifferBot",
|
||||
"color": "gold",
|
||||
"bold": false
|
||||
}
|
||||
],
|
||||
"exclaimer": "sniff sniff FNFBoyfriendBot simp",
|
||||
"authors": [
|
||||
"popbob/aaa"
|
||||
],
|
||||
"foundation": "NodeJS/Node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
">"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "XBot",
|
||||
"color": "dark_purple",
|
||||
"bold": false
|
||||
}
|
||||
],
|
||||
"exclaimer": "",
|
||||
"authors": [
|
||||
"popbob/aaa"
|
||||
],
|
||||
"foundation": "ts-Node/Node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"$"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "Kitty",
|
||||
"color": "gold",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": "Corp",
|
||||
"color": "aqua",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": "Bot",
|
||||
"color": "yellow",
|
||||
"bold": false
|
||||
}
|
||||
],
|
||||
"exclaimer": "3 words ginlang is gay",
|
||||
"authors": [
|
||||
"ginlang , G6_, ArrayBuffer, and i guess more??"
|
||||
],
|
||||
"foundation": "NodeJS/node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"^"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "FNF",
|
||||
"color": "dark_purple",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": "Boyfriend",
|
||||
"color": "aqua",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": "Bot",
|
||||
"color": "dark_red",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": " nmp",
|
||||
"color": "black",
|
||||
"bold": false
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"text": "Parker2991",
|
||||
"color": "dark_red"
|
||||
},
|
||||
{
|
||||
"text": " _ChipMC_",
|
||||
"color": "dark_green",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": " chayapak",
|
||||
"color": "yellow",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": " _yfd",
|
||||
"color": "light_purple",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": "popbob/aaa",
|
||||
"color": "gold"
|
||||
},
|
||||
{
|
||||
"text": "MorganAnkan",
|
||||
"color": "dark_green"
|
||||
},
|
||||
{
|
||||
"text": "TurtleKid",
|
||||
"color": "green"
|
||||
}
|
||||
],
|
||||
"exclaimer": "v4.0x - current",
|
||||
"foundation": "NodeJS/node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"~",
|
||||
"fnfbfbot ",
|
||||
"",
|
||||
"",
|
||||
"█"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "FNF",
|
||||
"color": "dark_purple",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": "Boyfriend",
|
||||
"color": "aqua",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": "Bot",
|
||||
"color": "dark_red",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": " legacy",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"text": "Parker2991",
|
||||
"color": "dark_red"
|
||||
},
|
||||
{
|
||||
"text": " _ChipMC_",
|
||||
"color": "dark_green",
|
||||
"bold": false
|
||||
}
|
||||
],
|
||||
"exclaimer": "1037 LINES OF CODE WTFARD!??! also this version is in console commands only",
|
||||
"foundation": "NodeJS/mineflayer",
|
||||
"prefixes": []
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,114 @@
|
||||
module.exports = {
|
||||
prefixes: [
|
||||
"!",
|
||||
],
|
||||
|
||||
discord: {
|
||||
token: "discord token here",
|
||||
prefix: "!",
|
||||
invite: "discord invite here",
|
||||
enabled: true,
|
||||
presence: {
|
||||
name: "amogus",
|
||||
status: "dnd"
|
||||
},
|
||||
|
||||
roles: {
|
||||
trusted: "trusted",
|
||||
admin: "admin",
|
||||
fullAccess: "full access",
|
||||
owner: "FNFBoyfriendBot Owner"
|
||||
}
|
||||
},
|
||||
|
||||
core: {
|
||||
name: { text: "FNFBoyfriendBot Core", color: "#00FFFF" },
|
||||
itemName: { text: "FNFBoyfriendBot core item", color: "#00FFFF" },
|
||||
itemRefill: true,
|
||||
refillInterval: 300000,
|
||||
// refilling core via item is buggy rn i recommend setting itemRefill to false for now
|
||||
area: {
|
||||
start: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0,
|
||||
},
|
||||
end: {
|
||||
x: 15,
|
||||
y: 0,
|
||||
z: 15,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
weatherApiKey: "weather api token here",
|
||||
|
||||
debug: {
|
||||
commandSetMessage: false
|
||||
},
|
||||
|
||||
keys: {
|
||||
trusted: "trusted key here",
|
||||
admin: "admin key here",
|
||||
owner: "owner key here"
|
||||
},
|
||||
|
||||
colors: {
|
||||
integer: "gold",
|
||||
discord: {
|
||||
embed: "#000000",
|
||||
error: "#FF0000"
|
||||
},
|
||||
|
||||
commands: {
|
||||
primary: "blue",
|
||||
secondary: "aqua",
|
||||
tertiary: "gray"
|
||||
},
|
||||
|
||||
help: {
|
||||
public: "blue",
|
||||
trusted: "dark_aqua",
|
||||
admin: "aqua",
|
||||
owner: "light_purple",
|
||||
console: "dark_purple"
|
||||
}
|
||||
},
|
||||
|
||||
console: {
|
||||
prefix: "c."
|
||||
},
|
||||
|
||||
logsFolder: {
|
||||
path: "../../../",
|
||||
// this is being loaded from the modules so make sure it starts with ../../
|
||||
name: "fnfboyfriendbot-logs",
|
||||
},
|
||||
|
||||
bots: [
|
||||
// usernameGen is for a random username
|
||||
// if private is set to true then the server ip for the server will be hidden
|
||||
// channelId is for discord logging
|
||||
// logging is for console logging
|
||||
// reconnectDelay is for the delay for reconnecting to a server
|
||||
// modes:
|
||||
// kaboom: for the server kaboom.pw
|
||||
// savageFriends: for the server savage Friends
|
||||
// creayun for the server creayun
|
||||
{
|
||||
host: "localhost",
|
||||
username: "FNFBoyfriendBot",
|
||||
usernameGen: true,
|
||||
version: "1.20.2",
|
||||
serverName: "localhost",
|
||||
private: false,
|
||||
reconnectDelay: 6000,
|
||||
channelId: "discord channel ip here",
|
||||
logging: true,
|
||||
mode: "kaboom",
|
||||
selfcareInterval: 300
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
prefixes:
|
||||
- "!"
|
||||
- "fnfbfbot!"
|
||||
|
||||
discord:
|
||||
token: "discord token here"
|
||||
prefix: "!"
|
||||
invite: "discord invite here"
|
||||
roles:
|
||||
trusted: "trusted"
|
||||
admin: "admin"
|
||||
owner: "FNFBoyfriendBot Owner"
|
||||
|
||||
core:
|
||||
name: {"translate":"outOfMemory.message"}
|
||||
area:
|
||||
start:
|
||||
x: 0
|
||||
y: 0
|
||||
z: 0
|
||||
end:
|
||||
x: 15
|
||||
y: 0
|
||||
z: 15
|
||||
|
||||
commandSetMessage: true
|
||||
|
||||
keys:
|
||||
trusted: "trusted key here"
|
||||
admin: "admin key here"
|
||||
owner: "owner key here"
|
||||
|
||||
colors:
|
||||
discord:
|
||||
embed: "#000000"
|
||||
error: "#FF0000"
|
||||
|
||||
console:
|
||||
prefix: "c."
|
||||
filelogger: false
|
||||
|
||||
bots:
|
||||
- host: "localhost"
|
||||
username: "FNFBoyfriendBot"
|
||||
usernameGen: true
|
||||
version: "1.20.2"
|
||||
serverName: "localhost"
|
||||
reconnectDelay: 6000
|
||||
channelId: "discord channel id here"
|
||||
logging: false
|
||||
useChat: false
|
||||
isKaboom: true
|
||||
isSavage: false
|
||||
isCreayun: false
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
[]
|
||||
+5
-7
@@ -1,10 +1,8 @@
|
||||
{
|
||||
"bot": {
|
||||
"buildstring": {
|
||||
"version": "v6.0.5",
|
||||
"build":"1050",
|
||||
"codename":""
|
||||
},
|
||||
"source": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot/"
|
||||
"buildstring": {
|
||||
"build": "2205",
|
||||
"codename": "",
|
||||
"version": "v7.0.6",
|
||||
"url": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot.git"
|
||||
}
|
||||
}
|
||||
|
||||
+723
-263
File diff suppressed because it is too large
Load Diff
+44
-13
@@ -1,35 +1,66 @@
|
||||
const createBot = require('./bot.js');
|
||||
const readline = require('readline');
|
||||
const loadModules = require('./util/loadModules');
|
||||
const js_yaml = require('js-yaml');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { Client, GatewayIntentBits } = require('discord.js');
|
||||
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits;
|
||||
const discordClient = new Client({ intents: [Guilds, GuildMessages, MessageContent] });
|
||||
const CommandSource = require('./util/command_source');
|
||||
|
||||
console.log('Starting FNFBoyfriendBot');
|
||||
if (!fs.existsSync(path.join(__dirname, "../config.yml"))) {
|
||||
console.log("Config not found creating config from the default config");
|
||||
|
||||
if (!fs.existsSync(path.join(__dirname, "../config.js"))) {
|
||||
console.warn("Config not found creating config from the default config");
|
||||
fs.copyFileSync(
|
||||
path.join(__dirname, "./data/default_config.yml"),
|
||||
path.join(__dirname, "../config.yml")
|
||||
path.join(__dirname, "./data/default_config.js"),
|
||||
path.join(__dirname, "../config.js")
|
||||
)
|
||||
}
|
||||
try {
|
||||
config = js_yaml.load(fs.readFileSync(path.join(__dirname, '../', 'config.yml')))
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
|
||||
const config = require('../config.js');
|
||||
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
})
|
||||
|
||||
if (config.discord.enabled) discordClient.login(config.discord.token);
|
||||
|
||||
const bots = [];
|
||||
let bot;
|
||||
|
||||
for (const options of config.bots) {
|
||||
const bot = new createBot(options, config);
|
||||
bot = createBot(options, config);
|
||||
bots.push(bot);
|
||||
bot.bots = bots;
|
||||
loadModules(bot, options, config, discordClient);
|
||||
require('./util/loadModules')(bot, options, config, discordClient);
|
||||
bot.console.readlineInterface(rl);
|
||||
}
|
||||
|
||||
discordClient.on('messageCreate', (message) => {
|
||||
try {
|
||||
if (message.author.id === bot.discord.client.user.id) return;
|
||||
|
||||
const ChatMessage = require('prismarine-chat')('1.20.2');
|
||||
bot.getMessageAsPrismarine = (message) => {
|
||||
return new ChatMessage(message);
|
||||
}
|
||||
config.prefixes.map((prefix) => {
|
||||
if (message.content.startsWith(prefix)) {
|
||||
const source = new CommandSource({
|
||||
profile: {
|
||||
name: `${message?.member.nickname || message?.author.displayName}`
|
||||
}
|
||||
}, {
|
||||
discord: true,
|
||||
console: false,
|
||||
}, false, message);
|
||||
|
||||
bot.commandManager.executeString(source, message.content.substring(prefix.length));
|
||||
return;
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
const readline = require('readline');
|
||||
function boot (bot, options, discordClient, config) {
|
||||
bot.on("packet.login", (data) => {
|
||||
if (bot.options.isCreayun) return
|
||||
if (new Date().getDay() === 5) {
|
||||
bot.chat.message('Gettin\' freaky on a friday night!');
|
||||
} else {
|
||||
bot.chat.message('&9FNF&3Boyfriend&1Bot &fcreated by &4Parker&02991');
|
||||
}
|
||||
}) // &9 &3 &1
|
||||
}
|
||||
module.exports = boot;
|
||||
|
||||
+51
-25
@@ -5,6 +5,7 @@ const CreayunChatParser = require('../util/ChatParsers/Creayun');
|
||||
const sayConsoleChatParser = require('../util/ChatParsers/sayConsole');
|
||||
const VanillaChatParser = require("../util/ChatParsers/VanillaChat");
|
||||
const yfdCustomChatParser = require('../util/ChatParsers/yfdCustomChat');
|
||||
|
||||
function tryParse (json) {
|
||||
try {
|
||||
return JSON.parse(json)
|
||||
@@ -12,13 +13,16 @@ function tryParse (json) {
|
||||
return { text: '' }
|
||||
}
|
||||
}
|
||||
//what was changed??
|
||||
function chat (bot, options, config) {
|
||||
|
||||
function inject (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
let ChatMessage
|
||||
bot.on('registry_ready', registry => {
|
||||
ChatMessage = loadPrismarineChat(registry)
|
||||
})
|
||||
if (options.isSavage || options.isCreayun) {
|
||||
if (options.mode === "savageFriends" || options.mode === "creayun") {
|
||||
bot.chatParsers = [CreayunChatParser, sayConsoleChatParser]
|
||||
} else {
|
||||
bot.chatParsers = [KaboomChatParser, ChipmunkModChatParser, VanillaChatParser, sayConsoleChatParser, yfdCustomChatParser]
|
||||
@@ -26,17 +30,13 @@ function chat (bot, options, config) {
|
||||
bot.on('packet.profileless_chat', packet => {
|
||||
const message = tryParse(packet.message)
|
||||
const sender = tryParse(packet.name)
|
||||
bot.emit('profileless_chat', {
|
||||
message,
|
||||
type: packet.type,
|
||||
sender
|
||||
})
|
||||
|
||||
switch (packet.type) {
|
||||
case 1:
|
||||
bot.emit('message', { 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('message', { 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 }])
|
||||
@@ -53,38 +53,41 @@ function chat (bot, options, config) {
|
||||
|
||||
bot.on('packet.player_chat', (packet, data) => {
|
||||
const unsigned = tryParse(packet.unsignedChatContent)
|
||||
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 ]})
|
||||
break
|
||||
case 4:
|
||||
bot.emit('message', 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('message', { 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 })
|
||||
break
|
||||
default:
|
||||
bot.emit('message', unsigned)
|
||||
case 1:
|
||||
bot.emit('message', { translate: "chat.type.emote", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
|
||||
break
|
||||
}
|
||||
tryParsingMessage(unsigned, { senderUuid: packet.senderUuid, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
|
||||
})
|
||||
|
||||
bot.on('packet.system_chat', packet => {
|
||||
const message = tryParse(packet.content)
|
||||
if (config.commandSetMessage) {
|
||||
if (message.translate === 'advMode.setCommand.success') return // Ignores command set message
|
||||
}
|
||||
if (message.translate === "advMode.setCommand.success" && config?.debug?.commandSetMessage === false) return;
|
||||
if (message.translate === 'multiplayer.message_not_delivered') return
|
||||
bot.emit('system_chat', { message, actionbar: packet.isActionBar })
|
||||
|
||||
if (packet.isActionBar) {
|
||||
return
|
||||
}
|
||||
|
||||
bot.emit('message', message)
|
||||
if (message.translate === "advMode.notAllowed") return;
|
||||
|
||||
tryParsingMessage(message, { players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
|
||||
bot.emit('message', message);
|
||||
|
||||
tryParsingMessage(message, { players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine });
|
||||
})
|
||||
|
||||
function tryParsingMessage (message, data) {
|
||||
@@ -107,24 +110,26 @@ function chat (bot, options, config) {
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
bot.chat = {
|
||||
message: message => {
|
||||
message (message) {
|
||||
const acc = 0;
|
||||
const bitset = Buffer.allocUnsafe(3);
|
||||
bitset[0] = acc & 0xFF;
|
||||
bitset[1] = (acc >> 8) & 0xFF;
|
||||
bitset[2] = (acc >> 16) & 0xFF;
|
||||
bot._client.write('chat_message', {
|
||||
message: message?.substring(0, 256),
|
||||
message: message?.substring(0, 256)?.replaceAll('§','&'),
|
||||
timestamp: BigInt(Date.now()),
|
||||
salt: 0n,
|
||||
offset: 0,
|
||||
acknowledged: bitset
|
||||
})
|
||||
},
|
||||
command: command => {
|
||||
|
||||
command (command) {
|
||||
bot._client.write('chat_command', {
|
||||
command: command?.substring(0, 256),
|
||||
command: command?.substring(0, 256)?.replaceAll('§','&'),
|
||||
timestamp: BigInt(Date.now()),
|
||||
salt: 0n,
|
||||
argumentSignatures: [],
|
||||
@@ -133,10 +138,31 @@ function chat (bot, options, config) {
|
||||
acknowledged: Buffer.alloc(3),
|
||||
previousMessages: []
|
||||
})
|
||||
},
|
||||
|
||||
send (message) {
|
||||
if (message.startsWith('/')) {
|
||||
bot.chat.command(message.substring(1))
|
||||
return;
|
||||
}
|
||||
bot.chat.message(message)
|
||||
}
|
||||
}
|
||||
|
||||
bot.tellraw = (selector, message) => {
|
||||
bot.core.run(`minecraft:tellraw ${selector} ` + JSON.stringify(message))
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(`minecraft:tellraw ${selector} ` + JSON.stringify(bot.getMessageAsPrismarine(message)?.toMotd()))
|
||||
} else {
|
||||
bot.core.run(`minecraft:tellraw ${selector} ` + JSON.stringify(message))
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = chat;
|
||||
module.exports = {
|
||||
data: {
|
||||
enabled: true,
|
||||
name: "chat",
|
||||
type: "logging"
|
||||
},
|
||||
inject
|
||||
};
|
||||
|
||||
|
||||
+260
-27
@@ -1,27 +1,89 @@
|
||||
function core (bot, options, config) {
|
||||
const nbt = require('prismarine-nbt');
|
||||
const sleep = require('../util/sleep');
|
||||
|
||||
function inject (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
|
||||
|
||||
if (!pos) return
|
||||
if (bot.options.useChat || bot.options.isCreayun || bot.options.isSavage) return
|
||||
if (isNaN(pos.x + start.x)) {
|
||||
bot.chat.command('spawn');
|
||||
return
|
||||
if (bot.options.mode === "creayun") return;
|
||||
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} command_block`
|
||||
} else {
|
||||
command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} 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;
|
||||
|
||||
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: bot.registry.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,
|
||||
cursorY: 0,
|
||||
cursorZ: 0,
|
||||
insideBlock: false
|
||||
});
|
||||
|
||||
if (bot.core.usePlacedCommandBlock) {
|
||||
return
|
||||
} else {
|
||||
bot._client.write('update_command_block', {
|
||||
location: itemPosition,
|
||||
command,
|
||||
flags: 5,
|
||||
mode: 1
|
||||
})
|
||||
}
|
||||
/*^^^
|
||||
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
|
||||
*/
|
||||
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)}'}`)
|
||||
},
|
||||
|
||||
move (pos = bot.position) {
|
||||
@@ -29,8 +91,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: Math.floor(pos.x - 2),
|
||||
y: Math.floor(pos.y - 2),
|
||||
z: Math.floor(pos.z - 2)
|
||||
}
|
||||
|
||||
if (config.core.itemRefill && bot.options.mode !== "savageFriends") {
|
||||
bot.core.itemRefill();
|
||||
} else {
|
||||
bot.core.chatRefill();
|
||||
}
|
||||
bot.core.refill()
|
||||
},
|
||||
|
||||
currentBlock () {
|
||||
@@ -64,23 +137,183 @@ 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) {
|
||||
return
|
||||
const location = bot.core.currentBlock();
|
||||
const itemPosition = bot.core.itemPosition;
|
||||
|
||||
if (!location) return;
|
||||
if (bot.options.mode === "creayun") {
|
||||
return;
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot._client.write('update_command_block', {
|
||||
command: command.substring(0, 32767),
|
||||
location: location,
|
||||
mode: 2,
|
||||
flags: 0b101,
|
||||
});
|
||||
|
||||
bot.core.incrementCurrentBlock();
|
||||
} 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();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
async runTracked (command, selector) {
|
||||
const location = bot.core.itemPosition;
|
||||
let transactionId = Math.floor(Math.random() * 10000);
|
||||
|
||||
bot._client.write('set_creative_slot', {
|
||||
slot: 36,
|
||||
item: {
|
||||
present: true,
|
||||
itemId: bot.registry.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: {
|
||||
x: location.x,
|
||||
y: location.y - 1,
|
||||
z: location.z
|
||||
},
|
||||
face: 0
|
||||
});
|
||||
|
||||
bot._client.write('block_place', {
|
||||
hand: 0,
|
||||
location,
|
||||
direction: 0,
|
||||
cursorX: 0,
|
||||
cursorY: 0,
|
||||
cursorZ: 0,
|
||||
insideBlock: false
|
||||
});
|
||||
|
||||
bot._client.write('update_command_block', {
|
||||
command: command.substring(0, 32767),
|
||||
location: {
|
||||
x: location.x,
|
||||
y: location.y,
|
||||
z: location.z
|
||||
},
|
||||
flags: 0b101,
|
||||
mode: 1
|
||||
});
|
||||
|
||||
await sleep(100);
|
||||
|
||||
bot._client.write('query_block_nbt', { location, transactionId });
|
||||
|
||||
bot.on('packet.nbt_query_response', (data) => {
|
||||
try {
|
||||
if (data.transactionId == transactionId) {
|
||||
if (data?.nbt?.value?.LastOutput) {
|
||||
bot.tellraw("@a", JSON.parse(data.nbt.value.LastOutput.value).extra);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack)
|
||||
}
|
||||
});
|
||||
|
||||
bot._client.removeListener('nbt_query_response');
|
||||
}
|
||||
}
|
||||
// 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)
|
||||
|
||||
if (options.mode === "creayun") return;
|
||||
let timer;
|
||||
bot.on('packet.block_change', (data) => {
|
||||
try {
|
||||
if (data?.location?.x === bot?.core?.position?.x && data?.location?.y === bot?.core?.position?.y && data?.location?.z === bot?.core?.position?.z && data.type === 0) {
|
||||
bot.core.move(bot.position);
|
||||
}
|
||||
} catch (e) {
|
||||
bot.console.warn(e.toString());
|
||||
}
|
||||
});
|
||||
|
||||
bot.on('move', async () => {
|
||||
try {
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
await sleep(2000);
|
||||
bot.chat.command('/removenear commandblock');
|
||||
await sleep(2000);
|
||||
bot.core.move(bot.position);
|
||||
|
||||
} else {
|
||||
bot.core.move(bot.position);
|
||||
}
|
||||
} catch (e) {
|
||||
bot.console.warn(e.toString());
|
||||
}
|
||||
});
|
||||
|
||||
bot.on('packet.login', () => {
|
||||
timer = setInterval(() => {
|
||||
bot.core.move(bot.position)
|
||||
}, config.core.refillInterval)
|
||||
});
|
||||
|
||||
bot.on('end', () => {
|
||||
if (timer) clearInterval(timer);
|
||||
});
|
||||
|
||||
bot.on('packet.multi_block_change', (data) => {
|
||||
try {
|
||||
if (bot.options.mode !== "kaboom") return;
|
||||
|
||||
let broken = true;
|
||||
|
||||
if (
|
||||
data.chunkCoordinates.x === Math.floor(bot.core.position.x / 16)
|
||||
&&
|
||||
data.chunkCoordinates.y === Math.floor(bot.core.position.y / 16)
|
||||
&&
|
||||
data.chunkCoordinates.z === Math.floor(bot.core.position.z / 16)
|
||||
) {
|
||||
for (const state of data.records) {
|
||||
if ((state >= 7906) && (state >= 7917)) broken = false;
|
||||
if ((state >= 12527) && (state >= 12538)) broken = false;
|
||||
if ((state >= 12515) && (state >= 12526)) broken = false;
|
||||
else broken = true;
|
||||
}
|
||||
|
||||
if (broken === true) bot.core.move(bot.position);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = core;
|
||||
module.exports = {
|
||||
data: {
|
||||
enabled: true,
|
||||
name: "core",
|
||||
type: "extras"
|
||||
},
|
||||
inject
|
||||
};
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
const CommandSource = require('../util/command_source');
|
||||
|
||||
function inject (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;
|
||||
prefixes.map((prefix) => {
|
||||
const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString();
|
||||
|
||||
if (!plainMessage.startsWith(prefix)) return
|
||||
const command = plainMessage.substring(prefix.length)
|
||||
const source = new CommandSource(data.sender, { discord: false, console: false }, true)
|
||||
ratelimit++
|
||||
setTimeout(() => {
|
||||
ratelimit--
|
||||
}, 1000)
|
||||
if (ratelimit > 2) {
|
||||
bot.tellraw('@a', { text: 'You are using commands too fast!', color: 'dark_red'})
|
||||
} else if (command.split(" ")[0].length === 0) {
|
||||
} else {
|
||||
bot.commandManager.executeString(source, command)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
enabled: true,
|
||||
name: "command handler",
|
||||
type: "commands"
|
||||
},
|
||||
inject
|
||||
};
|
||||
@@ -1,4 +1,5 @@
|
||||
function command_loop (bot, options, config) {
|
||||
function inject (context) {
|
||||
const bot = context.bot;
|
||||
bot.cloop = {
|
||||
list: [],
|
||||
add (command, interval) {
|
||||
@@ -11,6 +12,7 @@ function command_loop (bot, options, config) {
|
||||
})
|
||||
|
||||
bot.on('packet.login', () => {
|
||||
if (this.list.length === 0) return
|
||||
timer = ({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
|
||||
this.list.push(timer);
|
||||
})
|
||||
@@ -27,4 +29,12 @@ function command_loop (bot, options, config) {
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = command_loop;
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
enabled: true,
|
||||
name: "command loop",
|
||||
type: "extras"
|
||||
},
|
||||
inject
|
||||
};
|
||||
|
||||
+118
-163
@@ -2,144 +2,110 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
const CommandError = require('../util/command_error.js');
|
||||
const CommandSource = require('../util/command_source');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
function command_manager (bot, options, config, discordClient) {
|
||||
const fixansi = require('../util/ansi');
|
||||
const cmdMgrUtil = require('../util/command_manager_util');
|
||||
const sleep = require('../util/sleep.js');
|
||||
|
||||
async function inject (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const options = context.options;
|
||||
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
|
||||
bot.commandManager = {
|
||||
commands: {},
|
||||
commandlist: [],
|
||||
execute (source, commandName, args) {
|
||||
const command = this.getCommand(commandName.toLowerCase());
|
||||
try {
|
||||
if (source?.sources?.discord && !source?.sources?.console) {
|
||||
if (!command || !command?.execute) {
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.error}`)
|
||||
.setTitle("Unknown command")
|
||||
.setDescription(`Unknown command: ${commandName}`)
|
||||
bot?.discord?.message?.reply({ embeds: [Embed] })
|
||||
}
|
||||
} else if (!source?.sources?.discord && !source?.sources?.console) {
|
||||
if (!command || !command.execute)
|
||||
throw new CommandError([
|
||||
{
|
||||
translate: `command.unknown.command`
|
||||
},
|
||||
{
|
||||
text: '\n'
|
||||
},
|
||||
{
|
||||
text: `${commandName} `
|
||||
},
|
||||
{
|
||||
translate: "command.context.here"
|
||||
}
|
||||
])
|
||||
} 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"
|
||||
}
|
||||
])
|
||||
}
|
||||
if (command?.trustLevel > 0) {
|
||||
const event = bot.discord.message;
|
||||
const roles = event?.member?.roles?.cache;
|
||||
if (command?.trustLevel === 1 && !source?.sources?.discord) {
|
||||
// const hash = args[0]
|
||||
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" })
|
||||
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}`)
|
||||
if (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!' })
|
||||
}
|
||||
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" })
|
||||
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" })
|
||||
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!' })
|
||||
} else if (command?.trustLevel === 4 && !source.sources.console) {
|
||||
throw new CommandError('This command can only be ran via console');
|
||||
}
|
||||
}
|
||||
if (!command?.discordExecute && command && source?.sources?.discord) {
|
||||
throw new CommandError(`${command.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!`)
|
||||
} else if (command?.execute && command && !source?.sources?.discord) {
|
||||
return command?.execute({ bot, source, arguments: args, config, discordClient})
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error.stack)
|
||||
if (source?.sources?.discord && !source?.sources?.console) {
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.error}`)
|
||||
.setTitle(`${command?.name} command`)
|
||||
.setDescription(`\`\`\`${error}\`\`\``)
|
||||
bot?.discord?.message?.reply({
|
||||
embeds: [
|
||||
Embed
|
||||
if (!command) {
|
||||
if (source?.sources?.console) {
|
||||
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" }
|
||||
]
|
||||
})
|
||||
} else if (!source?.sources?.discord && !source?.sources?.console) {
|
||||
if (error instanceof CommandError) {
|
||||
if (bot.options.isSavage || bot.options.isCreayun) {
|
||||
bot.chat.message(`&4${error.message}`)
|
||||
} else {
|
||||
bot.tellraw("@a", { text: error.message, color: "dark_red" })
|
||||
}
|
||||
})?.toAnsi());
|
||||
} else {
|
||||
if (bot.options.isSavage || bot.options.isCreayun) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine({ translate: "command.failed", color: "dark_red" })?.toMotd().replaceAll('§','&')}`)
|
||||
} else {
|
||||
bot.tellraw("@a", [{ translate: 'command.failed', color: "dark_red", hoverEvent: { action: 'show_text', contents: `${error.stack}` } }])
|
||||
}
|
||||
throw new CommandError({
|
||||
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" }
|
||||
]
|
||||
});
|
||||
}
|
||||
// else bot.tellraw("@a", [{ translate: 'command.failed', color: "dark_red", hoverEvent: { action: 'show_text', contents: `${error.stack}` } }])
|
||||
//}
|
||||
}
|
||||
|
||||
cmdMgrUtil(bot, command, args, source, config);
|
||||
|
||||
return command?.execute({ bot, source, arguments: args, config, discordClient });
|
||||
} catch (error) {
|
||||
if (error instanceof CommandError) {
|
||||
bot.tellraw("@a", error._message);
|
||||
} else {
|
||||
bot.tellraw("@a", {
|
||||
translate: "command.failed",
|
||||
color: "red",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
contents: String(error.stack)
|
||||
}
|
||||
});
|
||||
|
||||
bot?.console?.warn(error.stack);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
executeString (source, command) {
|
||||
const [commandName, ...args] = command.split(' ')
|
||||
return this.execute(source, commandName, args)
|
||||
const [commandName, ...args] = command.split(' ');
|
||||
if (source?.sources?.discord) {
|
||||
return this.discordExecute(source, commandName, args);
|
||||
} else if (!source?.sources?.discord) {
|
||||
return this.execute(source, commandName, args);
|
||||
}
|
||||
},
|
||||
|
||||
discordExecute(source, command) {
|
||||
const [commandName, ...args] = command.split(" ");
|
||||
if (source?.sources?.discord && !source.sources.console) {
|
||||
return this.discordExecute(source, commandName, args)
|
||||
}
|
||||
discordExecute(source, commandName, args) {
|
||||
const command = this.getCommand(commandName.toLowerCase());
|
||||
|
||||
try {
|
||||
if (!command) {
|
||||
throw new CommandError(`Unknown Command: ${commandName}`);
|
||||
}
|
||||
|
||||
cmdMgrUtil(bot, command, args, source, config);
|
||||
|
||||
if (!command?.discordExecute) {
|
||||
throw new CommandError(`${command.data.name} command is not supported in discord!`);
|
||||
} else if (source.sources.discord) {
|
||||
return command?.discordExecute({ bot, source, arguments: args, config, discordClient, fixansi });
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof CommandError) {
|
||||
bot?.discord?.message?.reply(`${bot.getMessageAsPrismarine(error._message)}`);
|
||||
} else {
|
||||
bot?.discord?.message?.reply(`\`\`\`${error.stack}\`\`\``);
|
||||
bot?.console?.warn(error.stack);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
register (command) {
|
||||
this.commands[command.name] = command
|
||||
if (command.aliases) {
|
||||
command.aliases.map((a) => (this.commands[a] = command));
|
||||
this.commands[command.data.name] = command
|
||||
if (command.data.aliases) {
|
||||
command.data.aliases.map((a) => (this.commands[a] = command));
|
||||
}
|
||||
},
|
||||
unregister (command) {
|
||||
this.commands = {};
|
||||
},
|
||||
|
||||
getCommand (name) {
|
||||
return this.commands[name]
|
||||
},
|
||||
@@ -147,54 +113,43 @@ function command_manager (bot, options, config, discordClient) {
|
||||
getCommands () {
|
||||
return Object.values(this.commands)
|
||||
},
|
||||
|
||||
reload() {
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, "../commands"))) {
|
||||
try {
|
||||
delete require.cache[require.resolve(path.join(__dirname, "../commands/", filename))]
|
||||
const command = require(path.join(__dirname, "../commands/", filename));
|
||||
bot.commandManager.register(command);
|
||||
bot.commandManager.commandlist.pop(command)
|
||||
bot.commandManager.commandlist.push(command)
|
||||
} catch (error) {
|
||||
bot.tellraw("@a", { text: `Failed to reload file ${filename}\n${error.stack}`, color: "red" })
|
||||
bot?.console?.fileLogger(error.stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
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 {
|
||||
const command = require(path.join(__dirname, '../commands', filename))
|
||||
bot.commandManager.register(command)
|
||||
bot.commandManager.commandlist.push(command)
|
||||
} catch (error) {
|
||||
console.error('Failed to load command', filename, ':', error)
|
||||
bot?.console.filelogging(error.stack)
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
let ratelimit = 0;
|
||||
bot.on("parsed_message", (data) => {
|
||||
if (data.type !== "minecraft:chat") return;
|
||||
const prefixes = config.prefixes;
|
||||
prefixes.map((prefix) => {
|
||||
const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString();
|
||||
if (!plainMessage.startsWith(prefix)) return
|
||||
const command = plainMessage.substring(prefix.length)
|
||||
const source = new CommandSource(data.sender, { discord: false, console: false }, true)
|
||||
ratelimit++
|
||||
setTimeout(() => {
|
||||
ratelimit--
|
||||
}, 1000)
|
||||
if (ratelimit > 2) {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'You are using commands too fast!', color: 'dark_red'})
|
||||
} else if (command.split(" ")[0].length === 0) {
|
||||
} else {
|
||||
bot.commandManager.executeString(source, command)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
module.exports = command_manager;
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
enabled: true,
|
||||
name: "command manager",
|
||||
type: "commands"
|
||||
},
|
||||
inject
|
||||
};
|
||||
|
||||
+31
-40
@@ -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 inject (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
let ratelimit = 0;
|
||||
bot.console = {
|
||||
readline: null,
|
||||
server: 'all',
|
||||
@@ -12,14 +16,20 @@ function Console (bot, options, config) {
|
||||
if (args.startsWith(config.console.prefix)) {
|
||||
return bot.commandManager.executeString(bot.console.source, args.substring(config.console.prefix.length))
|
||||
} else if (args.startsWith("")) {
|
||||
return bot.commandManager.executeString(bot.console.source, `console say ${args.substring(0)}`);
|
||||
bot.chat.send(args);
|
||||
}
|
||||
rl.on('close', () => {
|
||||
this.readline = null;
|
||||
})
|
||||
})
|
||||
},
|
||||
source: new CommandSource(bot.options.username, { console: true, discord: false }),
|
||||
source: new CommandSource({
|
||||
profile: {
|
||||
name: bot._client.username
|
||||
}, uuid: bot._client.uuid },
|
||||
{ console: true, discord: false
|
||||
}),
|
||||
|
||||
refreshLine (...args) {
|
||||
this.readline.output.write("\x1b[2K\r");
|
||||
console.log.apply(console, arguments);
|
||||
@@ -37,46 +47,27 @@ function Console (bot, options, config) {
|
||||
info (message) {
|
||||
this.refreshLine(prismarineChat.fromNotch(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §2info§8] §8[${options.serverName}§8] `)?.toAnsi() + message)
|
||||
},
|
||||
customChat: {
|
||||
enabled: false,
|
||||
chat (message) {
|
||||
const prefix = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
color:'dark_gray',
|
||||
with: [
|
||||
{
|
||||
text: 'FNFBoyfriendBot Console',
|
||||
color:'#00FFFF'
|
||||
},
|
||||
{
|
||||
selector: `${bot.username}`, color:'#00FFFF',
|
||||
clickEvent: { action: 'suggest_command', value: `${config.prefixes[0]}help` }
|
||||
},
|
||||
{
|
||||
text: '',
|
||||
extra: [`${message}`],
|
||||
color:'white'
|
||||
},
|
||||
],
|
||||
hoverEvent: { action:"show_text", value: 'FNF Sky is a fangirl but a simp for boyfriend confirmed??'},
|
||||
clickEvent: 'https://doin-your.mom' ?
|
||||
{ action: 'open_url', value: 'https://doin-your.mom' } : undefined,
|
||||
}
|
||||
bot.tellraw('@a', prefix)
|
||||
}
|
||||
debug (message) {
|
||||
console.log(prismarineChat.fromNotch(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §6debug§8] §8[${options.serverName}§8] `)?.toAnsi() + message)
|
||||
}
|
||||
}
|
||||
setInterval(() => ratelimit = 0, 1000 * 2);
|
||||
|
||||
bot.on('message', (message) => {
|
||||
rateLimit++
|
||||
setTimeout(() => {
|
||||
rateLimit--
|
||||
}, 1000)
|
||||
if (!options.logging) return;
|
||||
/* if (rateLimit > 100) {
|
||||
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;
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
enabled: true,
|
||||
name: "console",
|
||||
type: "logging"
|
||||
},
|
||||
inject
|
||||
};
|
||||
|
||||
+61
-38
@@ -1,35 +1,34 @@
|
||||
// TODO: Maybe move client creation elsepwhere
|
||||
const { Client, GatewayIntentBits, interaction } = require('discord.js')
|
||||
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits
|
||||
const fixansi = require('../util/ansi');
|
||||
const CommandSource = require('../util/command_source')
|
||||
const CommandSource = require('../util/command_source');
|
||||
|
||||
const client = new Client({ intents: [Guilds, GuildMessages, MessageContent] })
|
||||
const util = require('util')
|
||||
|
||||
function discord(bot, options, config, discordClient) {
|
||||
if (!options?.channelId) {
|
||||
function inject (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
|
||||
invite: config.discord?.invite,
|
||||
client: discordClient,
|
||||
prefix: config.discord.prefix
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
bot.discord = {
|
||||
client: discordClient,
|
||||
channel: undefined,
|
||||
invite: config.discord.invite || undefined,
|
||||
prefix: config.discord.prefix,
|
||||
// presence: bot.discord.presence,
|
||||
// token: config.discord.token,
|
||||
}
|
||||
discordClient.once('ready', (context) => {
|
||||
bot.discord.channel = discordClient.channels.cache.get(options.channelId)
|
||||
discordClient.user.setPresence({
|
||||
activities: [{
|
||||
name: `your mother`,
|
||||
name: `${config.discord.presence.name}`,
|
||||
type: 0
|
||||
}],
|
||||
status: `dnd`
|
||||
status: `${config.discord.presence.status}`
|
||||
});
|
||||
})
|
||||
|
||||
@@ -39,7 +38,6 @@ 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())
|
||||
}
|
||||
discordQueue = []
|
||||
}, 2000)
|
||||
@@ -53,13 +51,14 @@ function discord(bot, options, config, discordClient) {
|
||||
try {
|
||||
sendDiscordMessage(fixansi(ansi?.replaceAll('`', '`\u200b')))
|
||||
} catch (e) {
|
||||
bot.console.error(`Error sending a message to Discord:\n${e.message}`)
|
||||
bot.console.warn(`Error sending a message to Discord: ${e.message}`)
|
||||
sendDiscordMessage(e.message)
|
||||
}
|
||||
}
|
||||
bot.on('message', message => {
|
||||
sendComponent(message)
|
||||
})
|
||||
|
||||
bot.on('message', (message) => {
|
||||
sendComponent(message);
|
||||
});
|
||||
|
||||
function messageCreate(message, source) {
|
||||
bot.discord.message = message;
|
||||
@@ -70,22 +69,20 @@ 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,
|
||||
console: false
|
||||
}, false, message)
|
||||
}, false, message);
|
||||
|
||||
bot.sendFeedback = message => {
|
||||
sendComponent(message)
|
||||
}
|
||||
sendComponent(message);
|
||||
|
||||
bot.commandManager.executeString(source, message.content.substring(config.discord.prefix.length))
|
||||
return
|
||||
}
|
||||
const tag = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
translate: '[%s] %s \u203a ',
|
||||
with: [{
|
||||
translate: '%s%s%s %s',
|
||||
bold: false,
|
||||
@@ -107,7 +104,7 @@ function discord(bot, options, config, discordClient) {
|
||||
{
|
||||
text: 'Discord',
|
||||
bold: false,
|
||||
color: 'dark_blue'
|
||||
color: 'blue'
|
||||
}
|
||||
],
|
||||
clickEvent: bot.discord.invite ? {
|
||||
@@ -120,34 +117,60 @@ function discord(bot, options, config, discordClient) {
|
||||
}
|
||||
},
|
||||
{
|
||||
text: message?.member?.displayName
|
||||
text: `${message.member.nickname || message.author.displayName}`,
|
||||
},
|
||||
message.content
|
||||
]
|
||||
}
|
||||
|
||||
try {
|
||||
if (message.attachments.size > 0) {
|
||||
message.attachments.forEach(Attachment => {
|
||||
bot.tellraw('@a', [tag, {
|
||||
text: ' ' ? ' [Attachment] ' : ' [Attachment] ',
|
||||
let attachment = {
|
||||
text: `[Attachment: ${Attachment.name}] ${message?.content}`,
|
||||
color: "blue",
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
contents: 'Click here to view attachment'
|
||||
action: "show_text",
|
||||
contents: "click here to view attachment"
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'open_url',
|
||||
value: `${Attachment.url}`
|
||||
action: "open_url",
|
||||
value: `${Attachment?.url}`
|
||||
}
|
||||
}])
|
||||
}
|
||||
|
||||
bot.tellraw("@a", [tag, attachment]);
|
||||
})
|
||||
} else if (message?.reference?.type === 0) {
|
||||
// this is for messages that are replied to
|
||||
const repliedMessage = message.channel.messages.cache.get(message.reference.messageId);
|
||||
let reply = [
|
||||
tag,
|
||||
{ text: `[Replying to: ${repliedMessage.author.username}] `, color: "blue" },
|
||||
message.content
|
||||
];
|
||||
|
||||
bot.tellraw("@a", [ reply ]);
|
||||
} else if (message?.reference?.type === 1) {
|
||||
// this is for messages that are forwarded
|
||||
} else {
|
||||
if (options.useChat || options.isSavage || options.isCreayun) {
|
||||
if (options.mode === "creayun") {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(`&7[&9FNF&3Boyfriend&1Bot Discord&7] ${message?.member?.displayName} \u203a ${message?.content}`)?.toMotd().replaceAll('§','&'))
|
||||
} else {
|
||||
bot.tellraw('@a', tag);
|
||||
bot.tellraw('@a', [tag, message.content]);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
}
|
||||
discordClient.on('messageCreate', messageCreate)
|
||||
|
||||
}
|
||||
module.exports = discord;
|
||||
module.exports = {
|
||||
data: {
|
||||
enabled: true,
|
||||
name: "discord",
|
||||
type: "logging"
|
||||
},
|
||||
inject
|
||||
};
|
||||
|
||||
@@ -3,20 +3,22 @@ const path = require("path");
|
||||
const { createGzip } = require("zlib");
|
||||
const readline = require('readline');
|
||||
const { Console } = require("console");
|
||||
function fileLogger(bot, options, message) {
|
||||
|
||||
function inject (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()
|
||||
.padStart(2, "0")}-${currentDate.getDate().toString().padStart(2, "0")}`;
|
||||
const logFolder = path.join(__dirname, "../../logs");
|
||||
const logFolder = path.join(__dirname, `${config.logsFolder.path}`, `${config.logsFolder.name}`);
|
||||
const logFileName = "latest.log";
|
||||
const logFilePath = path.join(logFolder, logFileName);
|
||||
const logStream = fs.createWriteStream(logFilePath, { flags: "a" });
|
||||
if (!fs.existsSync(path.join(__dirname, "../../logs"))) {
|
||||
fs.mkdirSync(path.join(__dirname, "../../logs"))
|
||||
}
|
||||
try {
|
||||
if (!fs.existsSync(logFolder)) {
|
||||
console.info(`logs folder not found recreating it at ${config.logsFolder.path}${config.logsFolder.name}`);
|
||||
fs.mkdirSync(logFolder);
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -24,7 +26,6 @@ function fileLogger(bot, options, message) {
|
||||
}
|
||||
|
||||
function compressFile(input, output) {
|
||||
// if (!bot.Console.filelogging) return
|
||||
const plainOutput = output.slice(0, -3);
|
||||
|
||||
fs.renameSync(input, plainOutput);
|
||||
@@ -57,4 +58,11 @@ function fileLogger(bot, options, message) {
|
||||
logStream.write(message + "\n");
|
||||
};
|
||||
}
|
||||
module.exports = fileLogger;
|
||||
module.exports = {
|
||||
data: {
|
||||
enabled: true,
|
||||
name: "file logger",
|
||||
type: "logging"
|
||||
},
|
||||
inject
|
||||
};
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
function filter (bot, options, config, discordClient) {
|
||||
if (options.isSavage || options.isCreayun) return;
|
||||
// filter v5 (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 () {
|
||||
for (const filteredPlayers of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
|
||||
if (filteredPlayers.ignoreCase) {
|
||||
check = bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase())
|
||||
} else if (filteredPlayers.regexed) {
|
||||
let regex = new RegExp(filteredPlayers.name);
|
||||
check = bot.players.find((players) => regex.test(players.profile.name))
|
||||
} else if (filteredPlayers.ignoreCase && filteredPlayers.regexed) {
|
||||
let regex = new RegExp(filteredPlayers.name.toLowerCase());
|
||||
check = bot.players.find((players) => regex.test(players.profile.name.toLowerCase()))
|
||||
} else {
|
||||
check = bot.players.find((players) => players.profile.name === filteredPlayers.name)
|
||||
}
|
||||
}
|
||||
if (!check) return;
|
||||
bot.core.run(`execute run gamemode adventure @a[name="${check?.profile?.name}"]`)
|
||||
bot.core.run(`execute run deop @a[name="${check?.profile?.name}"]`);
|
||||
bot.core.run(`essentials:mute ${check?.uuid} 10y`);
|
||||
}
|
||||
}
|
||||
bot.on('message', (message) => {
|
||||
try {
|
||||
const stringMessage = bot.getMessageAsPrismarine(message)?.toString()
|
||||
for (const filteredPlayers of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
|
||||
if (filteredPlayers.ignoreCase) {
|
||||
if (!bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase())) return;
|
||||
else if (bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase()).gamemode !== 2) {
|
||||
bot.core.run(`execute run gamemode adventure @a[name="${bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase()).profile.name}"]`);
|
||||
} else if (stringMessage.includes('op')) {
|
||||
setTimeout(() => {
|
||||
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase()).profile.name}"]`)
|
||||
}, 10);
|
||||
}
|
||||
} else if (filteredPlayers.regexed) {
|
||||
let regex = new RegExp(filteredPlayers.name);
|
||||
if (!bot.players.find((players) => regex.test(players.profile.name))) return;
|
||||
else if (bot.players.find((players) => regex.test(players.profile.name)).gamemode !== 2) {
|
||||
bot.core.run(`execute run gamemode adventure @a[name="${bot.players.find((players) => regex.test(players.profile.name)).profile.name}"]`);
|
||||
} else if (stringMessage.includes('op')) {
|
||||
setTimeout(() => {
|
||||
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => regex.test(players.profile.name)).profile.name}"]`);
|
||||
}, 10)
|
||||
}
|
||||
} else if (filteredPlayers.ignoreCase && filteredPlayers.regexed) {
|
||||
let regex = new RegExp(filteredPlayers.name.toLowerCase());
|
||||
if (!bot.players.find((players) => regex.test(players.profile.name.toLowerCase()))) return;
|
||||
else if (bot.players.find((players) => regex.test(players.profile.name.toLowerCase())).gamemode !== 2) {
|
||||
bot.core.run(`execute run gamemode adventure @a[name="${bot.players.find((players) => regex.test(players.profile.name.toLowerCase())).profile.name}"]`);
|
||||
} else if (stringMessage.includes('op')) {
|
||||
setTimeout(() => {
|
||||
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => regex.test(players.profile.name.toLowerCase())).profile.name}"]`);
|
||||
}, 10)
|
||||
}
|
||||
} else {
|
||||
if (!bot.players.find((players) => players.profile.name === filteredPlayers.name)) return;
|
||||
else if (bot.players.find((players) => players.profile.name === filteredPlayers.name).gamemode !== 2) {
|
||||
bot.core.run(`execute run gamemode adventure @a[name="${bot.players.find((players) => players.profile.name === filteredPlayers.name).profile.name}"]`);
|
||||
} else if (stringMessage.includes('op')) {
|
||||
setTimeout(() => {
|
||||
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => players.profile.name === filteredPlayers.name).profile.name}"]`);
|
||||
}, 10)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
bot.console.warn(e.stack);
|
||||
}
|
||||
})
|
||||
|
||||
bot.on('parsed_message', (message) => {
|
||||
const stringMessage = bot.getMessageAsPrismarine(message)?.toString();
|
||||
for (const filteredPlayers of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
|
||||
if (filteredPlayers.ignoreCase) {
|
||||
check = bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase())
|
||||
} else if (filteredPlayers.regexed) {
|
||||
let regex = new RegExp(filteredPlayers.name);
|
||||
check = bot.players.find((players) => regex.test(players.profile.name))
|
||||
} else if (filteredPlayers.ignoreCase && filteredPlayers.regexed) {
|
||||
let regex = new RegExp(filteredPlayers.name.toLowerCase());
|
||||
check = bot.players.find((players) => regex.test(players.profile.name.toLowerCase()))
|
||||
} else {
|
||||
check = bot.players.find((players) => players.profile.name === filteredPlayers.name)
|
||||
}
|
||||
}
|
||||
if (bot.filter.list().length === 0) return;
|
||||
if (!check) return;
|
||||
if (!bot.players) return;
|
||||
if (message.sender.profile.name === check?.profile?.name) {
|
||||
bot.core.run(`essentials:mute ${check?.uuid} 10y`);
|
||||
}
|
||||
})
|
||||
}
|
||||
module.exports = filter;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user