Compare commits
22 commits
Author | SHA1 | Date | |
---|---|---|---|
|
a140a2d12e | ||
|
8f61177250 | ||
|
ab87e748f9 | ||
|
ca45444dd5 | ||
|
ac2f59d14d | ||
|
ee887d5081 | ||
|
0a637e0c8f | ||
|
3344fc6e2e | ||
|
0aed4d7d7a | ||
|
831fda8607 | ||
|
c6f77b0ac3 | ||
|
e75576a488 | ||
|
0b264d7aaf | ||
|
fda85555fc | ||
6c77eb0405 | |||
86dee2fc1c | |||
0e3d337f03 | |||
ab0bee81fb | |||
43d7ab7b82 | |||
166abfcae8 | |||
|
9585f64ab7 | ||
|
648f4431d7 |
66 changed files with 2589 additions and 4868 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -3,3 +3,8 @@ config.yml
|
|||
.git
|
||||
src/modules/exploits.js
|
||||
logs/*
|
||||
src/data/filter.json
|
||||
data/filter.json
|
||||
prototyping-crap
|
||||
src/data/trustedPlayers.js
|
||||
data/trustedPlayers.js
|
||||
|
|
3240
package-lock.json
generated
3240
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,21 +1,24 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"color-convert": "^2.0.1",
|
||||
"cowsay": "^1.6.0",
|
||||
"cowsay2": "^2.0.4",
|
||||
"discord.js": "^14.11.0",
|
||||
"discord.js": "^14.16.3",
|
||||
"java-parser": "^2.3.2",
|
||||
"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-data": "^3.69.0",
|
||||
"minecraft-protocol": "^1.47.0",
|
||||
"mojangson": "^2.0.4",
|
||||
"node-gyp": "^10.2.0",
|
||||
"prismarine-auth": "^2.2.0",
|
||||
"prismarine-chat": "^1.10.1",
|
||||
"prismarine-registry": "^1.7.0",
|
||||
"proxy-agent": "^6.4.0",
|
||||
"socks": "^2.8.3",
|
||||
"wikipedia": "^2.1.2",
|
||||
"xml2js": "^0.6.2"
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
1. add discord hashes back to the bot (v6.0.0-beta)
|
||||
2. add a reset interval to cloops (v6.0.0-beta)
|
||||
3. finish useChat (v6.0.1)
|
||||
4. finish isSavage (v6.0.2)
|
||||
5. start working on isCreayun (v6.0.7) fuck you creayun
|
44
src/bot.js
44
src/bot.js
|
@ -1,8 +1,9 @@
|
|||
const mc = require('minecraft-protocol')
|
||||
const { EventEmitter } = require('events')
|
||||
//require("events").EventEmitter.defaultMaxListeners = Infinity;
|
||||
EventEmitter.defaultMaxListeners = Infinity
|
||||
const mc = require('minecraft-protocol');
|
||||
const { EventEmitter } = require('events');
|
||||
EventEmitter.defaultMaxListeners = 5e6;
|
||||
const util = require('util');
|
||||
const createRegistry = require('prismarine-registry');
|
||||
const ChatMessage = require('prismarine-chat');
|
||||
function createBot(options = {}, config) {
|
||||
const bot = new EventEmitter();
|
||||
bot.options = {
|
||||
|
@ -12,7 +13,6 @@ 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) => {
|
||||
|
@ -23,24 +23,27 @@ function createBot(options = {}, config) {
|
|||
client.on('login', () => {
|
||||
bot.uuid = client.uuid
|
||||
bot.username = client.username
|
||||
bot.registry = createRegistry(client.version)
|
||||
bot.registry.language = require('./data/language.json');
|
||||
bot.emit('registry_ready', bot.registry)
|
||||
})
|
||||
client.on('disconnect', (data) => {
|
||||
bot.emit("disconnect", JSON.stringify(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('disconnect', data => {
|
||||
bot.emit("disconnect", data);
|
||||
bot.console.warn(`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`)
|
||||
})
|
||||
|
||||
client.on('end', reason => {
|
||||
bot.emit('end', reason);
|
||||
if (reason === "socketClosed") return;
|
||||
bot.console.warn(ChatMessage(bot._client.version).fromNotch(`§8[§bClient Reconnect§8]§r ${reason}`)?.toAnsi())
|
||||
// bot = undefined;
|
||||
// config = undefined;
|
||||
})
|
||||
|
||||
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()))
|
||||
}
|
||||
bot.console.warn(ChatMessage(bot._client.version).fromNotch('§8[§bClient Reconnect§8]§r ')?.toAnsi() + util.inspect(error.toString()))
|
||||
bot?.discord?.channel?.send(error.toString())
|
||||
})
|
||||
|
||||
client.on("keep_alive", ({ keepAliveId }) => {
|
||||
|
@ -49,11 +52,8 @@ function createBot(options = {}, config) {
|
|||
|
||||
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.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(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))
|
||||
}
|
||||
})
|
||||
|
||||
process.on("uncaughtException", (e) => {
|
||||
|
@ -61,10 +61,10 @@ function createBot(options = {}, config) {
|
|||
});
|
||||
})
|
||||
|
||||
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;
|
||||
|
|
32
src/commands/admin/vanish.js
Normal file
32
src/commands/admin/vanish.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
module.exports = {
|
||||
data: {
|
||||
name: 'vanish',
|
||||
trustLevel: 2,
|
||||
aliases: [
|
||||
"vanishtoggle"
|
||||
],
|
||||
description: 'toggle the bots vanish selfcare',
|
||||
usages: [
|
||||
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
if (args.slice(1).join('') === 'true') {
|
||||
bot.vanished = true
|
||||
bot.chat.message('enabled vanish selfcare')
|
||||
}
|
||||
if (args.slice(1).join('') === 'false') {
|
||||
bot.vanished = false;
|
||||
bot.chat.message('disabled vanish selfcare')
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
bot.vanished = false;
|
||||
bot.chat.message('disabling vanish selfcare,...');
|
||||
bot.chat.command('v off')
|
||||
}
|
||||
}
|
|
@ -1,9 +1,19 @@
|
|||
module.exports = {
|
||||
name: 'console',
|
||||
trustLevel: 4,
|
||||
aliases: [
|
||||
data: {
|
||||
name: 'console',
|
||||
trustLevel: 4,
|
||||
description: "",
|
||||
aliases: [
|
||||
|
||||
],
|
||||
],
|
||||
usages: [
|
||||
'server/srv <all/servername>',
|
||||
'customchat <on/true/enable/off/false/disable>',
|
||||
'say <message>',
|
||||
'validate/validation/val <owner/o/admin/a/trusted/t>',
|
||||
'logging/togglelogging/logtoconsole <on/true/enable/off/false/disable>'
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
|
@ -52,7 +62,6 @@ module.exports = {
|
|||
case "validate":
|
||||
case "validation":
|
||||
case "val":
|
||||
// bot.chat.message(`${config.prefixes[0]}${args.slice(1).shift()} ${bot.validation.owner} ${args.slice(2).join(' ')}`)
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "owner":
|
||||
case "o":
|
||||
|
@ -60,6 +69,7 @@ module.exports = {
|
|||
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
|
||||
} else if (!bot.console.customChat.enabled) {
|
||||
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
|
||||
// bot.chat.message(`${config.prefixes[0]}${args.slice(2)} ${args.slice(3).shift()}${bot.validation.trusted}`)
|
||||
}
|
||||
break
|
||||
case "admin":
|
||||
|
@ -73,7 +83,7 @@ module.exports = {
|
|||
case "trusted":
|
||||
case "t":
|
||||
if (bot.console.customChat.enabled) {
|
||||
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`);
|
||||
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`);
|
||||
} else if (!bot.console.customChat.enabled) {
|
||||
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`);
|
||||
}
|
||||
|
@ -82,6 +92,34 @@ module.exports = {
|
|||
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
|
||||
}
|
||||
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:
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
|
||||
}
|
|
@ -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,373 +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) {
|
||||
if (args[0] === command.name) {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
{
|
||||
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: `${command.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: "Usages \u203a\n",
|
||||
color: "gray"
|
||||
},
|
||||
]);
|
||||
for (const usageArray of command.usages) {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: `${config.prefixes[0]}${command.name} ${usageArray}`, color: 'gray' })
|
||||
}
|
||||
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("§","&"))
|
||||
}, 200)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
|
||||
}, 200)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
|
||||
}, 200)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
|
||||
}, 200)
|
||||
} 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,379 +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 === '') {
|
||||
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\n",
|
||||
color: "gold",
|
||||
},
|
||||
{
|
||||
text: "Morgan Ankan - RecycleBot\n",
|
||||
color: "dark_green"
|
||||
},
|
||||
{
|
||||
text: "TurtleKid - TurtleBot",
|
||||
color: "dark_green"
|
||||
},
|
||||
])
|
||||
break
|
||||
case "about":
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
{
|
||||
text: `FNFBoyfriendBot is a open source kaboom bot created by Parker2991\nThe source code and changelog can be found here ${botInfo.bot.source}`,
|
||||
color: "gray",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "click here to view bots source code",
|
||||
color: "gray",
|
||||
}
|
||||
]
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `${botInfo.bot.source}`
|
||||
}
|
||||
}
|
||||
])
|
||||
break
|
||||
default:
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
let Embed;
|
||||
let ansi;
|
||||
let fix;
|
||||
let message;
|
||||
switch (args[0]) {
|
||||
case "version":
|
||||
message = bot.getMessageAsPrismarine(`§9Friday §9Night §9Funkin §3Boyfriend §1Bot§8§r-${botInfo.bot.buildstring.version}-#${botInfo.bot.buildstring.build}-${botInfo.bot.buildstring.codename}\n11/22/22 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`)?.toString()
|
||||
fix = fixansi(message.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] });
|
||||
break
|
||||
case "config":
|
||||
message = bot.getMessageAsPrismarine([
|
||||
{ text: `Minecraft username \u203a ${bot.options.username}\n`, color: 'gray', },
|
||||
{ text: `Ip \u203a ${bot.options.host}:${bot.options.port}\n`, color: "gray" },
|
||||
{ text: `Version \u203a ${bot.options.version}\n`, color: "gray" },
|
||||
{ text: `Discord username \u203a ${discordClient.user.tag}\n`, color: 'gray' },
|
||||
{ text: `Channel \u203a ${bot.discord.channel?.name}\n`, color: "gray" },
|
||||
{ text: `Server name \u203a ${bot.options.serverName}\n`, color: "gray" },
|
||||
{ text: `Server count \u203a ${bot.bots.length}\n`, color: "gray" },
|
||||
{ text: `Prefixes \u203a ${config.prefixes.map((e) => e + " ").join(' ')}\n`, color: "gray" },
|
||||
{ text: `Prefix Length: ${config.prefixes.length}\n`, color: "gray" },
|
||||
{ text: `isKaboom \u203a ${bot.options.isKaboom}\n`, color: "gray" },
|
||||
{ text: `isCreayun \u203a ${bot.options.isCreayun}\n`, color: "gray" },
|
||||
{ text: `isSavage \u203a ${bot.options.isSavage}\n`, color: "gray", } ])?.toAnsi();
|
||||
fix = fixansi(message.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
break
|
||||
case "server":
|
||||
message = bot.getMessageAsPrismarine([
|
||||
{ text: `Hostname \u203a ${os.hostname()}\n`, color: "gray" },
|
||||
{ text: `User \u203a ${os.userInfo().username}\n`, color: "gray" },
|
||||
{ text: `Working Directory \u203a ${process.mainModule.path}\n`, color: "gray" },
|
||||
{ text: `Arch \u203a ${os.arch()}\n`, color: "gray" }, { text: `OS \u203a ${os.platform()}\n`, color: "gray" },
|
||||
{ text: `OS Version/distro \u203a ${os.version()}\n`, color: "gray" },
|
||||
{ text: `Kernel Version \u203a ${os.release()}\n`, color: "gray" },
|
||||
{ text: `Cores \u203a ${os.cpus().length}\n`, color: "gray" },
|
||||
{ text: `CPU \u203a ${os.cpus()[0].model}\n`, color: "gray" },
|
||||
{ text: `Server Free memory `, color: 'gray' },
|
||||
{ text: `${Math.floor( os.freemem() / 1048576, )} `, color: 'gold' },
|
||||
{ text: 'MiB / ', color: 'gray' },
|
||||
{ text: `${Math.floor(os.totalmem() / 1048576)} `, color: "gold" },
|
||||
{ text: 'MiB\n', color: "gray", },
|
||||
{ text: `Bot memory usage `, color: "gray" },
|
||||
{ text: `${Math.floor( process.memoryUsage().heapUsed / 1048576, )} `, color: "gold", },
|
||||
{ text: "MiB / ", color: "gray", },
|
||||
{ text: `${Math.floor( process.memoryUsage().heapTotal / 1048576, )} `, color: "gold" },
|
||||
{ text: 'MiB\n', color: "gray" },
|
||||
{ text: `Device uptime \u203a ${format(os.uptime())}\n`, color: 'gray' },
|
||||
{ text: `Bot uptime \u203a ${format(process.uptime())}\n`, color: "gray" },
|
||||
{ text: `Node version \u203a ${process.version}`, color: 'gray' } ])?.toAnsi();
|
||||
fix = fixansi(message.replace('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
break
|
||||
default:
|
||||
throw new CommandError('Invalid argument');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
module.exports = {
|
||||
name: 'kill',
|
||||
trustLevel: 3,
|
||||
aliases: [
|
||||
"suicide",
|
||||
"quit",
|
||||
],
|
||||
description: 'kill the bots process',
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
process.exit(69);
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
process.exit(69);
|
||||
}
|
||||
}
|
22
src/commands/owner/kill.js
Normal file
22
src/commands/owner/kill.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
module.exports = {
|
||||
data: {
|
||||
name: 'kill',
|
||||
trustLevel: 3,
|
||||
aliases: [
|
||||
"suicide",
|
||||
"quit",
|
||||
],
|
||||
description: 'kill the bots process',
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
process.kill(process.pid);
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
process.kill(process.pid);
|
||||
}
|
||||
}
|
49
src/commands/owner/servereval.js
Normal file
49
src/commands/owner/servereval.js
Normal file
|
@ -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: 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`, [
|
||||
{
|
||||
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,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,
|
||||
usage:[""],
|
||||
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) {
|
33
src/commands/public/core.js
Normal file
33
src/commands/public/core.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
const CommandError = require('../../util/command_error')
|
||||
const sleep = require('../../util/sleep');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'core',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"cb",
|
||||
"corerun",
|
||||
"commandcorerun",
|
||||
],
|
||||
description: 'run commands in core!',
|
||||
usages: [
|
||||
"<command>",
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ');
|
||||
bot.core.run(message);
|
||||
await sleep(45);
|
||||
/* bot.on('commandBlockOutput', (packet) => {
|
||||
bot.tellraw("@a", require('util').inspect(packet));
|
||||
console.log(packet);
|
||||
})*/
|
||||
// bot.core.commandBlockOutput()
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
bot.core.run(args.join(' '));
|
||||
}
|
||||
}
|
|
@ -1,21 +1,24 @@
|
|||
const cowsay = require('cowsay2');
|
||||
const cows = require('cowsay2/cows');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const fixansi = require('../util/ansi');
|
||||
const fixansi = require('../../util/ansi');
|
||||
module.exports = {
|
||||
name: 'cowsay',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'amogus',
|
||||
usages: [
|
||||
"just wait till the command is ready :3"
|
||||
],
|
||||
data: {
|
||||
name: 'cowsay',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'cows',
|
||||
usages: [
|
||||
"<message>",
|
||||
"list"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
if (args[0] === "list") {
|
||||
if (args[0]?.toLowerCase() === "list") {
|
||||
const list = Object.keys(cows);
|
||||
let content = [];
|
||||
let color = true;
|
||||
|
@ -56,7 +59,7 @@ module.exports = {
|
|||
const fixAnsiList = fixansi(ansiList.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fixAnsiList}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
} else if (cows[args[0]]) {
|
||||
|
@ -64,7 +67,7 @@ module.exports = {
|
|||
const fixAnsiCow1 = fixansi(ansiCow1.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fixAnsiCow1}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
} else {
|
|
@ -1,14 +1,16 @@
|
|||
module.exports = {
|
||||
name: 'echo',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"say",
|
||||
"botsay",
|
||||
],
|
||||
description: 'Make me say something',
|
||||
usages: [
|
||||
"<message>"
|
||||
],
|
||||
data: {
|
||||
name: 'echo',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"say",
|
||||
"botsay",
|
||||
],
|
||||
description: 'Make me say something',
|
||||
usages: [
|
||||
"<message>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
|
@ -16,7 +18,6 @@ module.exports = {
|
|||
bot.chat.command(message.substring(1))
|
||||
return
|
||||
}
|
||||
// if
|
||||
bot.chat.message(message)
|
||||
},
|
||||
discordExecute (context) {
|
454
src/commands/public/help.js
Normal file
454
src/commands/public/help.js
Normal file
|
@ -0,0 +1,454 @@
|
|||
const CommandError = require('../../util/command_error');
|
||||
const sleep = require('../../util/sleep.js');
|
||||
const fixansi = require('../../util/ansi');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'help',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"heko",
|
||||
"?",
|
||||
"cmds",
|
||||
"hell",
|
||||
"hello",
|
||||
"helo",
|
||||
"commands",
|
||||
"commandshelp",
|
||||
],
|
||||
description: 'a list of the bots commands',
|
||||
usages: [
|
||||
"",
|
||||
"<command>",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const commandList = [];
|
||||
const bot = context.bot;
|
||||
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.data.usages) {
|
||||
if (command?.data?.trustLevel === 1) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.data.name} <trusted/admin/owner hashes>`, color: "blue" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.data.trustLevel === 2) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.data.name} <admin/owner hashes>`, color: "blue" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.data.trustLevel === 3) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.data.name} <owner hash>`, color: "blue" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.data.trustLevel === 0 || command.data.trustLevel === 4) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.data.name}`, color: "blue" },
|
||||
{ text: `${usages}`, 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.data.name}`, color: "blue" },
|
||||
{ text: "Aliases", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.data.aliases.toString().replaceAll(',',' ')}`, color: "blue" },
|
||||
{ text: "Description", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.data.description}`, color: "blue" },
|
||||
{ text: "Trust Level", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.data.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.data.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
|
||||
}
|
||||
console.log(aliases)*/
|
||||
// }
|
||||
// tellraw @p {"text":"this","clickEvent":{"action":"suggest_command","value":"this"}}
|
||||
if (command.data.trustLevel === 0) {
|
||||
public.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "aqua",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'dark_blue',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
} else if (command.data.trustLevel === 1) {
|
||||
trusted.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "dark_aqua",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'dark_blue',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
} else if (command.data.trustLevel === 2) {
|
||||
admin.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "blue",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action:"show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'dark_blue',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
} else if (command.data.trustLevel === 3) {
|
||||
owner.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "dark_blue",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'dark_blue',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
const length = bot.commandManager.commandlist.filter(c => c.data.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.data.name) {
|
||||
const ansi = bot.getMessageAsPrismarine([ { text: `CommandName \u203a ${command.data.name}\n`, color: 'gray', }, { text: `Aliases \u203a ${command.data.aliases}\n`, color: 'gray', }, { text: `Description \u203a ${command.data.description}\n`, color: 'gray', }, { text: `trustLevel \u203a ${command.data.trustLevel}\n`, color: 'gray' }, { text: `Usages \u203a ${command?.data.usages}`, color: "dark_gray" }, ])?.toAnsi().replaceAll('```\u001b[9```' + '```\u001b[3```')
|
||||
const fix = fixansi(ansi.replaceAll('`', '`\u200b'))
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
return
|
||||
}
|
||||
if (command?.data.trustLevel === 0 && command.discordExecute) {
|
||||
public.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "aqua",
|
||||
}
|
||||
])
|
||||
} else if (command?.data.trustLevel === 1 && command.discordExecute) {
|
||||
trusted.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "dark_aqua"
|
||||
}
|
||||
])
|
||||
} else if (command?.data.trustLevel === 2 && command.discordExecute) {
|
||||
admin.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: 'blue'
|
||||
}
|
||||
])
|
||||
} else if (command?.data.trustLevel === 3 && command.discordExecute) {
|
||||
owner.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "dark_blue",
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
const length = bot.commandManager.commandlist.filter(c => c.data.trustLevel !== 4 && c.discordExecute).length
|
||||
const ansi1 = bot.getMessageAsPrismarine([ { text: 'Commands (', color: 'gray' }, { text: JSON.stringify(length), color: 'gold' }, { text: ') ', color: 'gray' }, category, '\n', public, trusted, owner ])?.toAnsi();
|
||||
const fix1 = fixansi(ansi1.replaceAll('`', '`\u200b'))
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix1}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
bot?.discord?.message.react('♋')
|
||||
}
|
||||
}
|
355
src/commands/public/info.js
Normal file
355
src/commands/public/info.js
Normal file
|
@ -0,0 +1,355 @@
|
|||
const os = require("os");
|
||||
const CommandError = require('../../util/command_error');
|
||||
const fs = require("fs");
|
||||
const botInfo = require('../../../package-lock.json');
|
||||
const fixansi = require('../../util/ansi.js');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { execSync } = require('child_process')
|
||||
function format(seconds) {
|
||||
function pad(s) {
|
||||
return (s < 10 ? "0" : "") + s;
|
||||
}
|
||||
var hours = Math.floor(seconds / (60 * 60));
|
||||
var minutes = Math.floor((seconds % (60 * 60)) / 60);
|
||||
var seconds = Math.floor(seconds % 60);
|
||||
return (pad(`${hours} Hours`) + " " +
|
||||
pad(`${minutes} Minutes`) + " " +
|
||||
pad(`${seconds} Seconds`))
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'info',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"information",
|
||||
],
|
||||
description: 'check the bots info',
|
||||
usages: [
|
||||
"about",
|
||||
"config <client, discord, options, all>",
|
||||
"contributors/credits",
|
||||
"discord",
|
||||
"usages <bot, server, all>",
|
||||
"uptimes/uptime <bot, server, all>",
|
||||
"server",
|
||||
"version/ver",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "about":
|
||||
component.push({
|
||||
text: `FNFBoyfriendBot is a kaboom bot created by Parker2991\nThe source code and changelog can be found here ${botInfo.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.url}`
|
||||
}
|
||||
})
|
||||
break;
|
||||
case "config":
|
||||
if (bot.options.isKaboom) {
|
||||
mode = "Kaboom";
|
||||
} if (bot.options.useChat && bot.options.isKaboom) {
|
||||
mode = "Kaboom/Coreless";
|
||||
} if (bot.options.isSavage) {
|
||||
mode = "Savage";
|
||||
} if (bot.options.isCreayun) {
|
||||
mode = "Creayun";
|
||||
}
|
||||
switch (args.slice(1).join(' ')?.toLowerCase()) {
|
||||
case "client":
|
||||
component.push({
|
||||
translate: "%s: %s:%s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.host}`, color: config.colors.commands.secondary },
|
||||
{ text: `${bot.options.port}`, color: config.colors.integer },
|
||||
{ text: "Server Name", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.serverName}`, color: config.colors.commands.secondary },
|
||||
{ text: "Minecraft Username", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.username}`, color: config.colors.commands.secondary },
|
||||
{ text: "Version", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.version}`, color: config.colors.integer },
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "discord":
|
||||
if (!config.discord.enabled || discordClient.user === null) {
|
||||
throw new CommandError('Token is incorrect or discord isnt enabled!')
|
||||
} else {
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Discord Username", color: config.colors.commands.primary },
|
||||
{ text: `${discordClient.user.tag}`, color: config.colors.commands.secondary },
|
||||
{ text: "Discord Channel", color: config.colors.commands.primary },
|
||||
{ text: `${bot.discord?.channel?.name}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
}
|
||||
break;
|
||||
case "options":
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server Count", color: config.colors.commands.primary },
|
||||
{ text: `${bot.bots.length}`, color: config.colors.integer },
|
||||
{ text: "Prefixes", color: config.colors.commands.primary },
|
||||
{ text: `${config.prefixes.map((e) => e + " ").join(' ')}`, color: config.colors.commands.secondary },
|
||||
{ text: "Mode", color: config.colors.commands.primary },
|
||||
{ text: `${mode}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "all":
|
||||
component.push({
|
||||
translate: "%s: %s:%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.host}`, color: config.colors.commands.secondary },
|
||||
{ text: `${bot.options.port}`, color: config.colors.integer },
|
||||
{ text: "Server Name", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.serverName}`, color: config.colors.commands.secondary },
|
||||
{ text: "Minecraft Username", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.username}`, color: config.colors.commands.secondary },
|
||||
{ text: "Version", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.version}`, color: config.colors.commands.secondary },
|
||||
{ text: "Discord Username", color: config.colors.commands.primary },
|
||||
{ text: `${discordClient.user?.tag}`, color: config.colors.commands.secondary },
|
||||
{ text: "Discord Channel", color: config.colors.commands.primary },
|
||||
{ text: `${bot.discord.channel?.name}`, color: config.colors.commands.secondary },
|
||||
{ text: "Server Count", color: config.colors.commands.primary },
|
||||
{ text: `${bot.bots.length}`, color: config.colors.integer },
|
||||
{ text: "Prefixes", color: config.colors.commands.primary },
|
||||
{ text: `${config.prefixes.map((e) => e + " ").join(' ')}`, color: config.colors.commands.secondary },
|
||||
{ text: "Mode", color: config.colors.commands.primary },
|
||||
{ text: `${mode}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
})
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
|
||||
}
|
||||
break;
|
||||
case "contributors":
|
||||
case "credits":
|
||||
component.push({
|
||||
translate: "%s%s - %s\n%s:\n%s\n%s\n%s\n%s\n%s %s\n%s",
|
||||
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" }
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "discord":
|
||||
component.push({
|
||||
text: `the discord server invite is ${config.discord.invite}`,
|
||||
color: config.colors.commands.primary,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "click here to join the discord server!",
|
||||
color: config.colors.commands.secondary,
|
||||
}
|
||||
]
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `${config.discord.invite}`
|
||||
}
|
||||
})
|
||||
break;
|
||||
case "usages":
|
||||
switch (args.slice(1).join(' ')?.toLowerCase()) {
|
||||
case "bot":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Bot Memory Usage", color: config.colors.commands.primary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576 )}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary }
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "server":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Free Server Memory", color: config.colors.commands.primary },
|
||||
{ text: `${Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "all":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s\n%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Free Server Memory", color: config.colors.commands.primary },
|
||||
{ text: `${Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: "Bot Memory Usage", color: config.colors.commands.primary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576 )}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary }
|
||||
]
|
||||
})
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
|
||||
}
|
||||
break;
|
||||
case "uptimes":
|
||||
switch (args.slice(1).join(' ')?.toLowerCase()) {
|
||||
case "bot":
|
||||
component.push({
|
||||
translate: "%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Bot Uptime", color: config.colors.commands.primary },
|
||||
{ text: `${format(process.uptime())}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "server":
|
||||
component.push({
|
||||
translate: "%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server Uptime", color: config.colors.commands.primary },
|
||||
{ text: `${format(os.uptime())}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "all":
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Bot Uptime", color: config.colors.commands.primary },
|
||||
{ text: `${format(process.uptime())}`, color: config.colors.commands.secondary },
|
||||
{ text: "Server Uptime", color: config.colors.commands.primary },
|
||||
{ text: `${format(os.uptime())}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
break;
|
||||
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
|
||||
}
|
||||
break;
|
||||
case "server":
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Hostname", color: config.colors.commands.primary },
|
||||
{ text: `${os.hostname()}`, color: config.colors.commands.secondary },
|
||||
{ text: "User", color: config.colors.commands.primary },
|
||||
{ text: `${os.userInfo().username}`, color: config.colors.commands.secondary },
|
||||
{ text: "Working Directory", color: config.colors.commands.primary },
|
||||
{ text: `${process.mainModule.path}`, color: config.colors.commands.secondary },
|
||||
{ text: "Arch", color: config.colors.commands.primary },
|
||||
{ text: `${os.arch()}`, color: config.colors.commands.secondary },
|
||||
{ text: "OS", color: config.colors.commands.primary },
|
||||
{ text: `${os.platform}`, color: config.colors.commands.secondary },
|
||||
{ text: "OS Version", color: config.colors.commands.primary },
|
||||
{ text: `${os.version()}`, color: config.colors.commands.secondary },
|
||||
{ text: "Kernel Version", color: config.colors.commands.primary },
|
||||
{ text: `${os.release()}`, color: config.colors.commands.secondary },
|
||||
{ text: "CPU", color: config.colors.commands.primary },
|
||||
{ text: `${os.cpus()[0].model}`, color: config.colors.commands.secondary },
|
||||
{ text: "CPU cores", color: config.colors.commands.primary },
|
||||
{ text: `${os.cpus().length}`, color: config.colors.integer },
|
||||
{ text: "Node Version", color: config.colors.commands.primary },
|
||||
{ text: `${process.version}`, color: config.colors.commands.secondary },
|
||||
{ text: "NPM Version", color: config.colors.commands.primary },
|
||||
{ text: `${execSync('npm -v').toString().replaceAll('\n', '')}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "version":
|
||||
case "ver":
|
||||
if (botInfo.codename === '') {
|
||||
component.push({
|
||||
translate: "%s %s %s-%s-%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.version}`, color: config.colors.integer },
|
||||
{ text: "#" },
|
||||
{ text: `${botInfo.build}`, color: config.colors.integer },
|
||||
{ text: "11/22/22", color: config.colors.commands.primary },
|
||||
{ text: `${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
/*
|
||||
`§9Friday §9Night §9Funkin §3Boyfriend §1Bot§8§r-
|
||||
${botInfo.version}-#${botInfo.build}-${botInfo.codename}\n11/22/22 -
|
||||
${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}
|
||||
*/
|
||||
} else {
|
||||
component.push({
|
||||
translate: "%s %s %s-%s-%s%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.version}`, color: config.colors.integer },
|
||||
{ text: "#" },
|
||||
{ text: `${botInfo.build}`, color: config.colors.integer },
|
||||
{ text: `${botInfo.codename}` },
|
||||
{ text: "11/22/22", color: config.colors.commands.primary },
|
||||
{ text: `${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
|
||||
}
|
||||
bot.tellraw(`@a[name="${source.player.profile.name}"]`, component);
|
||||
},
|
||||
}
|
|
@ -1,12 +1,20 @@
|
|||
const CommandError = require('../util/command_error');
|
||||
const CommandError = require('../../util/command_error');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const fixansi = require('../util/ansi');
|
||||
const fixansi = require('../../util/ansi');
|
||||
module.exports = {
|
||||
name: 'list',
|
||||
description:['check the player list'],
|
||||
trustLevel: 0,
|
||||
aliases:['playerlist', 'plist', 'pl'],
|
||||
usage:[""],
|
||||
data: {
|
||||
name: 'list',
|
||||
description: 'check the player list',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
'playerlist',
|
||||
'plist',
|
||||
'pl'
|
||||
],
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
|
@ -15,13 +23,13 @@ module.exports = {
|
|||
const component = []
|
||||
for (const player of players) {
|
||||
component.push({
|
||||
translate: `%s \u203a %s [%s %s %s %s %s]`,
|
||||
color: 'gray',
|
||||
translate: `%s \u203a %s [%s: %s %s %s: %s]`,
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
player.displayName ?? player.profile.name,
|
||||
{
|
||||
text: `${player.uuid}`,
|
||||
color: 'gray',
|
||||
color: 'dark_blue',
|
||||
clickEvent: {
|
||||
action: 'copy_to_clipboard',
|
||||
value: `${player.uuid}`
|
||||
|
@ -34,30 +42,38 @@ module.exports = {
|
|||
}]
|
||||
}
|
||||
},
|
||||
{ text: `Ping:`, color: 'dark_green' },
|
||||
{ text: `Ping`, color: 'dark_blue' },
|
||||
{ text: `${player.latency}`, color: 'gold' },
|
||||
{ text: '/', color: 'gray' },
|
||||
{ text: `Gamemode:`, color: 'dark_purple' },
|
||||
{ text: '/', color: 'dark_gray' },
|
||||
{ text: `Gamemode`, color: 'dark_blue' },
|
||||
{ text: `${player.gamemode}`, color: 'gold' },
|
||||
]
|
||||
})
|
||||
component.push('\n')
|
||||
}
|
||||
component.pop()
|
||||
bot.tellraw(`@a[name="${source.player.profile.name}"]`, [
|
||||
{ text: `Players: `, color:'gray' },
|
||||
{ text: '(' , color: 'gray' },
|
||||
{ text: `${JSON.stringify(bot.players.length)}`, color: 'gold' },
|
||||
{ text: ')\n', color: 'gray' },
|
||||
component
|
||||
])
|
||||
// bot.tellraw(component)
|
||||
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 = []
|
||||
// const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(bot.registry.language)
|
||||
for (const player of players) {
|
||||
component.push({
|
||||
translate: `%s \u203a %s [%s %s %s %s %s]`,
|
||||
|
@ -75,18 +91,11 @@ module.exports = {
|
|||
}
|
||||
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()
|
||||
/* bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
{ text: `Players: `, color:'gray' },
|
||||
{ text: '(' , color: 'gray' },
|
||||
{ text: `${JSON.stringify(bot.players.length)}`, color: 'gold' },
|
||||
{ text: ')\n', color: 'gray' },
|
||||
component
|
||||
])*/
|
||||
const fix = fixansi(ansi.replaceAll('`', '`\u200b'))
|
||||
const fix = fixansi(ansi.replaceAll('`', '`\u200b').substring(0, 3080))
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
} // `\`\`\`ansi\n${discordQueue.join('\n').substring(0, 1984)}\n\`\`\``
|
||||
}
|
||||
}
|
|
@ -1,27 +1,51 @@
|
|||
const { request } = require('undici');
|
||||
const CommandError = require('../util/command_error.js');
|
||||
const CommandError = require('../../util/command_error.js');
|
||||
const mc = require('minecraft-protocol');
|
||||
const util = require('util')
|
||||
module.exports = {
|
||||
name: 'mcserver',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"pingserver",
|
||||
"pingsrv",
|
||||
],
|
||||
description: 'look up minecraft server info',
|
||||
usages: [
|
||||
"<minecraft server ip>",
|
||||
],
|
||||
data: {
|
||||
name: 'mcserver',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"pingserver",
|
||||
"pingsrv",
|
||||
],
|
||||
description: 'look up minecraft server info',
|
||||
usages: [
|
||||
"<minecraft server ip>",
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
const bot = context.bot;
|
||||
const discordClient = context.discordClient;
|
||||
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) })
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
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',
|
||||
|
@ -62,7 +86,7 @@ module.exports = {
|
|||
color: 'gray',
|
||||
},
|
||||
server.description,
|
||||
])
|
||||
])*/
|
||||
} catch (e) {
|
||||
bot.chat.message(`${e.toString()}`)
|
||||
}
|
|
@ -1,36 +1,40 @@
|
|||
const CommandError = require('../util/command_error.js')
|
||||
const CommandError = require('../../util/command_error.js')
|
||||
module.exports = {
|
||||
name: 'netmsg',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
data: {
|
||||
name: 'netmsg',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
|
||||
],
|
||||
description: 'netmsg to other servers',
|
||||
usages: [
|
||||
"<message>"
|
||||
],
|
||||
],
|
||||
description: 'netmsg to other servers',
|
||||
usages: [
|
||||
"<message>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const args = context.arguments;
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
if (config.patches.netmsg) {
|
||||
component = [
|
||||
{ text: '[', color: "dark_gray" },
|
||||
{ text: bot.options.serverName, color: "gray" },
|
||||
{ text: "] ", color: "dark_gray" },
|
||||
source.player.displayName,
|
||||
{ text: " \u203a ", color: "dark_gray", bold: false },
|
||||
{ text: args.join(' '), color: "gray", bold: false }
|
||||
]
|
||||
} else {
|
||||
if (bot.options.private) {
|
||||
component = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: bot.options.serverName, color: "gray" },
|
||||
{ text: bot.options.serverName, color: "blue" },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: args.join(' '), color: "gray" },
|
||||
{ text: args.join(' '), color: "blue" },
|
||||
]
|
||||
}
|
||||
} else if (!bot.options.private) {
|
||||
component = {
|
||||
translate: '[%s:%s] %s \u203a %s',
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: bot.options.host, color: "blue" },
|
||||
{ text: `${bot.options.port}`, color: "gold" },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: args.join(' '), color: "blue" },
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -53,13 +57,27 @@ module.exports = {
|
|||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const component = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
with: [
|
||||
bot.options.serverName,
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
args.join(' ')
|
||||
]
|
||||
if (bot.options.private) {
|
||||
component = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: bot.options.serverName, color: "blue" },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: args.join(' '), color: "blue" },
|
||||
]
|
||||
}
|
||||
} else if (!bot.options.private) {
|
||||
component = {
|
||||
translate: '[%s:%s] %s \u203a %s',
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: bot.options.host, color: "blue" },
|
||||
{ text: `${bot.options.port}`, color: "gold" },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: args.join(' '), color: "blue" },
|
||||
]
|
||||
}
|
||||
}
|
||||
bot.bots.filter((eachBot) => {
|
||||
if (eachBot.options.serverName === "Savage Friends" && eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom) {
|
|
@ -1,14 +1,16 @@
|
|||
module.exports = {
|
||||
name: 'refillcore',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"rc",
|
||||
"refill",
|
||||
],
|
||||
description: 'refill the bots core',
|
||||
usages: [
|
||||
data: {
|
||||
name: 'refillcore',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"rc",
|
||||
"refill",
|
||||
],
|
||||
description: 'refill the bots core',
|
||||
usages: [
|
||||
|
||||
],
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
bot.core.refill()
|
|
@ -1,15 +1,17 @@
|
|||
const CommandError = require('../util/command_error');
|
||||
const CommandError = require('../../util/command_error');
|
||||
module.exports = {
|
||||
name: 'test',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'Make me say something',
|
||||
usages: [
|
||||
"error stack <message>",
|
||||
"error message <message>",
|
||||
"message <message>"
|
||||
],
|
||||
data: {
|
||||
name: 'test',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'Make me say something',
|
||||
usages: [
|
||||
"error stack <message>",
|
||||
"error message <message>",
|
||||
"message <message>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
|
@ -24,7 +26,6 @@ module.exports = {
|
|||
throw new CommandError(args.slice(2).join(' '));
|
||||
break
|
||||
}
|
||||
// throw new Error(args.slice(1).join(' '));
|
||||
break;
|
||||
case "message":
|
||||
bot.tellraw("@a", [
|
|
@ -1,17 +1,18 @@
|
|||
const CommandError = require('../util/command_error')
|
||||
const CommandError = require('../../util/command_error')
|
||||
const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, SlashCommandBuilder } = require('discord.js');
|
||||
const { request } = require('undici');
|
||||
module.exports = {
|
||||
name: 'urban',
|
||||
description:['urban dictionary'],
|
||||
aliases:['urbandictionary'],
|
||||
trustLevel: 0,
|
||||
usage:[
|
||||
"<definition>",
|
||||
],
|
||||
usages: [
|
||||
"<definition>",
|
||||
],
|
||||
data: {
|
||||
name: 'urban',
|
||||
description: 'urban dictionary',
|
||||
aliases: [
|
||||
'urbandictionary'
|
||||
],
|
||||
trustLevel: 0,
|
||||
usages: [
|
||||
"<definition>",
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
const source = context.source
|
||||
const args = context.arguments
|
67
src/commands/public/weather.js
Normal file
67
src/commands/public/weather.js
Normal file
|
@ -0,0 +1,67 @@
|
|||
const CommandError = require('../../util/command_error');
|
||||
const { request } = require('undici');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'weather',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'check the weather of cities',
|
||||
usages: [
|
||||
"<message>"
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
try {
|
||||
let component = [];
|
||||
const weather = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ')}`);
|
||||
const info = await weather.body.json();
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s%s (%s%s)\n%s: %s %s %s (%s %s %s)\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Location", color: config.colors.commands.primary },
|
||||
{ text: `${info.location.name}, ${info.location.region}, ${info.location.country}`, color: config.colors.commands.secondary },
|
||||
{ text: "Latitude", color: config.colors.commands.primary },
|
||||
{ text: `${info.location.lat}`, color: config.colors.integer },
|
||||
{ text: "Longitude", color: config.colors.commands.primary },
|
||||
{ text: `${info.location.lon}`, color: config.colors.integer },
|
||||
{ text: "Time zone", color: config.colors.commands.primary },
|
||||
{ text: `${info.location.tz_id}`, color: config.colors.commands.secondary },
|
||||
{ text: "Time", color: config.colors.commands.primary },
|
||||
{ text: `${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id, })}`, color: config.colors.integer },
|
||||
{ text: "Temp", color: config.colors.commands.primary },
|
||||
{ text: `${info.current.temp_c}`, color: config.colors.integer },
|
||||
{ text: "\u00b0C", color: config.colors.commands.secondary },
|
||||
{ text: `${info.current.temp_f}`, color: config.colors.integer },
|
||||
{ text: "\u00b0F", color: config.colors.commands.secondary },
|
||||
{ text: "Wind speed" , color: config.colors.commands.primary },
|
||||
{ text: `${info.current.wind_kph}`, color: config.colors.integer },
|
||||
{ text: `kph`, color: config.colors.commands.secondary },
|
||||
{ text: `${info.current.wind_dir}`, color: config.colors.commands.secondary },
|
||||
{ text: `${info.current.wind_mph}`, color: config.colors.integer },
|
||||
{ text: `mph`, color: config.colors.commands.secondary },
|
||||
{ text: `${info.current.wind_dir}`, color: config.colors.commands.secondary },
|
||||
{ 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: `${info.current.humidity}`, color: config.colors.integer },
|
||||
]
|
||||
})
|
||||
bot.tellraw("@a", component)
|
||||
} catch (e) {
|
||||
if (e.toString() === "TypeError: Cannot read properties of undefined (reading 'name')" && args.length !== 0) {
|
||||
bot.chat.message('The location is invalid please try a valid location');
|
||||
} else if (args.length === 0) {
|
||||
bot.chat.message('there were no arguments detected')
|
||||
} else {
|
||||
bot.chat.message(`${e.toString()}`);
|
||||
console.warn(e.stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +1,18 @@
|
|||
const wiki = require('wikipedia')
|
||||
const CommandError = require('../util/command_error')
|
||||
const CommandError = require('../../util/command_error')
|
||||
const { EmbedBuilder } = require('discord.js')
|
||||
module.exports = {
|
||||
name: 'wiki',
|
||||
description:['wikipedia'],
|
||||
trustLevel: 0,
|
||||
aliases:['wikipedia'],
|
||||
usage:["<definition>"],
|
||||
data: {
|
||||
name: 'wiki',
|
||||
description: 'wikipedia',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
'wikipedia'
|
||||
],
|
||||
usages:[
|
||||
"<article>"
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
|
@ -17,7 +23,7 @@ module.exports = {
|
|||
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' })
|
||||
bot.tellraw(`@a`, { text: 'Article not found!', color: 'dark_red' })
|
||||
} else {
|
||||
bot.tellraw(`@a`, `${error.toString()}`)
|
||||
}
|
|
@ -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,20 +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'],
|
||||
usage:[""],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const sender = context.source.player
|
||||
const source = context.source
|
||||
if (!sender) return
|
||||
const x = between(-1_000_000, 1_000_000)
|
||||
const y = 100
|
||||
const z = between(-1_000_000, 1_000_000)
|
||||
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}`)
|
||||
}
|
||||
}
|
|
@ -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.logs(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,18 +1,20 @@
|
|||
const { EmbedBuilder } = require('discord.js');
|
||||
const CommandError = require('../util/command_error');
|
||||
const CommandError = require('../../util/command_error');
|
||||
module.exports = {
|
||||
name: 'cloop',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
"commandloop"
|
||||
],
|
||||
description: 'run cloops',
|
||||
usages: [
|
||||
"add <interval> <command>",
|
||||
"remove <index>",
|
||||
"clear",
|
||||
"list",
|
||||
],
|
||||
data: {
|
||||
name: 'cloop',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
"commandloop"
|
||||
],
|
||||
description: 'run cloops',
|
||||
usages: [
|
||||
"add <interval> <command>",
|
||||
"remove <index>",
|
||||
"clear",
|
||||
"list",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
|
@ -20,7 +22,8 @@ module.exports = {
|
|||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
switch (args[1]) {
|
||||
case 'add':
|
||||
if (parseInt(args[2]) === NaN) bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid interval', color: 'red' })
|
||||
if (isNaN(args[2])) throw new CommandError({ text: 'Invalid interval', color: 'red' })
|
||||
//bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid interval', color: 'red' })
|
||||
const interval = parseInt(args[2])
|
||||
const command = args.slice(3).join(' ');
|
||||
bot.cloop.add(command, interval)
|
|
@ -1,26 +1,29 @@
|
|||
const CommandError = require('../util/command_error');
|
||||
const CommandError = require('../../util/command_error');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
module.exports = {
|
||||
name: 'kick',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
],
|
||||
description: 'kick or crash players',
|
||||
usages: [
|
||||
"invalidstring <player>",
|
||||
],
|
||||
data: {
|
||||
name: 'kick',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
],
|
||||
description: 'kick or crash players',
|
||||
usages: [
|
||||
"invalidstring <player>",
|
||||
"item <player>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
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');
|
||||
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.core.run(`minecraft:tellraw ${args.slice(2).join(' ')} ${JSON.stringify(bot.exploits.invalidString)}`)
|
||||
bot.exploits.crashes.invalidString(`${args.slice(2).join(' ')}`);
|
||||
break
|
||||
case 'item':
|
||||
bot.exploits.item(`${args.slice(2).join(' ')}`)
|
||||
bot.exploits.kicks.item(`${args.slice(2).join(' ')}`)
|
||||
break
|
||||
default:
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
|
||||
|
@ -32,10 +35,10 @@ module.exports = {
|
|||
if (bot.options.useChat || bot.options.isSavage || bot.options.isCreayun) throw new CommandError('Cannot execute command!');
|
||||
switch (args[0]) {
|
||||
case "invalidstring":
|
||||
bot.core.run(`minecraft:tellraw ${args.slice(1).join(' ')} ${JSON.stringify(bot.exploits.invalidString)}`)
|
||||
bot.exploits.crashes.invalidString(`${args.slice(1).join(' ')}`)
|
||||
break
|
||||
case 'item':
|
||||
bot.exploits.item(`${args.slice(1).join(' ')}`)
|
||||
bot.exploits.kicks.item(`${args.slice(1).join(' ')}`)
|
||||
break
|
||||
default:
|
||||
throw new CommandError('Invalid argument');
|
|
@ -1,14 +1,16 @@
|
|||
module.exports = {
|
||||
name: 'reconnect',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
"end",
|
||||
"recon",
|
||||
],
|
||||
description: 'reconnect the bot',
|
||||
usages: [
|
||||
data: {
|
||||
name: 'reconnect',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
"end",
|
||||
"recon",
|
||||
],
|
||||
description: 'reconnect the bot',
|
||||
usages: [
|
||||
|
||||
],
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
60
src/commands/trusted/rtp.js
Normal file
60
src/commands/trusted/rtp.js
Normal file
|
@ -0,0 +1,60 @@
|
|||
const between = require('../../util/between')
|
||||
const CommandError = require('../../util/command_error')
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'tpr',
|
||||
description: 'teleport to very fucked up coords',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
'rtp',
|
||||
'teleportrandom',
|
||||
'randomteleport'
|
||||
],
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
const source = context.source
|
||||
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);
|
||||
}
|
||||
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,32 +1,20 @@
|
|||
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;
|
||||
const source = context.source;
|
||||
/* if (args[0] === bot.validation.trusted) {
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message('&2Valid Trusted hash');
|
||||
} else {
|
||||
bot.tellraw(`@a`, { text: "Valid Trusted hash", color: "dark_green" });
|
||||
}
|
||||
}
|
||||
if (args[0] === bot.validation.owner) {
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message("&2Valid Owner hash");
|
||||
} else {
|
||||
bot.tellraw(`@a`, { text: "Valid Owner hash", color: "dark_green" });
|
||||
}
|
||||
}*/
|
||||
if (args[0] === bot.validation.trusted) {
|
||||
bot.chat.message('&2Valid Trusted hash');
|
||||
}
|
||||
|
@ -42,7 +30,6 @@ module.exports = {
|
|||
const event = bot?.discord?.message
|
||||
const roles = event?.member?.roles?.cache
|
||||
const source = context.source;
|
||||
console.log(Object.keys(bot.discord.message.member.user.username));
|
||||
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}]`)
|
|
@ -1,22 +1,24 @@
|
|||
const http = require('http');
|
||||
const https = require('https');
|
||||
const util = require('util');
|
||||
const fixansi = require('../util/ansi');
|
||||
const CommandError = require('../util/command_error')
|
||||
const fixansi = require('../../util/ansi');
|
||||
const CommandError = require('../../util/command_error')
|
||||
module.exports = {
|
||||
name: 'website',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
],
|
||||
description: 'look up website data',
|
||||
usages: [
|
||||
"<url>"
|
||||
],
|
||||
data: {
|
||||
name: 'website',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
],
|
||||
description: 'look up website data',
|
||||
usages: [
|
||||
"<url>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
if (args.join(' ').toLowerCase().startsWith("http://")) {
|
||||
http.get(args.join(' '), (res) => {
|
||||
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');
|
||||
|
@ -33,7 +35,7 @@ module.exports = {
|
|||
bot.chat.message(`&4${e.toString()}`);
|
||||
});
|
||||
} else {
|
||||
https.get(args.join(' '), (res) => {
|
||||
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));
|
||||
|
@ -65,7 +67,7 @@ module.exports = {
|
|||
fix = fixansi(ansi.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
// } catch (e) {
|
||||
|
@ -85,7 +87,7 @@ module.exports = {
|
|||
fix = fixansi(ansi.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setTitle(`${this.datta.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
// bot.discord.message.reply('e');
|
|
@ -1,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,721 +0,0 @@
|
|||
[
|
||||
{
|
||||
"name": {
|
||||
"text": "v0.1.0 - v0.5.0-beta",
|
||||
"color": "blue",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"Prototypes"
|
||||
],
|
||||
"foundation": "11/22/22 - 1/24/23",
|
||||
"exclaimer": "ehh nothing much just the release of the betas"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v1.0.0-beta",
|
||||
"color": "blue",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"in console test"
|
||||
],
|
||||
"foundation": "1/25/23",
|
||||
"exclaimer": "original commands:!cloop bcraw,!cloop sudo,!troll,!say,!op (broke),!deop (broke), !gms (broke),!freeze,!icu <--- these commands no longer can be used in game but in console for beta 1.0 commands added: fake kick,ban,kick,crashserver,stop,gmc,greetin,test(broken idk),bypass,entity spam ,gms ,stop,tntspam ,prefix ,annoy (broke results in a complete server crash keeping ayunboom down for 3 to 5 hours),freeze,crashserver,troll ,trol(more destructive),icu ,say,sudo,cloop"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v1.0.0",
|
||||
"color": "dark_red",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"FNFBoyfriendBot"
|
||||
],
|
||||
"foundation": "1/26/23",
|
||||
"exclaimer": "FNFBoyfriendBot. commands added: BOOM,deop,troll and trol(added extra code to both commands),kaboom,serverdeop, commands fixed:tp,gms,annoy(attemps to crash the server but not as bad as it was) commands untested:prefix command Broke:icu,freeze,tntspam,entityspam,tntspam? changed name to &b &lFNFBoyfriendBot may change later idk"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v1.0.1",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "1/26/23",
|
||||
"exclaimer": "reworked the kaboom command and fixed the description commands but thats about it. also reworked the greeting command"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v1.1.0",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "1/26/23 2:00pm",
|
||||
"exclaimer": "nothing much just added extra stuff to the troll, trol and that is about it"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v1.2.0",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "1/28/23 1:51",
|
||||
"exclaimer": "for ppl me making me really mad -.- got released early"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v2.0.0",
|
||||
"color": "dark_red",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"Major"
|
||||
],
|
||||
"foundation": "2/07/23 8:01pm",
|
||||
"exclaimer": "added DREAMSTANALERT,technoblade,GODSWORD,KFC,MYLEG,OHHAIL,altcrash,MyHead Reworked tntspam,entityspam,soundbreaker added Spim to the whitelist of the bot released too early than it was planned gonna be released due do the code almost leaked it had to be released early"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v2.1.0",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "2/11/23 5:30pm",
|
||||
"exclaimer": "added: refillcore(had early prototypes of this was original), vanish,deop,cloopdeop,mute,cloopmute reworked: op (supposed to already op the bot but didnt work until this release) and reworked gmc (same problem with op) (had early prototypes of vanish,refillcore,gmc,and op but these were original gonna be automatic but after alot of attempts i said screw it and added 2 commands refillcore, and vanish reworked gmc and op and got them working finally) removed Spim because come to find out he couldnt be trusted"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v2.2.0",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "2/20/23",
|
||||
"exclaimer": "added ckill(added back after trial and error),serversuicidal changed username of the bot from hex code to FNFBoyfriendBot because hex code for the username was confusing as it changes everytime"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v3.0.0-Beta",
|
||||
"color": "blue",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"blue-balled corruption"
|
||||
],
|
||||
"foundation": "",
|
||||
"exclaimer": "was canceled due to ayunboom being rewriten and renamed to creayun barely usable on there because commands blocks are disabled which i created a bot for that server that has no command blocks just finished the final build of the Creayun build of the bot due to chip announcing that he may make a kaboom clone yk what 1.5.2 and 1.8 support but anyway onto what is in the v3.0-beta well the beta for right now commands added:discord,version,online,list,iownyou,endmysuffering,wafflehouse,whopper,bcraw,destroycore Notes:the original say command was reworked into talking in chat without bcraw and command blocks which the bcraw chatting code is still in the bot but was reworked into the bcraw commmand. maybe some commands removed? i dont know yet edit there is 2 commands removed commands removed:tpe and serverdeop??? reworked commands :say command for right now relay chat mabe will be added as a seperate repl i dont know yet possible would need a whole code rewrite for relay chat"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v3.0.0",
|
||||
"color": "dark_red",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"Sky Remanifested"
|
||||
],
|
||||
"foundation": "",
|
||||
"exclaimer": "the full release of 3.0 the rewrite has been pushed back to 4.0 due to 3.0 already pass its release date and the code i had on hand was done but the rewrite wasnt done Added: SelfCare Made during development:Relay chat prototypes for several servers"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v3.0.5",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "",
|
||||
"exclaimer": "bug fixes"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v3.0.9",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "",
|
||||
"exclaimer": "commands added:Help(finally added after about a year),consolelog(added cuz yes),cloopconsolelog(added cuz yes)"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v3.3.0",
|
||||
"color": "dark_red",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "",
|
||||
"exclaimer": "switched it base to 4.0s base during 4.0s development"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.0.0-beta",
|
||||
"color": "blue",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"FNFBoyfriendBot Ultimate"
|
||||
],
|
||||
"foundation": "",
|
||||
"exclaimer": "all of the command removed and or rewriten from version 3.0.9 Commands added or rewriten:ban,buyrealminecraft,cloop,discord,echo,errortest,freeze,help,icu,info,kick,bots,skids,romncitrash,say,selfdestruct,serversuicidal,sudo,test,trol,troll (note that this is different and is not CommandModules)Modules Added:discord,chat,chat_command_handler,command_manager,position,registry,reconnect,command_core CustomChats added:kaboom(for normal chat) (note that this is different and is not Modules)CommandModules Added:command_error,Command_source a beta release for rn"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.0.0-Alpha ",
|
||||
"color": "aqua",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"FNFBoyfriendBot Ultimate"
|
||||
],
|
||||
"foundation": "",
|
||||
"exclaimer": "Commands added: calculator,ckill,evaljs,urban,crash,cloopcrash,core,list,ping,netmsg,skin,tpr Commands Removed:Buyrealminecraft (note that this is different and is not CommandModules)Modules Added:op selfcare,gmc selfcare,vanish selfcare,cspy selfcare,console (note that this is different and is not Modules)CustomChats Added:u2O3a(for custom chat) added util with between(for urban) eval_colors(for evaljs)"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.0.0",
|
||||
"color": "dark_red",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"FNFBoyfriendBotX"
|
||||
],
|
||||
"foundation": "8/11/23",
|
||||
"exclaimer": "Bot is finished with the rewrite thank you ChipMC and chayapak for helping me rewrite the bot Heres the commands ban (mabe removing), blacklist (currently being worked on), botdevhistory, bots, calculator, changelog, ckill, cloop, cloopcrash(probably removing), core, crash, creators, discord, echo, errortest, evaljs, freeze, help, icu, list, meminfo, mineflayerbot, netmsg (Hello World!), ping (pong!), reconnect, say, selfdestruct, serversuicidal (probably removing because theres ckill), skin, sudo, test, tpr, trol (mabe renaming it to troll), troll (mabe removing it and replacing it with the trol command), urban (ong sus asf), validate, version"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.0.5",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "8/17/23",
|
||||
"exclaimer": "bug fixes, did what i said i was gonna do in the last update"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.0.6",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "8/22/23",
|
||||
"exclaimer": "added 1 console command along with updating console.js so that the bot sends a message to 1 server at a time and not a message to all the servers at a time"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.0.7",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "9/4/23",
|
||||
"exclaimer": "merged server and botusername commands and naming the command logininfo cuz it now shows the server ip, server port, Minecraft java Version, and the Bots Username"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.0.8",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "9/7/23",
|
||||
"exclaimer": "added the wiki command even though its semi working. bug fixes. some bugs still in the bot is netmsg showing the bots username when i used the netmsg cmd from my end and not the console i find it funny asf though"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.0.8A",
|
||||
"color": "gold",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "9/7/23",
|
||||
"exclaimer": "added some things to the changelog cmd. still needing to fix the issue with custom chat and netmsg also added a bugs command to check what bugs are needing to be fixed"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.0.8B",
|
||||
"color": "gold",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "9/8/23",
|
||||
"exclaimer": "made it to where it sends more messages on start up and made it to where the buildstring is in secrets"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.0.8C",
|
||||
"color": "gold",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "9/14/23",
|
||||
"exclaimer": "added the nodejs version to the version command but thats about it still fixing the bugs with the relay chat and mabe rewriting the validation system in the bot"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.0.8D",
|
||||
"color": "gold",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "9/16/23",
|
||||
"exclaimer": "added onto the changelog command along with adding spambot and lol commands (cuz yes) along with removing the bugs command maybe adding it back sometime later also the discord relay chat and validation system mabe getting a rewrite and also updated node from v18 to v20.6.0"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.0.8E",
|
||||
"color": "gold",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "9/17/23",
|
||||
"exclaimer": "changed the name for meminfo to serverinfo along with adding onto it and moving the nodejs, node-minecraft-protocol, and discord.js versions from the version command to the serverinfo command"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.0.8F",
|
||||
"color": "gold",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "9/24/23",
|
||||
"exclaimer": "added filesdirectories command but thats about it"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.0.9",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "9/26/23",
|
||||
"exclaimer": "added a hover event to the custom chat for the bot"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.1.0",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "9/27/23",
|
||||
"exclaimer": "Finally changed how the validation/hashing works in the bot instead of it being sent in discord there will be a key for trusted to validate"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.1.1",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "9/28/23",
|
||||
"exclaimer": "added uppercase and lowercase function for commands and soon gonna be completely overhauling the validation system in the bot again"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.1.2",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "10/02/23",
|
||||
"exclaimer": "added uptime as a command but thats it"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.1.4",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "10/03/23",
|
||||
"exclaimer": "moved the custom chat text and cmd block text to config.js"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.1.6",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "10/08/23",
|
||||
"exclaimer": "fixed the relay chat and fixed the cr issue with urban and also fixed reconnect"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.1.7",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "10/08/03",
|
||||
"exclaimer": "added mute, tag, and skin to selfcare"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.1.8",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "10/11/23",
|
||||
"exclaimer": "fixed the issue with memused cee mmm dee"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.1.9",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "10/12/23",
|
||||
"exclaimer": "rewrote evaljs its now using isolated-vm and not vm2"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.2.0-restore",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "10/19/23",
|
||||
"exclaimer": "fixed the disconnect message for discord and the bug with the say command"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.2.1",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "10/24/23",
|
||||
"exclaimer": "rewrote the help command to allow descriptions finally along with adding things to the base of the bot for the descriptions"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.2.2",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "10/25/23",
|
||||
"exclaimer": "merged serverinfo, memused, discord, logininfo, creators, version, uptime together"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.2.3",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "10/30/23",
|
||||
"exclaimer": "added a antiskid measure (thanks _yfd)"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.2.4",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"Spooky update (note: might as well give it a codename since its halloween)"
|
||||
],
|
||||
"foundation": "10/31/23",
|
||||
"exclaimer": "merged fard and reconnect together making recend, added more crash methods to the crash command, and remove 12 commands"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.2.5",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "11/8/23",
|
||||
"exclaimer": "patched the exploit in the discordmsg command and made it to were with the netmsg command players cannot send empty messages"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.3.0",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "11/16/23",
|
||||
"exclaimer": "color coded the console logs are LOGS in the color gold consoleserver are in the category INFO in the color green, errors after start up are in the category WARN in the color yellow, Fatal Errors/start-up errors are in the category ERROR in the color red and hashs/validation codes sent to console are in the category HASH in the color green. added the command servereval. changed config.json to config.js and moved the username() function from the end of bot.js to the end of config.js and replacing where username() after options.username with 'Player' + Math.floor(Math.random() * 1000) and added player ping/latency to list along with fixing the bug with cloop list"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.3.1",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "11/21/23 one day till the bots anniversary?!?!",
|
||||
"exclaimer": "modified the bots boot originally it would spam the bots buildstring each time it logged into a server on boot but now it will only send it once to console on boot along with it now sending the foundationbuildstring after the buildstring sent in console. ported some commands over since chomens is pretty much dead along with adding chat support for chat.type.text and chat.type.emote"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.3.2",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "11/23/23",
|
||||
"exclaimer": "made the bots selfcare, the selfcares interval and console toggle-able along with making default options for the selfcare and its interval, the bots prefix, the bots discord prefix, the reconnectDelay interval, the core customname, and the console, partically fixed the issue with the trusted commands no being able to be ran in discord, edited the bots boot again it now also logs the amount of files its loading on boot its discord username its logged in with(also added the discord username to the info command)"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.3.3",
|
||||
"color": "dark_red",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"Lullaby Girlfriend's LostCause"
|
||||
],
|
||||
"foundation": "12/3/23",
|
||||
"exclaimer": "added hover events to the help command for command descriptions, trust console and name along with click events for them added memusage and fixed the category issue with the console and added toggles to the bot for console, selfcare, and skin"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v4.3.4",
|
||||
"color": "dark_red",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"Suffering Siblings"
|
||||
],
|
||||
"foundation": "12/12/23",
|
||||
"exclaimer": "overhauled the console and discord relay chat fixing trusted roles and making the selfcare toggleable in game also fixing the issue with hiding console only commands (thank you poopbob for helping me with that)"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v5.0.0-Beta",
|
||||
"color": "blue",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"Monochrome"
|
||||
],
|
||||
"foundation": "12/18/23",
|
||||
"exclaimer": "added owner validation to the bot thats about it"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v5.0.0",
|
||||
"color": "dark_red",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"Monochrome"
|
||||
],
|
||||
"foundation": "12/20/23",
|
||||
"exclaimer": "since the old validation system was able to barely handle owner validation it was completely remove and replaced with trust levels which handle validation way better also added command aliases (shoutouts to poopbob with the command aliases). made a whole new changelog command for v5.0.0 and renamed the old one changelogv4.3.4. also fixed the issue with the console not properly refreshing lines that are sent"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v5.0.1",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "added botsrun for the funni along with making the bot be able to auto refill its core now and fill the core from a command block(edit: nevermind its very buggy reverting it back to how it originally filled its core) and adding a hover event to netmsg along with having the test command tellraw the players display name in the command and added support for 3 command prefixes",
|
||||
"exclaimer": "12/23/23"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v5.0.2",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "12/26/23",
|
||||
"exclaimer": "fixed the issue with the cpu checking in the info command added discord hashing back into the bot to work along side the keys made it check to see if the config file is in the directory and if not it will recreate the config from default.js"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v5.0.3",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "12/29/23",
|
||||
"exclaimer": "mabe the bot last update of 2023 cuz next year will be 2024 www but anyway expanded the disconnect messages for both console and discord but thats pretty much it"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v5.0.4",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"foundation": "1/12/24",
|
||||
"exclaimer": "first update of 2024 for the bot but anyway merged the test and errortest commands into cmdtest, changed the colors for the help command public is #00FFFF, trusted is dark_purple and owner remained as dark red. moved the module loader from bot.js to index.js to split the boot time in half which now allows module functions like bot.chat() to be used in bot.js and also since the command manager is a module it also loads the commands thats a w on all ends also removed some modules to improve the bots boot time and moved the functions for the sctoggle command into the command itself and not as a module which helped the boot time as well and last but not least merged the memused usage in the info command with the serverinfo usage and made the memusage command use the bossbar and not the actionbar"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v5.0.5",
|
||||
"color": "dark_red",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"text": "QT ",
|
||||
"color": "#f001db"
|
||||
},
|
||||
{
|
||||
"text": "KB ",
|
||||
"color": "#740000"
|
||||
},
|
||||
{
|
||||
"text": "Termination",
|
||||
"color": "black"
|
||||
}
|
||||
],
|
||||
"foundation": "1/26/24",
|
||||
"exclaimer": "added a new feature to the bot called Coreless Mode to where the core can be toggled and most commands using tellraw will use chat instead along with the discord relay chat, fixed the bug with trust and owner commands not running in console along with removing alot of useless commands and made the 3 prefixes a array and added ratelimit for console logging and command usage and added file chat logging back"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v5.0.6A",
|
||||
"color": "gold",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"Interlope"
|
||||
],
|
||||
"foundation": "2/15/24",
|
||||
"exclaimer": "added music finally fixed coreless mode made a seperate function for discord in the command manager and idk what all"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v5.0.7a",
|
||||
"color": "gold",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"Ski"
|
||||
],
|
||||
"foundation": "3/29/24",
|
||||
"exclaimer": "rewrote alot of shiiiiiiit :3 and added matrix support"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v5.0.7b",
|
||||
"color": "gold",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"Ski"
|
||||
],
|
||||
"foundation": "4/22/24",
|
||||
"exclaimer": "a lot of clean up adding shit and more"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v5.0.7c",
|
||||
"color": "gold",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"Ski"
|
||||
],
|
||||
"foundation": "5/1/24",
|
||||
"exclaimer": "added discord execute, redone the website command, added attachments for discord ported the urban package to the bot added ping"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "v5.0.8",
|
||||
"color": "dark_red",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"Censory Overload"
|
||||
],
|
||||
"foundation": "6/4/24",
|
||||
"exclaimer": "rewritten the urban command to use undici removed the music command changed the colors for the help command and more"
|
||||
}
|
||||
]
|
19
src/data/commonJSCommandFormat.js
Normal file
19
src/data/commonJSCommandFormat.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
module.exports = {
|
||||
data: {
|
||||
name: '<command name>',
|
||||
trustLevel: 0, // trust levels: 0, 1, 2, 3, 4
|
||||
aliases: [
|
||||
""
|
||||
],
|
||||
description: '',
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
|
||||
},
|
||||
discordExecute (context) {
|
||||
|
||||
}
|
||||
}
|
|
@ -1,20 +1,21 @@
|
|||
# FNFBoyfriendBot v6.0.0-alpha config
|
||||
|
||||
prefixes:
|
||||
- "!"
|
||||
- "fnfbfbot!"
|
||||
|
||||
discord:
|
||||
token: "discord token here"
|
||||
prefix: "!"
|
||||
invite: "discord invite here"
|
||||
enabled: true
|
||||
roles:
|
||||
trusted: "trusted"
|
||||
admin: "admin"
|
||||
owner: "FNFBoyfriendBot Owner"
|
||||
|
||||
core:
|
||||
# core refill methods:
|
||||
# chat: refill core in chat
|
||||
# item refill core in a command block placed by the bot
|
||||
name: {"translate":"outOfMemory.message"}
|
||||
method: 'item'
|
||||
area:
|
||||
start:
|
||||
x: 0
|
||||
|
@ -25,15 +26,24 @@ core:
|
|||
y: 0
|
||||
z: 15
|
||||
|
||||
commandSetMessage: false
|
||||
|
||||
keys:
|
||||
trusted: "trusted key here"
|
||||
admin: "admin key here"
|
||||
owner: "owner key here"
|
||||
|
||||
weatherApiKey: ""
|
||||
|
||||
colors:
|
||||
integer: "gold"
|
||||
discord:
|
||||
embed: "#000000"
|
||||
error: "#FF0000"
|
||||
commands:
|
||||
primary: "dark_blue"
|
||||
secondary: "blue"
|
||||
tertiary: "dark_gray"
|
||||
|
||||
console:
|
||||
prefix: "c."
|
||||
|
@ -45,6 +55,7 @@ bots:
|
|||
usernameGen: true
|
||||
version: "1.20.2"
|
||||
serverName: "localhost"
|
||||
private: false
|
||||
reconnectDelay: 6000
|
||||
channelId: "discord channel id here"
|
||||
logging: false
|
||||
|
|
19
src/data/es6JSCommandFormat.mjs
Normal file
19
src/data/es6JSCommandFormat.mjs
Normal file
|
@ -0,0 +1,19 @@
|
|||
export default {
|
||||
data: {
|
||||
name: '<command name>',
|
||||
trustLevel: 0, // trust levels: 0, 1, 2, 3, 4
|
||||
aliases: [
|
||||
|
||||
],
|
||||
description: '',
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
|
||||
},
|
||||
discordExecute (context) {
|
||||
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"bot": {
|
||||
"buildstring": {
|
||||
"version": "v6.0.2",
|
||||
"build":"1000",
|
||||
"codename":""
|
||||
},
|
||||
"source": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot/"
|
||||
}
|
||||
}
|
14
src/index.js
14
src/index.js
|
@ -4,22 +4,22 @@ const loadModules = require('./util/loadModules');
|
|||
const js_yaml = require('js-yaml');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const checks = require('./util/checks');
|
||||
const { Client, GatewayIntentBits } = require('discord.js');
|
||||
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits;
|
||||
const discordClient = new Client({ intents: [Guilds, GuildMessages, MessageContent] });
|
||||
console.log('Starting FNFBoyfriendBot');
|
||||
if (!fs.existsSync(path.join(__dirname, "../config.yml"))) {
|
||||
console.log("Config not found creating config from the default config");
|
||||
fs.copyFileSync(
|
||||
path.join(__dirname, "./data/default_config.yml"),
|
||||
path.join(__dirname, "../config.yml")
|
||||
)
|
||||
}
|
||||
checks();
|
||||
|
||||
try {
|
||||
config = js_yaml.load(fs.readFileSync(path.join(__dirname, '../', 'config.yml')))
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
if (config.core.method !== 'item' && config.core.method !== 'chat') {
|
||||
config.core.method = 'item';
|
||||
console.warn('invalid core method type defaulting to item');
|
||||
}
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { createGzip } = require("zlib");
|
||||
const readline = require('readline');
|
||||
const { Console } = require("console");
|
||||
function consolefilelogger(bot, options, message) {
|
||||
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 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)) {
|
||||
fs.mkdirSync(logFolder);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(`Unable to create log folder: ${e}`);
|
||||
}
|
||||
|
||||
function compressFile(input, output) {
|
||||
// if (!bot.Console.filelogging) return
|
||||
const plainOutput = output.slice(0, -3);
|
||||
|
||||
fs.renameSync(input, plainOutput);
|
||||
const gzip = createGzip();
|
||||
fs.createReadStream(plainOutput)
|
||||
.pipe(gzip)
|
||||
.pipe(fs.createWriteStream(output + ".tmp"))
|
||||
.once("finish", () => {
|
||||
fs.unlinkSync(plainOutput);
|
||||
fs.renameSync(output + ".tmp", output);
|
||||
});
|
||||
}
|
||||
|
||||
if (fs.existsSync(logFilePath)) {
|
||||
const plainName = fs
|
||||
.statSync(logFilePath)
|
||||
.ctime.toISOString()
|
||||
.split("T")[0];
|
||||
let name = plainName;
|
||||
let counter = 1;
|
||||
let newFileName = path.join(logFolder, `${name}.log.gz`);
|
||||
while (fs.existsSync(newFileName)) {
|
||||
name = `${plainName}-${counter}`;
|
||||
newFileName = path.join(logFolder, `${name}.log.gz`);
|
||||
counter++;
|
||||
}
|
||||
compressFile(logFilePath, newFileName);
|
||||
}
|
||||
bot.console.filelogging = function logging (message) {
|
||||
logStream.write(message + "\n");
|
||||
};
|
||||
}
|
||||
module.exports = consolefilelogger;
|
|
@ -1,4 +1,3 @@
|
|||
const readline = require('readline');
|
||||
function boot (bot, options, discordClient, config) {
|
||||
bot.on("packet.login", (data) => {
|
||||
if (bot.options.isCreayun) return
|
||||
|
|
|
@ -33,19 +33,19 @@ function chat (bot, options, config) {
|
|||
})
|
||||
switch (packet.type) {
|
||||
case 1:
|
||||
bot.emit('message', { translate: "chat.type.emote", with: [ sender, message ]})
|
||||
bot.emit('profilelessChat', { translate: "chat.type.emote", with: [ sender, message ]})
|
||||
break
|
||||
case 2:
|
||||
bot.emit('message', { translate: "commands.message.display.incoming", with: [ sender, message], color: "gray", italic: true })
|
||||
bot.emit('profilelessChat', { translate: "commands.message.display.incoming", with: [ sender, message], color: "gray", italic: true })
|
||||
break
|
||||
case 3:
|
||||
bot.emit('message', { translate: "commands.message.display.outgoing", with: [ sender, message ], color: "gray", italic: true })
|
||||
bot.emit('profilelessChat', [{ translate: "commands.message.display.outgoing", with: [ sender, message ], color: "gray", italic: true }])
|
||||
break
|
||||
case 4:
|
||||
bot.emit('message', message);
|
||||
bot.emit('profilelessChat', [message]);
|
||||
break
|
||||
case 5:
|
||||
bot.emit('message', { translate: 'chat.type.announcement', with: [ sender, message ]})
|
||||
bot.emit('profilelessChat', [{ translate: 'chat.type.announcement', with: [ sender, message ]}])
|
||||
break
|
||||
}
|
||||
tryParsingMessage(message, { senderName: sender, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
|
||||
|
@ -56,17 +56,27 @@ function chat (bot, options, config) {
|
|||
bot.emit('player_chat', { plain: packet.plainMessage, unsigned, senderUuid: packet.senderUuid })
|
||||
switch (packet.type) {
|
||||
case 5:
|
||||
bot.emit('message', { translate: "chat.type.announcement", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
|
||||
bot.emit('playerChat', { translate: "chat.type.announcement", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
|
||||
break
|
||||
case 4:
|
||||
bot.emit('playerChat', unsigned);
|
||||
break
|
||||
case 3:
|
||||
bot.emit('playerChat', { translate: "commands.message.display.outgoing", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
|
||||
break
|
||||
case 2:
|
||||
bot.emit('playerChat', { translate: "commands.message.display.incoming", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
|
||||
break
|
||||
case 1:
|
||||
bot.emit('playerChat', { translate: "chat.type.emote", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
|
||||
break
|
||||
default:
|
||||
bot.emit('message', unsigned)
|
||||
}
|
||||
tryParsingMessage(unsigned, { senderUuid: packet.senderUuid, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
|
||||
})
|
||||
|
||||
bot.on('packet.system_chat', packet => {
|
||||
const message = tryParse(packet.content)
|
||||
if (config.commandSetMessage) {
|
||||
if (!config.commandSetMessage) {
|
||||
if (message.translate === 'advMode.setCommand.success') return // Ignores command set message
|
||||
}
|
||||
if (message.translate === 'multiplayer.message_not_delivered') return
|
||||
|
@ -76,11 +86,36 @@ function chat (bot, options, config) {
|
|||
return
|
||||
}
|
||||
|
||||
bot.emit('message', message)
|
||||
bot.emit('systemChat', message)
|
||||
|
||||
tryParsingMessage(message, { players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
|
||||
})
|
||||
|
||||
bot.on('packet.action_bar', (message) => {
|
||||
let parsedMessage = tryParse(message.text)
|
||||
bot.emit('actionBar', {
|
||||
translate: '[%s] %s',
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
{ text: "Action Bar", color: "light_purple" },
|
||||
parsedMessage
|
||||
]
|
||||
});
|
||||
})
|
||||
|
||||
bot.on('packet.boss_bar', (data) => {
|
||||
bot.emit('bossBar', {
|
||||
translate: '[%s | %s: %s] %s',
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
{ text: "Boss Bar", color: "dark_aqua" },
|
||||
{ text: "Action ID", color: "blue" },
|
||||
{ text: `${data.action}`, color: 'gold' },
|
||||
tryParse(data.title)
|
||||
]
|
||||
})
|
||||
})
|
||||
|
||||
function tryParsingMessage (message, data) {
|
||||
let parsed
|
||||
for (const parser of bot.chatParsers) {
|
||||
|
@ -134,3 +169,4 @@ function chat (bot, options, config) {
|
|||
}
|
||||
}
|
||||
module.exports = chat;
|
||||
|
||||
|
|
24
src/modules/chat_command_handler.js
Normal file
24
src/modules/chat_command_handler.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
const CommandSource = require('../util/command_source');
|
||||
module.exports = (bot, options, config) => {
|
||||
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)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
|
@ -1,11 +1,16 @@
|
|||
const mcData = require('minecraft-data')('1.20.2');
|
||||
function core (bot, options, config) {
|
||||
let number = 0;
|
||||
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,
|
||||
|
||||
currentBlockRelative: { x: 0, y: 0, z: 0 },
|
||||
|
||||
refill () {
|
||||
const pos = bot.core.position
|
||||
const { start, end } = bot.core.area
|
||||
|
@ -21,7 +26,51 @@ function core (bot, options, config) {
|
|||
it will not refill core until the pos is not NaN
|
||||
instead of tping to a set cords cuz fuck you im not doing that
|
||||
*/
|
||||
bot.chat.command(`minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'}`)
|
||||
if (config.core.method === 'chat') {
|
||||
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)}'}`)
|
||||
} else if (config.core.method === 'item') {
|
||||
bot._client.write('set_creative_slot', {
|
||||
slot: 36,
|
||||
item: {
|
||||
present: true,
|
||||
itemId: mcData.itemsByName.command_block.id,
|
||||
itemCount: 1,
|
||||
nbtData: {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
bot._client.write('block_dig', {
|
||||
status: 0,
|
||||
location: {
|
||||
x: bot.position.x,
|
||||
y: bot.position.y,
|
||||
z: bot.position.z
|
||||
},
|
||||
face: 0
|
||||
});
|
||||
|
||||
bot._client.write('block_place', {
|
||||
hand: 0,
|
||||
location: {
|
||||
x: bot.position.x,
|
||||
y: bot.position.y,
|
||||
z: bot.position.z
|
||||
},
|
||||
direction: 0,
|
||||
cursorX: 0.1,
|
||||
cursorY: 0,
|
||||
cursorZ: 0.1,
|
||||
insideBlock: false
|
||||
});
|
||||
|
||||
bot._client.write('update_command_block', {
|
||||
location: bot.position,
|
||||
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)}'}`,
|
||||
flags: 5,
|
||||
mode: 1
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
move (pos = bot.position) {
|
||||
|
@ -64,23 +113,32 @@ function core (bot, options, config) {
|
|||
},
|
||||
|
||||
run (command) {
|
||||
const eee = Math.floor(Math.random() * 10000)
|
||||
const location = bot.core.currentBlock()
|
||||
if (!location) return
|
||||
if (bot.options.isSavage || bot.options.isCreayun || bot.options.useChat) {
|
||||
bot.chat.command(`${command?.substring(0, 256)}`)
|
||||
return
|
||||
} else {
|
||||
bot._client.write('update_command_block', { command: command.substring(0, 32767), location, mode: 1, flags: 0b100 })
|
||||
bot.core.incrementCurrentBlock()
|
||||
bot._client.write('update_command_block', { command: command.substring(0, 32767), location, mode: 1, flags: 0b100 });
|
||||
bot._client.write('query_block_nbt', ({ location: location, transactionId: eee}));
|
||||
bot.core.incrementCurrentBlock();
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
// if (bot.options.useChat ?? bot.options.isCreayun ?? bot.options.isSavage) return
|
||||
|
||||
if (bot.options.isSavage || bot.options.isCreayun) return
|
||||
bot.on('move', () => {
|
||||
// if (bot.options.isSavage) return
|
||||
bot.core.move(bot.position)
|
||||
// setTimeout(() => bot.core.run('say Hello, world!'), 1000)
|
||||
})
|
||||
|
||||
bot.on('packet.block_change', (data) => {
|
||||
// console.log('data pos ' + JSON.stringify(data.location))
|
||||
// console.log('core pos ' +JSON.stringify(bot.core.position));
|
||||
if (data.type === 0) {
|
||||
// console.log('data pos ' + JSON.stringify(data.location));
|
||||
// console.log('core position ' + JSON.stringify(bot.core.position));
|
||||
// bot.core.refill();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = core;
|
||||
|
|
|
@ -11,6 +11,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);
|
||||
})
|
||||
|
|
|
@ -3,7 +3,7 @@ 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) {
|
||||
async function command_manager (bot, options, config, discordClient) {
|
||||
bot.commandManager = {
|
||||
commands: {},
|
||||
commandlist: [],
|
||||
|
@ -20,63 +20,51 @@ function command_manager (bot, options, config, discordClient) {
|
|||
}
|
||||
} 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"
|
||||
}
|
||||
])
|
||||
bot.tellraw("@a", {
|
||||
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?.console && !source?.sources?.discord) {
|
||||
if (!command || !command.execute)
|
||||
bot.console.warn([
|
||||
{
|
||||
translate: 'command.unknown.command',
|
||||
color: "dark_red"
|
||||
},
|
||||
{
|
||||
text: "\n",
|
||||
},
|
||||
{
|
||||
text: `${commandName}`,
|
||||
color: "dark_red"
|
||||
},
|
||||
{
|
||||
translate: "command.context.here",
|
||||
color: "dark_red"
|
||||
}
|
||||
])
|
||||
bot.console.warn(bot.getMessageAsPrismarine({
|
||||
translate: "%s%s%s %s",
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ translate: "command.unknown.command", color: "red" },
|
||||
{ text: "\n" },
|
||||
{ text: `${commandName}` },
|
||||
{ translate: "command.context.here", color: "red" }
|
||||
]
|
||||
})?.toAnsi())
|
||||
}
|
||||
if (command?.trustLevel > 0) {
|
||||
if (command?.data?.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 and 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) {
|
||||
if (command?.data?.trustLevel === 1 && !source?.sources?.discord) {
|
||||
if (args.length === 0 && bot.validation.trusted && bot.validation.admin && bot.validation.owner && !source?.sources?.console) throw new CommandError({ text: "Please provide a trusted, admin or owner hash", color: "dark_red" })
|
||||
if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.admin && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted, admin or owner hash', color: 'dark_red' });
|
||||
} else if (command?.data?.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 (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!', color: "dark_red" })
|
||||
}
|
||||
if (command?.trustLevel === 2 && !source.sources.console) {
|
||||
if (args.length === 0 && bot.validation.admin && bot.validation.owner && !source.sources.console) throw new CommandError({ text: "Please provide an trusted or owner hash" })
|
||||
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?.data?.trustLevel === 2 && !source.sources.console) {
|
||||
if (args.length === 0 && bot.validation.admin && bot.validation.owner && !source.sources.console) throw new CommandError({ text: "Please provide an trusted or owner hash", color: 'dark_red' })
|
||||
if (args[0] !== bot.validation.admin && 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 (command?.data?.trustLevel === 3 && !source.sources.discord && !source.sources.console) {
|
||||
if (args.length === 0 && bot.validation.owner) throw new CommandError({ text: "Please provide an owner hash", color: "dark_red" })
|
||||
if (args[0] !== bot.validation.owner) throw new CommandError({ translate: 'Invalid owner hash', color: 'dark_red' })
|
||||
} else if (command?.trustLevel === 3 && source.sources.discord && !source.sources.console) {
|
||||
} else if (command?.data?.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 (!hasRole) throw new CommandError({ translate: 'You are not the owner!', color: "dark_red" })
|
||||
} else if (command?.data?.trustLevel === 4 && !source.sources.console) {
|
||||
throw new CommandError({ text: 'This command can only be ran via console', color: "dark_red" });
|
||||
}
|
||||
}
|
||||
if (!command?.discordExecute && command && source?.sources?.discord) {
|
||||
|
@ -86,10 +74,10 @@ function command_manager (bot, options, 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})
|
||||
return command?.execute({ bot, source, arguments: args, config, discordClient });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error.stack)
|
||||
console.error(error)
|
||||
if (source?.sources?.discord && !source?.sources?.console) {
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.error}`)
|
||||
|
@ -101,12 +89,29 @@ function command_manager (bot, options, config, discordClient) {
|
|||
]
|
||||
})
|
||||
} else if (!source?.sources?.discord && !source?.sources?.console) {
|
||||
if (error instanceof CommandError)
|
||||
bot.tellraw("@a", { text: error.message, color: "dark_red" })
|
||||
else bot.tellraw("@a", [{ translate: 'command.failed', color: "dark_red", hoverEvent: { action: 'show_text', contents: `${error.stack}` } }])
|
||||
if (error instanceof CommandError) {
|
||||
if (bot.options.isSavage || bot.options.isCreayun) {
|
||||
bot.chat.message(`&4${error.message}`)
|
||||
} else {
|
||||
if (error.toString().length > 256) {
|
||||
bot.tellraw("@a", error._message);
|
||||
} else if (error.toString().length < 256) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&')}`)
|
||||
} else {
|
||||
bot.tellraw("@a", error._message);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (bot.options.isSavage || bot.options.isCreayun) {
|
||||
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}` } }])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
executeString (source, command) {
|
||||
const [commandName, ...args] = command.split(' ')
|
||||
return this.execute(source, commandName, args)
|
||||
|
@ -114,20 +119,18 @@ function command_manager (bot, options, config, discordClient) {
|
|||
|
||||
discordExecute(source, command) {
|
||||
const [commandName, ...args] = command.split(" ");
|
||||
if (source?.sources?.discord && !source.sources.console) {
|
||||
if (source?.sources?.discord && !source?.sources?.console) {
|
||||
return this.discordExecute(source, commandName, args)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
register (command) {
|
||||
this.commands[command.name] = command
|
||||
if (command.aliases) {
|
||||
command.aliases.map((a) => (this.commands[a] = command));
|
||||
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]
|
||||
},
|
||||
|
@ -135,54 +138,35 @@ 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;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const CommandSource = require('../util/command_source');
|
||||
const prismarineChat = require('prismarine-chat')('1.20.2');
|
||||
function Console (bot, options, config) {
|
||||
let rateLimit = 0;
|
||||
let ratelimit = 0;
|
||||
bot.console = {
|
||||
readline: null,
|
||||
server: 'all',
|
||||
|
@ -19,7 +19,7 @@ function Console (bot, options, config) {
|
|||
})
|
||||
})
|
||||
},
|
||||
source: new CommandSource(bot.options.username, { console: true, discord: false }),
|
||||
source: new CommandSource(bot._client.username, { console: true, discord: false }),
|
||||
refreshLine (...args) {
|
||||
this.readline.output.write("\x1b[2K\r");
|
||||
console.log.apply(console, arguments);
|
||||
|
@ -50,7 +50,7 @@ function Console (bot, options, config) {
|
|||
},
|
||||
{
|
||||
selector: `${bot.username}`, color:'#00FFFF',
|
||||
clickEvent: { action: 'suggest_command', value: '~help' }
|
||||
clickEvent: { action: 'suggest_command', value: `${config.prefixes[0]}help` }
|
||||
},
|
||||
{
|
||||
text: '',
|
||||
|
@ -66,17 +66,74 @@ function Console (bot, options, config) {
|
|||
}
|
||||
}
|
||||
}
|
||||
bot.on('message', (message) => {
|
||||
setInterval(() => ratelimit = 0, 1000 * 2);
|
||||
|
||||
bot.on('profilelessChat', (message) => {
|
||||
if (!options.logging) return;
|
||||
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
||||
})
|
||||
|
||||
bot.on('systemChat', (message) => {
|
||||
if (!options.logging) return;
|
||||
if (ratelimit > 15) return;
|
||||
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
||||
ratelimit++
|
||||
})
|
||||
|
||||
bot.on('playerChat', (message) => {
|
||||
if (!options.logging) return;
|
||||
if (ratelimit > 15) return;
|
||||
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
||||
ratelimit++
|
||||
})
|
||||
// console.log(ratelimit)
|
||||
bot.on('bossBar', (message) => {
|
||||
if (!options.logging) return;
|
||||
if (ratelimit > 10) return;
|
||||
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
||||
ratelimit++
|
||||
})
|
||||
|
||||
bot.on('actionBar', (message) => {
|
||||
if (!options.logging) return;
|
||||
if (ratelimit > 10) return
|
||||
// bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
||||
ratelimit++
|
||||
})
|
||||
|
||||
/*
|
||||
setInterval(() => spamCount = 0, 1000 * 2)
|
||||
|
||||
bot.on('message', message => {
|
||||
if (spamCount > 300) {
|
||||
console.log('WTF spam detected not logging')
|
||||
return
|
||||
}
|
||||
|
||||
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi()
|
||||
const string = bot.getMessageAsPrismarine(message)?.toString()
|
||||
const now = new Date().toLocaleString()
|
||||
|
||||
|
||||
spamCount++
|
||||
*/
|
||||
|
||||
/* bot.on('message', (message) => {
|
||||
rateLimit++
|
||||
setTimeout(() => {
|
||||
rateLimit--
|
||||
}, 1000)
|
||||
if (!options.logging) return;
|
||||
/* if (rateLimit > 100) {
|
||||
if (rateLimit > 100) {
|
||||
return
|
||||
}*/
|
||||
}
|
||||
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
||||
})
|
||||
})*/
|
||||
}
|
||||
module.exports = Console;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// TODO: Maybe move client creation elsepwhere
|
||||
const { Client, GatewayIntentBits, interaction } = require('discord.js')
|
||||
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits
|
||||
//const { Client, GatewayIntentBits, interaction } = require('discord.js')
|
||||
//const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits
|
||||
const fixansi = require('../util/ansi');
|
||||
const CommandSource = require('../util/command_source')
|
||||
|
||||
const client = new Client({ intents: [Guilds, GuildMessages, MessageContent] })
|
||||
//const client = new Client({ intents: [Guilds, GuildMessages, MessageContent] })
|
||||
const util = require('util')
|
||||
|
||||
function discord(bot, options, config, discordClient) {
|
||||
|
@ -57,10 +57,22 @@ function discord(bot, options, config, discordClient) {
|
|||
sendDiscordMessage(e.message)
|
||||
}
|
||||
}
|
||||
bot.on('message', message => {
|
||||
sendComponent(message)
|
||||
|
||||
bot.on('profilelessChat', (message) => {
|
||||
sendComponent(message);
|
||||
})
|
||||
|
||||
bot.on('systemChat', (message) => {
|
||||
sendComponent(message);
|
||||
})
|
||||
|
||||
bot.on('playerChat', (message) => {
|
||||
sendComponent(message);
|
||||
})
|
||||
/* bot.on('message', message => {
|
||||
sendComponent(message)
|
||||
})*/
|
||||
|
||||
function messageCreate(message, source) {
|
||||
bot.discord.message = message;
|
||||
if (message.author.id === bot.discord.client.user.id) return
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
function player_list (bot, options, config) {
|
||||
bot.players = []
|
||||
|
||||
bot.on('packet.player_info', packet => {
|
||||
bot.on('packet.player_info', async (packet) => {
|
||||
const actions = []
|
||||
|
||||
if (packet.action & 0b000001) actions.push(addPlayer)
|
||||
if (packet.action & 0b000010) actions.push(initializeChat)
|
||||
if (packet.action & 0b000100) actions.push(updateGamemode)
|
||||
|
@ -16,13 +15,21 @@ function player_list (bot, options, config) {
|
|||
action(entry)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
bot.on('packet.player_remove', ({ players }) => {
|
||||
// TODO: Add player removal (with validation)
|
||||
for (const player of players) {
|
||||
bot.players = bot.players.filter(entry => entry.uuid !== player)
|
||||
}
|
||||
bot.on('packet.player_remove', async ({players}) => { // players has uuids of the players
|
||||
let player_completion = (await bot.tab_complete('scoreboard players add ')).filter(_ => _.tooltip == undefined) // exclude @a, @r, @s, @e, @p -aaa
|
||||
bot.players.forEach(async player => {
|
||||
if(!players.includes(player.uuid)) return
|
||||
|
||||
const a = player_completion.filter(_ => _.match == player.profile.name)
|
||||
if(a.length >= 1) {
|
||||
player.vanished = true
|
||||
} else {
|
||||
bot.players = bot.players.filter(_ => _.uuid != player.uuid)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
function addPlayer (entry) {
|
||||
|
@ -30,17 +37,17 @@ function player_list (bot, options, config) {
|
|||
bot.players.push({
|
||||
uuid: entry.uuid,
|
||||
profile: { name: entry.player.name, properties: entry.player.properties },
|
||||
|
||||
chatSession: undefined,
|
||||
gamemode: undefined,
|
||||
listed: undefined,
|
||||
latency: undefined,
|
||||
displayName: undefined
|
||||
displayName: undefined,
|
||||
vanished: false
|
||||
})
|
||||
}
|
||||
|
||||
function initializeChat (entry) {
|
||||
// TODO: Handle chat sessions
|
||||
|
||||
}
|
||||
|
||||
function updateGamemode (entry) {
|
||||
|
|
|
@ -2,10 +2,15 @@ const mc = require('minecraft-protocol');
|
|||
const usernameGen = require("../util/usernameGen");
|
||||
function reconnect (bot, options, config) {
|
||||
bot.on('end', () => {
|
||||
//bot = undefined;
|
||||
|
||||
bot._client.removeAllListeners();
|
||||
//client = undefined;
|
||||
//bot._client = undefined;
|
||||
if (bot.reconnectDelay < 0) return
|
||||
setTimeout(() => {
|
||||
if (options.usernameGen) {
|
||||
client = options.client ?? mc.createClient(options, bot.options.username = usernameGen())
|
||||
client = options.client ?? mc.createClient(options, options.username = usernameGen(bot))
|
||||
} else {
|
||||
client = options.client ?? mc.createClient(options)
|
||||
}
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
const createRegistry = require('prismarine-registry')
|
||||
|
||||
function registry (bot) {
|
||||
bot.on('packet.login', packet => {
|
||||
bot.registry = createRegistry(bot._client.version)
|
||||
bot.registry.language = require('../data/language.json');
|
||||
bot.emit('registry_ready', bot.registry)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = registry;
|
|
@ -10,48 +10,109 @@ function selfcare (bot, options, config) {
|
|||
let teleportToggle = false;
|
||||
let username = false;
|
||||
let nickname = false;
|
||||
let login = false;
|
||||
let register = false;
|
||||
let positionCount = 0;
|
||||
bot.vanished = true
|
||||
// You now have the tag: &8[&bPrefix&8: &3~&8]
|
||||
// You no longer have a tag
|
||||
bot.on('message', (message) => {
|
||||
bot.on('systemChat', (message) => {
|
||||
const stringMessage = bot.getMessageAsPrismarine(message)?.toString();
|
||||
// if (stringMessage?.startsWith("Successfully enabled CommandSpy")) commandSpy = true;
|
||||
// else if (stringMessage?.startsWith("Successfully disabled CommandSpy")) commandSpy = false;
|
||||
if (stringMessage === "Successfully enabled CommandSpy") commandSpy = true;
|
||||
else if (stringMessage === "Successfully enabled CommandSpy.") commandSpy = true;
|
||||
else if (stringMessage === "Successfully disabled CommandSpy") commandSpy = false;
|
||||
else if (stringMessage === "Successfully disabled CommandSpy.") commandSpy = false;
|
||||
else if (stringMessage === `Vanish for ${bot.options.username}: enabled`) vanished = true;
|
||||
else if (stringMessage === `Vanish for ${bot.options.username}: disabled`) vanished = false;
|
||||
else if (stringMessage === `You now have the tag: &8[&bPrefix&8: &3${config.prefixes[0]}&8]` || stringMessage === "Something went wrong while saving the prefix. Please check console.") prefix = true;
|
||||
else if (stringMessage?.startsWith("You now have the tag: ") || stringMessage === "You no longer have a tag") prefix = false
|
||||
else if (stringMessage?.startsWith("You have been muted")) unmuted = true;
|
||||
else if (stringMessage?.startsWith("You have been unmuted")) unmuted = false;
|
||||
else if (stringMessage?.startsWith("Your voice has been silenced")) unmuted = true;
|
||||
else if (stringMessage === "God mode disabled.") god = false;
|
||||
else if (stringMessage === "God mode enabled.") god = true;
|
||||
else if (stringMessage === "Teleportation disabled.") teleportToggle = true;
|
||||
else if (stringMessage === "Teleportation enabled.") teleportToggle = false;
|
||||
else if (stringMessage === `Successfully set your username to "${bot.username}"`) {
|
||||
username = false
|
||||
return
|
||||
if (options.isSavage) {
|
||||
if (stringMessage === "Please, login with the command: /login <password>") login = true;
|
||||
else if (stringMessage === "Successful login!") login = false;
|
||||
else if (stringMessage === "You're already logged in!") login = false;
|
||||
else if (stringMessage === "Please, register to the server with the command: /register <password> <ConfirmPassword>") register = true;
|
||||
else if (stringMessage === "This user isn't registered!") register = true;
|
||||
else if (stringMessage === "Successfully registered!") register = false;
|
||||
// else if (stringMessage === "You already have registered this username!") register = false;
|
||||
|
||||
else if (stringMessage === "You're already logged in!") register = false;
|
||||
else if (stringMessage === "Successful login!") register = false;
|
||||
/*
|
||||
You're already logged in!
|
||||
Please, register to the server with the command: /register <password> <ConfirmPassword>
|
||||
Please, login with the command: /login <password>
|
||||
Successfully registered!
|
||||
Successful login!
|
||||
You already have registered this username!
|
||||
*/
|
||||
|
||||
} else if (options.isKaboom) {
|
||||
// const stringMessage = bot.getMessageAsPrismarine(message)?.toString();
|
||||
if (stringMessage === "Successfully enabled CommandSpy") commandSpy = true;
|
||||
else if (stringMessage === "Successfully enabled CommandSpy.") commandSpy = true;
|
||||
else if (stringMessage === "Successfully disabled CommandSpy") commandSpy = false;
|
||||
else if (stringMessage === "Successfully disabled CommandSpy.") commandSpy = false;
|
||||
else if (stringMessage === `Vanish for ${bot.options.username}: enabled`) vanished = true;
|
||||
else if (stringMessage === `Vanish for ${bot.options.username}: disabled`) vanished = false;
|
||||
else if (stringMessage === `You now have the tag: &8[&bPrefix&8: &3${config.prefixes[0]}&8]` || stringMessage === "Something went wrong while saving the prefix. Please check console.") prefix = true;
|
||||
else if (stringMessage?.startsWith("You now have the tag: ") || stringMessage === "You no longer have a tag") prefix = false
|
||||
else if (stringMessage?.startsWith("You have been muted")) unmuted = true;
|
||||
else if (stringMessage?.startsWith("You have been unmuted")) unmuted = false;
|
||||
else if (stringMessage?.startsWith("Your voice has been silenced")) unmuted = true;
|
||||
else if (stringMessage === "God mode disabled.") god = false;
|
||||
else if (stringMessage === "God mode enabled.") god = true;
|
||||
else if (stringMessage === "Teleportation disabled.") teleportToggle = true;
|
||||
else if (stringMessage === "Teleportation enabled.") teleportToggle = false;
|
||||
else if (stringMessage === `Successfully set your username to "${bot.username}"`) {
|
||||
username = false
|
||||
return
|
||||
}
|
||||
else if (stringMessage?.startsWith("Successfully set your username to ")) username = true
|
||||
else if (stringMessage === `You already have the username "${bot.username}"`) username = false
|
||||
else if (stringMessage === `You no longer have a nickname.`) nickname = false;
|
||||
else if (stringMessage.startsWith('Your nickname is now ')) nickname = true;
|
||||
}
|
||||
else if (stringMessage?.startsWith("Successfully set your username to ")) username = true
|
||||
else if (stringMessage === `You already have the username "${bot.username}"`) username = false
|
||||
else if (stringMessage === `You no longer have a nickname.`) nickname = false;
|
||||
else if (stringMessage.startsWith('Your nickname is now ')) nickname = true;
|
||||
})
|
||||
|
||||
bot.on('packet.entity_status', packet => {
|
||||
if (packet.entityId !== entityId || packet.entityStatus < 24 || packet.entityStatus > 28) return
|
||||
permissionLevel = packet.entityStatus - 24
|
||||
})
|
||||
|
||||
bot.on('packet.game_state_change', packet => {
|
||||
if (packet.reason !== 3) return // Reason 3 = Change Game Mode
|
||||
gameMode = packet.gameMode;
|
||||
});
|
||||
|
||||
bot.on("packet.game_state.change", packet => {
|
||||
if (packet.reason !== 4) return // checks if the bot is seeing the endcredits or died
|
||||
clientLock = packet.gameMode;
|
||||
})
|
||||
|
||||
bot.on("packet.position", (packet, position) => {
|
||||
if (options.isSavage || options.isCreayun) return
|
||||
positionCount++
|
||||
setTimeout(() => {
|
||||
positionCount--
|
||||
if (positionCount > 4) {
|
||||
bot.core.run('sudo * icu stop');
|
||||
} if (permissionLevel < 2 || gameMode !== 1) {
|
||||
bot._client.end('anti icu :3');
|
||||
}
|
||||
}, 1000)
|
||||
})
|
||||
|
||||
bot.on("packet.teams", (data) => {
|
||||
if (options.isSavage || options.isCreayun) return;
|
||||
try {
|
||||
/*
|
||||
if (data.team !== "FNFBoyfriendBot") {
|
||||
bot.chat.command(`minecraft:team add FNFBoyfriendBot`);
|
||||
}
|
||||
if (data.mode > 1 && !data.team === "FNFBoyfriendBot") {
|
||||
bot.chat.command(`minecraft:team add FNFBoyfriendBot`);
|
||||
}
|
||||
if (data.team === "FNFBoyfriendBot") {
|
||||
console.log(data);
|
||||
}
|
||||
*/
|
||||
} catch (e) {
|
||||
console.log(e.stack)
|
||||
}
|
||||
})
|
||||
|
||||
let timer;
|
||||
bot.on('packet.login', (packet) => {
|
||||
entityId = packet.entityId;
|
||||
|
@ -59,7 +120,11 @@ function selfcare (bot, options, config) {
|
|||
clientLock = packet.gameMode;
|
||||
timer = setInterval(() => {
|
||||
if (bot.options.isSavage && !bot.options.isKaboom && !bot.options.isCreayun) {
|
||||
if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 });
|
||||
if (login) bot.chat.command('login amogusissus');
|
||||
else if (register) bot.chat.command('register amogusissus amogusissus');
|
||||
// else if (permissionLevel < 2) bot.chat.command(`minecraft:op ${bot.options.username}`);
|
||||
else if (gameMode !== 1) bot.chat.command('minecraft:gamemode creative');
|
||||
else if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 });
|
||||
} else if (bot.options.isCreayun && !bot.options.isKaboom && !bot.options.isSavage) {
|
||||
|
||||
} else if (bot.options.isKaboom && !bot.options.isSavage) {
|
||||
|
@ -69,7 +134,7 @@ function selfcare (bot, options, config) {
|
|||
else if (username) bot.chat.command(`username ${bot.options.username}`)
|
||||
else if (nickname) bot.chat.command(`nick off`)
|
||||
else if (!prefix) bot.chat.command(`prefix &8[&bPrefix&8: &3${config.prefixes[0]}&8]`);
|
||||
else if (!vanished) bot.core.run(`vanish ${bot.options.username} on`);
|
||||
else if (!vanished && bot.vanished) bot.chat.command(`essentials:vanish on`);
|
||||
else if (unmuted) bot.core.run(`essentials:mute ${bot.uuid}`);
|
||||
else if (!god) bot.core.run(`god ${bot.options.username} enable`);
|
||||
else if (!teleportToggle) bot.core.run(`tptoggle ${bot.options.username} disable`);
|
||||
|
|
16
src/modules/tab_complete.js
Normal file
16
src/modules/tab_complete.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
module.exports = (bot) => {
|
||||
// let aaa cook
|
||||
bot.tab_complete = (str) => {
|
||||
return new Promise((resolve) => {
|
||||
bot._client.write('tab_complete', {
|
||||
text: str, assumeCommand: false, sendBlockInSight: false
|
||||
})
|
||||
const tab_completeH = (packet) => {
|
||||
bot._client.removeListener('tab_complete', tab_completeH)
|
||||
|
||||
resolve(packet.matches)
|
||||
}
|
||||
bot._client.once('tab_complete', tab_completeH)
|
||||
})
|
||||
}
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
const crypto = require("crypto");
|
||||
function validation (bot, options, config, discordClient) {
|
||||
let hashRegenInterval = setInterval(() => {
|
||||
const crypto = require('crypto')
|
||||
function validation (bot, options, config) {
|
||||
setInterval(() => {
|
||||
bot.validation = {
|
||||
trusted: crypto.createHash('sha256').update(Math.floor(Date.now() / 5000) + config.keys.trusted).digest('hex').substring(0, 16),
|
||||
admin: crypto.createHash('sha256').update(Math.floor(Date.now() / 5000) + config.keys.admin).digest('hex').substring(0, 16),
|
||||
owner: crypto.createHash('sha256').update(Math.floor(Date.now() / 5000) + config.keys.owner).digest('hex').substring(0, 16),
|
||||
trusted: crypto.createHash('sha256').update(Math.floor(Date.now() / 1000) + config.keys.trusted).digest('hex').substring(0, 16),
|
||||
admin: crypto.createHash('sha256').update(Math.floor(Date.now() / 1000) + config.keys.admin).digest('hex').substring(0, 16),
|
||||
owner: crypto.createHash('sha256').update(Math.floor(Date.now() / 1000) + config.keys.owner).digest('hex').substring(0, 16),
|
||||
}
|
||||
}, 2000)
|
||||
}, 100)
|
||||
}
|
||||
module.exports = validation;
|
||||
module.exports = validation
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
function tellraw (bot, options, config) {
|
||||
bot.tellraw = (selector, message) => {
|
||||
bot.core.run(`minecraft:tellraw ${selector} ` + JSON.stringify(message))
|
||||
}
|
||||
}
|
||||
module.exports = tellraw;
|
|
@ -1,14 +1,24 @@
|
|||
const ChatMessage = require('prismarine-chat')('1.20.2');
|
||||
const util = require('util');
|
||||
function creayun (messageobj, data) {
|
||||
let match;
|
||||
let sender;
|
||||
const stringify = message => new ChatMessage(message).toString()
|
||||
const message = stringify(messageobj);
|
||||
const playerWithPrefix = /^(.*?) (\S*?) » (.*?)$/;
|
||||
const playerWithoutPrefix = /^(\S*?) » (.*?)$/
|
||||
if (playerWithPrefix.test(message)) {
|
||||
let match = message.match(playerWithPrefix)
|
||||
const sender = data.players.find((player) => player.uuid === player.uuid)
|
||||
if (!sender) return undefined
|
||||
match = message.match(playerWithPrefix)
|
||||
// console.log(match[2])
|
||||
// console.log(data.players.find(player => player.profile.name.toString().replaceAll('§','') === match[2]))
|
||||
// console.log(data.players)
|
||||
// console.log(match[0])
|
||||
// console.log(match[2])
|
||||
// console.log(data.players.find(player => player.profile.name === match[2]))
|
||||
sender = data.players.find(player => player.profile.name === match[2])
|
||||
// sender = data.players.find(player => util.isDeepStrictEqual(player.displayName, playerListDisplayName))
|
||||
// if (!sender) return;
|
||||
// console.log(sender)
|
||||
return { sender, contents: match[3], type: 'minecraft:chat'};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,8 +14,7 @@ function VanillaChat (message, data, context) {
|
|||
const stringUsername = data.getMessageAsPrismarine(senderComponent).toString() // TypeError: data.getMessageAsPrismarine is not a function
|
||||
sender = data.players.find(player => player.profile.name === stringUsername)
|
||||
}
|
||||
if (!sender) return undefined
|
||||
|
||||
if (!sender) return stringUsername
|
||||
return { sender, contents, type: 'minecraft:chat', senderComponent }
|
||||
} catch(e) {
|
||||
console.error(`${e.toString()}`)
|
||||
|
|
24
src/util/checks.js
Normal file
24
src/util/checks.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
module.exports = () => {
|
||||
if (!fs.existsSync(path.join(__dirname, "../../config.yml"))) {
|
||||
console.warn("Config not found creating config from the default config");
|
||||
fs.copyFileSync(
|
||||
path.join(__dirname, "../data/default_config.yml"),
|
||||
path.join(__dirname, "../../config.yml")
|
||||
)
|
||||
}
|
||||
|
||||
/* if (!fs.existsSync(path.join(__dirname, "../data/filter.json"))) {
|
||||
console.warn("filter json not found creating the file,......");
|
||||
let data = [{ ignoreCase: false, regexed: false, name: 'whatever player username idfk' }]
|
||||
fs.writeFileSync(path.join(__dirname, "../data/filter.json"), JSON.stringify(data))
|
||||
}*/
|
||||
|
||||
/*
|
||||
if (!fs.existsSync(path.join(__dirname, "../data/trustedPlayers.json"))) {
|
||||
console.warn("Trusted Players json not found creating the file,......");
|
||||
let data = [{player: ""}]
|
||||
fs.writeFileSync(path.join(__dirname, "../data/trustedPlayers.json"), JSON.stringify(data))
|
||||
}*/
|
||||
}
|
|
@ -1,12 +1,14 @@
|
|||
// TODO: Improve how messages are stringified
|
||||
const ChatMessage = require('prismarine-chat')('1.20.2')
|
||||
const stringify = message => new ChatMessage(message).toString()
|
||||
const stringify = message => new ChatMessage(message)?.toString()
|
||||
|
||||
class CommandError extends Error {
|
||||
constructor (message, filename, lineError) {
|
||||
super(stringify(message), filename, lineError)
|
||||
constructor (message, filename, lineError, useChat) {
|
||||
super(stringify(message), filename, lineError, useChat)
|
||||
this.name = 'CommandError'
|
||||
this._message = message
|
||||
return this._useChat = useChat
|
||||
// this._useChat = useChat
|
||||
}
|
||||
|
||||
get message () {
|
||||
|
|
|
@ -1,15 +1,38 @@
|
|||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
function loadModules (bot, options, config, discordClient) {
|
||||
async function loadModules (bot, options, config, discordClient) {
|
||||
// let module
|
||||
bot.loadModule = module => module(bot, options, config, discordClient)
|
||||
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, '../', 'modules'))) {
|
||||
try {
|
||||
const module = require(path.join(__dirname, '../', 'modules', filename))
|
||||
bot.loadModule(module)
|
||||
if (filename.endsWith(".mjs")) {
|
||||
// const module = await import(path.join(__dirname, '../', 'modules', filename));
|
||||
// bot.loadModule(module);
|
||||
} else if (filename.endsWith(".js")) {
|
||||
const module = require(path.join(__dirname, '../', 'modules', filename));
|
||||
bot.loadModule(module);
|
||||
}
|
||||
//bot.loadModule(module)
|
||||
} catch (error) {
|
||||
console.error('Failed to load module', filename, ':', error)
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = loadModules;
|
||||
/*
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, '../commands'))) {
|
||||
try {
|
||||
if (filename.endsWith('.mjs')) {
|
||||
let commands = await import(path.join(__dirname, '../commands', filename))
|
||||
bot.commandManager.register(commands.command);
|
||||
bot.commandManager.commandlist.push(commands.command);
|
||||
} if (filename.endsWith('.js')) {
|
||||
let commands = require(path.join(__dirname, '../commands', filename));
|
||||
bot.commandManager.register(commands);
|
||||
bot.commandManager.commandlist.push(commands);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load command', filename, ':', error)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
5
src/util/proxy/chat.js
Normal file
5
src/util/proxy/chat.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
module.exports = (bot, options, config, discordClient, proxyClient) => {
|
||||
proxyClient.on('packet.player_chat', (packet) => {
|
||||
proxyClient.emit('playerChat', packet.unsignedChatContent)
|
||||
})
|
||||
}
|
|
@ -1,5 +1,10 @@
|
|||
function usernameGen () {
|
||||
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
|
||||
function usernameGen (bot, config) {
|
||||
// const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
|
||||
if (bot.options.isSavage || bot.options.isCreayun && !bot.options.isKaboom) {
|
||||
characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
|
||||
} else {
|
||||
characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_-+={]}[|\\:;>.<,/?ඞ♋'
|
||||
}
|
||||
let username = '';
|
||||
for (let i = 0; i < 10; i++ ) {
|
||||
const randomIndex = Math.floor(Math.random() * characters.length);
|
||||
|
|
Loading…
Reference in a new issue