forked from afspiegeling/NitoriBot
Compare commits
16
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6f77b0ac3 | ||
|
|
e75576a488 | ||
|
|
0b264d7aaf | ||
|
|
fda85555fc | ||
|
|
6c77eb0405 | ||
|
|
86dee2fc1c | ||
|
|
0e3d337f03 | ||
|
|
ab0bee81fb | ||
|
|
43d7ab7b82 | ||
|
|
166abfcae8 | ||
|
|
9585f64ab7 | ||
|
|
648f4431d7 | ||
|
|
2a812961e1 | ||
|
|
e5741ffac1 | ||
|
|
b295cc2d0f | ||
|
|
6eeb079ced |
@@ -3,3 +3,7 @@ config.yml
|
||||
.git
|
||||
src/modules/exploits.js
|
||||
logs/*
|
||||
src/data/filter.json
|
||||
data/filter.json
|
||||
prototyping-crap
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
const bots = require('../data/changelog.json');
|
||||
module.exports = {
|
||||
name: 'changelog',
|
||||
description: ['check the bots changelog'],
|
||||
trustLevel: 0,
|
||||
aliases: ['clv', 'changes'],
|
||||
usage:[""],
|
||||
execute (context) {
|
||||
const query = context.arguments.join(' ').toLowerCase()
|
||||
const bot = context.bot
|
||||
if (query.length === 0) {
|
||||
const list = []
|
||||
|
||||
for (const info of bots) {
|
||||
if (list.length !== 0) list.push({ text: ', ', color: 'gray' })
|
||||
list.push(info.name)
|
||||
}
|
||||
const category = {
|
||||
translate: ' (%s%s%s%s%s%s%s%s%s) ',
|
||||
bold: false,
|
||||
color: 'gray',
|
||||
with: [
|
||||
{ color: 'aqua', text: 'Alpha Release' },
|
||||
{ color: 'gray', text: ' | ' },
|
||||
{ color: 'blue', text: 'Beta Release' },
|
||||
{ color: 'gray', text: ' | ' },
|
||||
{ color: 'green', text: 'Minor release' },
|
||||
{ color: 'gray', text: ' | ' },
|
||||
{ color: 'gold', text: 'Revision Release' },
|
||||
{ color: 'gray', text: ' | ' },
|
||||
{ color: 'dark_red', text: 'Major Release' }
|
||||
]
|
||||
}
|
||||
bot.tellraw("@a", [{ text: 'Changelogs (', color: 'gray' }, { text: JSON.stringify(bots.length), color: 'gold' }, { text: ')', color: 'gray' }, category, ' - ', ...list])
|
||||
return
|
||||
}
|
||||
|
||||
for (const info of bots) {
|
||||
const plainName = String(context.bot.getMessageAsPrismarine(info.name)).toLowerCase()
|
||||
if (plainName.includes(query)) this.sendBotInfo(info, context.bot)
|
||||
}
|
||||
},
|
||||
|
||||
sendBotInfo (info, bot) {
|
||||
const component = ['']
|
||||
component.push('', info.name)
|
||||
if (info.exclaimer) component.push('\n', ' ', info.exclaimer)
|
||||
if (info.authors && info.authors.length !== 0) {
|
||||
component.push('\n', 'Codename ')
|
||||
for (const author of info.authors) {
|
||||
component.push(author, { text: ', ', color: 'gray' })
|
||||
}
|
||||
component.pop()
|
||||
}
|
||||
if (info.foundation) component.push('\n', 'Date: ', info.foundation)
|
||||
if (info.prefixes && info.prefixes.length !== 0) {
|
||||
component.push('\n', '')
|
||||
for (const prefix of info.prefixes) {
|
||||
component.push(prefix, { text: ' ', color: 'gray' })
|
||||
}
|
||||
component.pop()
|
||||
}
|
||||
bot.tellraw('@a', [component])
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
+14
-12
@@ -1,16 +1,17 @@
|
||||
const mc = require('minecraft-protocol')
|
||||
const { EventEmitter } = require('events')
|
||||
require("events").EventEmitter.defaultMaxListeners = Infinity;
|
||||
//require("events").EventEmitter.defaultMaxListeners = Infinity;
|
||||
EventEmitter.defaultMaxListeners = Infinity
|
||||
const util = require('util');
|
||||
function createBot(options = {}, config) {
|
||||
const bot = new EventEmitter()
|
||||
const bot = new EventEmitter();
|
||||
bot.options = {
|
||||
// Set some default values in options
|
||||
host: options.host ??= 'localhost',
|
||||
username: options.username ??= 'Player',
|
||||
hideErrors: options.hideErrors ??= true, // HACK: Hide errors by default as a lazy fix to console being spammed with them
|
||||
};
|
||||
bot.options = options
|
||||
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 => {
|
||||
@@ -24,10 +25,11 @@ function createBot(options = {}, config) {
|
||||
bot.username = client.username
|
||||
})
|
||||
client.on('disconnect', (data) => {
|
||||
bot.emit("disconnect", JSON.stringify(data.reason))
|
||||
bot?.discord?.channel?.send(util.inspect(data.reason))
|
||||
bot.emit("disconnect", data)
|
||||
// bot.console.info(JSON.stringify(data))
|
||||
// bot?.discord?.channel?.send(util.inspect(data.reason))
|
||||
if (config.console.filelogger) {
|
||||
bot?.console?.filelogging(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ` + '[Client Reconnect] ' + util.inspect(data.reason))
|
||||
// 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('end', reason => {
|
||||
@@ -35,10 +37,10 @@ function createBot(options = {}, config) {
|
||||
})
|
||||
|
||||
client.on('error', error => {
|
||||
bot.console.logs(ChatMessage.fromNotch('§8[§bClient Reconnect§8]§r ')?.toAnsi() + util.inspect(error.toString()))
|
||||
bot?.discord?.channel?.send(error.toString())
|
||||
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?.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()))
|
||||
}
|
||||
})
|
||||
|
||||
@@ -48,10 +50,10 @@ function createBot(options = {}, config) {
|
||||
|
||||
client.on('kick_disconnect', (data) => {
|
||||
bot.emit("kick_disconnect", data.reason)
|
||||
bot.console.logs(ChatMessage.fromNotch('§8[§bClient Reconnect§8]§r ')?.toAnsi() + util.inspect(data.reason))
|
||||
bot.console?.warn(ChatMessage.fromNotch(`§8[§bClient Reconnect§8]§r `)?.toAnsi() + util.inspect(data.reason))
|
||||
bot?.discord?.channel?.send(util.inspect(data.reason))
|
||||
if (config.console.filelogger) {
|
||||
bot?.console?.filelogging(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ` + '[Client Reconnect] ' + util.inspect(data.reason))
|
||||
// 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))
|
||||
}
|
||||
})
|
||||
|
||||
@@ -60,7 +62,7 @@ function createBot(options = {}, config) {
|
||||
});
|
||||
})
|
||||
|
||||
const client = options.client ?? mc.createClient(options)
|
||||
const client = options.client ?? new mc.createClient(options)
|
||||
bot._client = client
|
||||
bot.emit('init_client', client)
|
||||
bot.bots = options.bots ?? [bot]
|
||||
|
||||
@@ -5,7 +5,7 @@ module.exports = {
|
||||
description: ["shows a list of known bots"],
|
||||
aliases: ["knownbots"],
|
||||
trustLevel: 0,
|
||||
usage:[""],
|
||||
usages:[""],
|
||||
async execute(context) {
|
||||
const query = context.arguments.join(" ").toLowerCase();
|
||||
const bot = context.bot;
|
||||
@@ -19,7 +19,7 @@ module.exports = {
|
||||
|
||||
}
|
||||
bot.tellraw("@a",
|
||||
["Known bots (", JSON.stringify(bots.length), ") - ", ...list],
|
||||
["Known bots (", { text: JSON.stringify(bots.length), color: 'gold' }, { text: ") - ", color: 'gray' }, ...list],
|
||||
false,
|
||||
);
|
||||
return;
|
||||
|
||||
+36
-8
@@ -4,6 +4,7 @@ module.exports = {
|
||||
aliases: [
|
||||
|
||||
],
|
||||
usages: [],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
@@ -15,17 +16,17 @@ module.exports = {
|
||||
const servers = bot.bots.map(eachBot => eachBot.options.serverName);
|
||||
for (const eachBot of bot.bots) {
|
||||
if (args.slice(1).join(' ').toLowerCase() === 'all') {
|
||||
eachBot.console.consoleServer = 'all'
|
||||
bot.console.logs("Set the console server to all");
|
||||
eachBot.console.server = 'all'
|
||||
bot.console.info("Set the console server to all");
|
||||
continue
|
||||
}
|
||||
const server = servers.find(server => server.toLowerCase().includes(args[1]))
|
||||
if (!server) {
|
||||
bot.console.logs("Invalid server");
|
||||
bot.console.info("Invalid server");
|
||||
return
|
||||
}
|
||||
bot.console.logs(`Set the console server to ` + server);
|
||||
eachBot.console.consoleServer = server;
|
||||
bot.console.info(`Set the console server to ` + server);
|
||||
eachBot.console.server = server;
|
||||
}
|
||||
break
|
||||
case 'customchat':
|
||||
@@ -52,7 +53,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 +60,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":
|
||||
@@ -67,7 +68,7 @@ module.exports = {
|
||||
if (bot.console.customChat.enabled) {
|
||||
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
|
||||
} else if (!bot.console.customChat.enabled) {
|
||||
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
|
||||
// bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
|
||||
}
|
||||
break
|
||||
case "trusted":
|
||||
@@ -75,13 +76,40 @@ module.exports = {
|
||||
if (bot.console.customChat.enabled) {
|
||||
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`);
|
||||
} else if (!bot.console.customChat.enabled) {
|
||||
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`)
|
||||
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`);
|
||||
}
|
||||
break
|
||||
default:
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
|
||||
}
|
||||
break
|
||||
case 'logging':
|
||||
case 'togglelogging':
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case 'on':
|
||||
case 'enable':
|
||||
case 'enabled':
|
||||
case 'true':
|
||||
if (bot.options.logging === true) {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is already enabled!`);
|
||||
} else {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is now enabled`);
|
||||
bot.options.logging = true;
|
||||
}
|
||||
break
|
||||
case 'off':
|
||||
case 'disable':
|
||||
case 'disabled':
|
||||
case 'false':
|
||||
if (bot.options.logging === false) {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is already disabled!`);
|
||||
} else {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is now disabled`);
|
||||
bot.options.logging = false;
|
||||
}
|
||||
break
|
||||
}
|
||||
break
|
||||
default:
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = {
|
||||
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;
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
const CommandError = require('../util/command_error');
|
||||
module.exports = {
|
||||
name: 'filter',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
],
|
||||
description: '',
|
||||
usages: [
|
||||
"list",
|
||||
"--regex(-r) --ignorecase(-i) add <player>",
|
||||
"--ignorecase(-i) add <player>",
|
||||
"add <player>",
|
||||
"clear",
|
||||
"remove(rm) <index>"
|
||||
],
|
||||
execute (context) {
|
||||
/*
|
||||
note:
|
||||
bot.filter.add(ignoreCase(true/false), regexed(true/false), name(args))
|
||||
*/
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
let component = [];
|
||||
if (bot.options.isCreayun || bot.options.isSavage) throw new CommandError('this command is meant for kaboom.pw and its clones')
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4]) return
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case 'list':
|
||||
// bot.tellraw(`@a`, JSON.stringify(bot.filter.list().length));
|
||||
if (bot.filter.list().length === 0) {
|
||||
component.push({
|
||||
translate: '%s: (%s)',
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
{ text: 'Players', color: 'dark_blue' },
|
||||
{ text: JSON.stringify(bot.filter.list().length), color: 'gold' },
|
||||
]
|
||||
})
|
||||
} else {
|
||||
let i = 0;
|
||||
let listComponent = []
|
||||
for (const players of bot.filter.list()) {
|
||||
listComponent.push({
|
||||
translate: '%s \u203a %s',
|
||||
color: 'dark_blue',
|
||||
with: [
|
||||
{ text: `${i}`, color: 'gold' },
|
||||
{ text: players.name, color: 'blue' },
|
||||
]
|
||||
})
|
||||
listComponent.push('\n')
|
||||
i++
|
||||
}
|
||||
|
||||
listComponent.pop()
|
||||
|
||||
component.push({
|
||||
translate: '%s: (%s)',
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
{ text: 'Players', color: 'dark_blue' },
|
||||
{ text: `${bot.filter.list().length}`, color: 'gold' }
|
||||
]
|
||||
})
|
||||
component.push('\n')
|
||||
component.push(listComponent)
|
||||
// bot.tellraw("@a", component)
|
||||
}
|
||||
bot.tellraw("@a", component)
|
||||
break;
|
||||
case "--regex":
|
||||
case "-r":
|
||||
switch (args[2]?.toLowerCase()) {
|
||||
case "--ignorecase":
|
||||
case "-i":
|
||||
switch (args[3]?.toLowerCase()) {
|
||||
case "add":
|
||||
case "a":
|
||||
bot.filter.add(true, true, args[4])
|
||||
bot.chat.message(`Added ${args[4]} to the filter`)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "add":
|
||||
bot.filter.add(false, true, args[3]);
|
||||
bot.chat.message(`Added ${args[3]} to the filter`);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "--ignorecase":
|
||||
case "-i":
|
||||
bot.filter.add(true, false, args.slice(2).join(' '))
|
||||
break;
|
||||
case "add":
|
||||
case "a":
|
||||
bot.filter.add(false, false, args.slice(2).join(' '));
|
||||
bot.chat.message(`Added ${args.slice(2).join(' ')} to the filter`);
|
||||
break;
|
||||
case "clear":
|
||||
case "c":
|
||||
bot.filter.clear();
|
||||
bot.chat.message('Cleared filter');
|
||||
break
|
||||
case "remove":
|
||||
case "rm": // rm linux command reference
|
||||
if (isNaN(args.slice(2))) throw new CommandError('argument must be a integer!');
|
||||
bot.filter.remove(args.slice(2));
|
||||
bot.chat.message(`Removed ${args.slice(2)} from the filter`);
|
||||
break
|
||||
default:
|
||||
throw new CommandError('invalid argument')
|
||||
}
|
||||
},
|
||||
}
|
||||
+289
-184
@@ -45,183 +45,251 @@ module.exports = {
|
||||
let admin = [];
|
||||
let owner = [];
|
||||
for (const command of bot.commandManager.commandlist) {
|
||||
if (args[0] === command.name) {
|
||||
//for (const usageArray of command.usages) {
|
||||
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: "Usages \u203a\n",
|
||||
color: "gray"
|
||||
},
|
||||
]);
|
||||
// }
|
||||
for (const usageArray of command.usages) {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, `${config.prefixes[0]}${command.name} ${usageArray}`)
|
||||
let usagesComponent = [];
|
||||
let commandComponent = [];
|
||||
for (const usages of command.usages) {
|
||||
if (command?.trustLevel === 1) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.name} <trusted/admin/owner hashes>`, color: "blue" },
|
||||
{ text: `${command.usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.trustLevel === 2) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.name} <admin/owner hashes>`, color: "blue" },
|
||||
{ text: `${command.usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.trustLevel === 3) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.name} <owner hash>`, color: "blue" },
|
||||
{ text: `${command.usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.name}`, color: "blue" },
|
||||
{ text: `${command.usages.toString().replaceAll(',','')}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
}
|
||||
usagesComponent.push('\n');
|
||||
}
|
||||
usagesComponent.pop();
|
||||
commandComponent.push({
|
||||
translate: "%s %s %s\n%s %s %s\n%s %s %s\n%s %s %s\n%s %s",
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: "Command Name", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.name}`, color: "blue" },
|
||||
{ text: "Aliases", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.aliases.toString().replaceAll(',',' ')}`, color: "blue" },
|
||||
{ text: "Description", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.description}`, color: "blue" },
|
||||
{ text: "Trust Level", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.trustLevel}`, color: "gold" },
|
||||
{ text: "Usages", color: "dark_blue" },
|
||||
{ text: "\u203a" }
|
||||
]
|
||||
})
|
||||
commandComponent.push("\n");
|
||||
commandComponent.push(usagesComponent);
|
||||
for (const aliases of command.aliases) {
|
||||
if (args[0]?.toLowerCase() === command.name) {
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`);
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, commandComponent)
|
||||
}
|
||||
return;
|
||||
} if (args[0]?.toLowerCase() === aliases) {
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`)
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, commandComponent)
|
||||
}
|
||||
return
|
||||
}
|
||||
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: 'red'
|
||||
},
|
||||
{
|
||||
text: `${command.description}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.aliases}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'gray',
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
{
|
||||
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: 'red'
|
||||
},
|
||||
{
|
||||
text: `${command.description}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.aliases}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'gray',
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
{
|
||||
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: 'red'
|
||||
},
|
||||
{
|
||||
text: `${command.description}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.aliases}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'gray',
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
{
|
||||
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: 'red'
|
||||
},
|
||||
{
|
||||
text: `${command.description}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.aliases}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'gray',
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
{
|
||||
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}`
|
||||
}
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -244,16 +312,44 @@ module.exports = {
|
||||
])?.toMotd().replaceAll('§','&'))
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(public)?.toMotd().replaceAll("§","&"))
|
||||
}, 200)
|
||||
}, 300)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
|
||||
}, 200)
|
||||
}, 300)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
|
||||
}, 200)
|
||||
}, 300)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
|
||||
}, 200)
|
||||
}, 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' },
|
||||
@@ -263,7 +359,6 @@ module.exports = {
|
||||
'\n',
|
||||
public,
|
||||
trusted,
|
||||
// admin,
|
||||
owner
|
||||
])
|
||||
} else {
|
||||
@@ -284,19 +379,22 @@ module.exports = {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const category = {
|
||||
translate: '(%s%s%s%s%s) \u203a ',
|
||||
translate: '(%s%s%s%s%s%s%s) \u203a ',
|
||||
bold: false,
|
||||
color: 'gray',
|
||||
with: [
|
||||
{ color: "blue", text: 'Public'},
|
||||
{ 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) {
|
||||
@@ -311,25 +409,31 @@ module.exports = {
|
||||
}
|
||||
if (command?.trustLevel === 0) {
|
||||
public.push([
|
||||
{
|
||||
text: command.name + ' ',
|
||||
color: "blue",
|
||||
}
|
||||
{
|
||||
text: command.name + ' ',
|
||||
color: "aqua",
|
||||
}
|
||||
])
|
||||
} else if (command?.trustLevel === 1) {
|
||||
trusted.push([
|
||||
{
|
||||
text: command.name + ' ',
|
||||
color: "dark_aqua"
|
||||
}
|
||||
|
||||
{
|
||||
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",
|
||||
}
|
||||
{
|
||||
text: command.name + ' ',
|
||||
color: "dark_blue",
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -341,5 +445,6 @@ module.exports = {
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix1}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
bot?.discord?.message.react('♋')
|
||||
}
|
||||
}
|
||||
|
||||
+69
-10
@@ -40,7 +40,18 @@ module.exports = {
|
||||
const source = context.source;
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case 'version':
|
||||
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" })}`);
|
||||
if (botInfo.bot.buildstring.codename === '') {
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(`&9Friday &9Night &9Funkin &3Boyfriend &1Bot&8&r-${botInfo.bot.buildstring.version}-#${botInfo.bot.buildstring.build}`)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(`11/22/22 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`)
|
||||
}, 300)
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, `§9Friday §9Night §9Funkin §3Boyfriend §1Bot§8§r-${botInfo.bot.buildstring.version}-#${botInfo.bot.buildstring.build}\n11/22/22 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`);
|
||||
}
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, `§9Friday §9Night §9Funkin §3Boyfriend §1Bot§8§r-${botInfo.bot.buildstring.version}-#${botInfo.bot.buildstring.build}-${botInfo.bot.buildstring.codename}\n11/22/22 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`);
|
||||
}
|
||||
break
|
||||
case 'config':
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
@@ -49,9 +60,13 @@ module.exports = {
|
||||
color: 'gray',
|
||||
},
|
||||
{
|
||||
text: `Ip \u203a ${bot.options.host}:${bot.options.port}\n`,
|
||||
text: `Ip \u203a ${bot.options.host}:`,
|
||||
color: "gray"
|
||||
},
|
||||
{
|
||||
text: `${bot.options.port}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `Version \u203a ${bot.options.version}\n`,
|
||||
color: "gray",
|
||||
@@ -69,17 +84,25 @@ module.exports = {
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: `Server count \u203a ${bot.bots.length}\n`,
|
||||
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: ${config.prefixes.length}\n`,
|
||||
text: `Prefix Length: `,
|
||||
color: "gray"
|
||||
},
|
||||
{
|
||||
text: `${config.prefixes.length}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `isKaboom \u203a ${bot.options.isKaboom}\n`,
|
||||
color: "gray",
|
||||
@@ -151,9 +174,13 @@ module.exports = {
|
||||
color: "gray"
|
||||
},
|
||||
{
|
||||
text: `Cores \u203a ${os.cpus().length}\n`,
|
||||
text: `Core Count \u203a `,
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: `${os.cpus().length}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `CPU \u203a ${os.cpus()[0].model}\n`,
|
||||
color: "gray"
|
||||
@@ -201,7 +228,6 @@ module.exports = {
|
||||
text: `Device uptime \u203a ${format(os.uptime())}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
// {text:`${format(process.uptime())}`,color:'gray'}
|
||||
{
|
||||
text: `Bot uptime \u203a ${format(process.uptime())}\n`,
|
||||
color: "gray"
|
||||
@@ -244,7 +270,7 @@ module.exports = {
|
||||
color: "light_purple"
|
||||
},
|
||||
{
|
||||
text: "aaa - FBot, SnifferBot, Xbot\n",
|
||||
text: "aaa - FBot, SnifferBot, Xbot, Hydra\n",
|
||||
color: "gold",
|
||||
},
|
||||
{
|
||||
@@ -260,7 +286,7 @@ module.exports = {
|
||||
case "about":
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
{
|
||||
text: `FNFBoyfriendBot is a open source kaboom bot created by Parker2991\nThe source can be found here ${botInfo.bot.source}`,
|
||||
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: {
|
||||
@@ -303,7 +329,19 @@ module.exports = {
|
||||
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();
|
||||
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}`)
|
||||
@@ -312,7 +350,28 @@ module.exports = {
|
||||
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: 'gray' }, { text: `MiB / ${Math.floor(os.totalmem() / 1048576)} MiB\n`, color: 'gray' }, { text: `Device uptime \u203a ${format(os.uptime())}\n`, color: 'gray' }, { text: `Node version \u203a ${process.version}`, color: 'gray' } ])?.toString();
|
||||
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}`)
|
||||
|
||||
+11
-3
@@ -13,11 +13,14 @@ module.exports = {
|
||||
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.kicks.item(`${args.slice(2).join(' ')}`)
|
||||
break
|
||||
default:
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
|
||||
@@ -29,8 +32,13 @@ 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.kicks.item(`${args.slice(1).join(' ')}`)
|
||||
break
|
||||
default:
|
||||
throw new CommandError('Invalid argument');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-11
@@ -9,19 +9,12 @@ module.exports = {
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
async execute (context) {
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
// ik theres a better way to do but shut the fuck up about it
|
||||
await bot.chat.message("killing process");
|
||||
await bot.console.info("killing process");
|
||||
await bot.discord.channel?.send("killing process");
|
||||
await process.kill(0);
|
||||
process.exit(69);
|
||||
},
|
||||
async discordExecute (context) {
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
await bot.chat.message("killing process");
|
||||
await bot.console.info("killing process");
|
||||
await bot.discord.channel?.send("killing process");
|
||||
await process.exit(0);
|
||||
process.exit(69);
|
||||
}
|
||||
}
|
||||
|
||||
+39
-23
@@ -6,7 +6,7 @@ module.exports = {
|
||||
description:['check the player list'],
|
||||
trustLevel: 0,
|
||||
aliases:['playerlist', 'plist', 'pl'],
|
||||
usage:[""],
|
||||
usages:[""],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
@@ -15,34 +15,57 @@ module.exports = {
|
||||
const component = []
|
||||
for (const player of players) {
|
||||
component.push({
|
||||
translate: `%s \u203a %s [%s %s %s %s %s]`,
|
||||
translate: `%s \u203a %s [%s: %s %s %s: %s]`,
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
player.displayName ?? player.profile.name,
|
||||
player.uuid,
|
||||
{ text: `Ping:`, color: 'dark_green' },
|
||||
{
|
||||
text: `${player.uuid}`,
|
||||
color: 'dark_blue',
|
||||
clickEvent: {
|
||||
action: 'copy_to_clipboard',
|
||||
value: `${player.uuid}`
|
||||
},
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
contents: [{
|
||||
text: 'click here to copy the player\'s uuid',
|
||||
color: 'aqua'
|
||||
}]
|
||||
}
|
||||
},
|
||||
{ text: `Ping`, color: 'dark_blue' },
|
||||
{ text: `${player.latency}`, color: 'gold' },
|
||||
{ text: '/', color: '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]`,
|
||||
@@ -60,18 +83,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 Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
} // `\`\`\`ansi\n${discordQueue.join('\n').substring(0, 1984)}\n\`\`\``
|
||||
}
|
||||
}
|
||||
|
||||
+49
-18
@@ -18,18 +18,63 @@ module.exports = {
|
||||
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',
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
contents: [{
|
||||
text: 'click here for the servers ip',
|
||||
color: 'gray'
|
||||
}]
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'copy_to_clipboard',
|
||||
value: `${host}:${Number(port ?? 25565)}`
|
||||
}
|
||||
},
|
||||
{
|
||||
text: `Players \u203a `,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Players \u203a ${server.players.online}/${server.players.max}\n`,
|
||||
text: `${server.players.online}`,
|
||||
color: "gold"
|
||||
},
|
||||
{
|
||||
text: ' / ',
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `${server.players.max}\n`,
|
||||
color: "gold"
|
||||
},
|
||||
{
|
||||
text: `Version \u203a ${server.version.name}\n`,
|
||||
color: 'gray',
|
||||
@@ -39,23 +84,9 @@ module.exports = {
|
||||
color: 'gray',
|
||||
},
|
||||
server.description,
|
||||
])
|
||||
])*/
|
||||
} catch (e) {
|
||||
bot.tellraw("@a", e.toString())
|
||||
bot.chat.message(`${e.toString()}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
try {
|
||||
const server = await request(`https://eu.mc-api.net/v3/server/ping/${interaction.options.getString('ip')}`);
|
||||
json = await server.body.json()
|
||||
console.log((json))
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.commands.embed}`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
setDescription(
|
||||
`IP \u203a ${interaction.options.getString('ip')}\nPlayer Count \u203a ${json.players.online}/${json.players.max}\nOnline \u203a ${json.online}\n
|
||||
Version \u203a ${json.version.name}\nMotd \u203a ${JSON.stringify(json.description)}`)
|
||||
.setThumbnail(`${json.favicon}`)
|
||||
|
||||
*/
|
||||
|
||||
@@ -14,7 +14,6 @@ module.exports = {
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
//throw new CommandError('ohio')
|
||||
if (config.patches.netmsg) {
|
||||
component = [
|
||||
{ text: '[', color: "dark_gray" },
|
||||
@@ -35,12 +34,8 @@ module.exports = {
|
||||
]
|
||||
}
|
||||
}
|
||||
// bot.bots.filter((eachBot) => { if (eachBot.options.useChat) eachBot.chat.message('sussy');
|
||||
// else if (!eachBot.options.useChat) eachBot.chat.message('baka!')})
|
||||
// for (const eachBot of bot.bots) eachBot.tellraw("@a", component)
|
||||
// for (const eachBot of bot.bots) {
|
||||
bot.bots.filter((eachBot) => {
|
||||
if (eachBot.options.serverName === "Savage Friends" && eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom) {
|
||||
if (eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom || eachBot.options.isCreayun && !eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom) {
|
||||
eachBot.chat.message(`[${bot.options.serverName}] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} \u203a ${args.join(' ')}`)
|
||||
} else if (!eachBot.options.serverName !== "Savage Friends" && !eachBot.options.isSavage && !eachBot.options.useChat && eachBot.options.isKaboom) {
|
||||
eachBot.tellraw("@a", component);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module.exports = {
|
||||
name: 'reload',
|
||||
trustLevel: 0,
|
||||
trustLevel: 3,
|
||||
aliases: [
|
||||
],
|
||||
description: 'reloads commands',
|
||||
|
||||
+44
-8
@@ -5,16 +5,52 @@ module.exports = {
|
||||
description:['teleport to a random place'],
|
||||
trustLevel: 1,
|
||||
aliases:['rtp', 'teleportrandom', 'randomteleport'],
|
||||
usage:[""],
|
||||
usages:[""],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const sender = context.source.player
|
||||
// const sender = context.source.player
|
||||
const args = context.arguments;
|
||||
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}`)
|
||||
// if (!source.player) return
|
||||
if (bot.options.isKaboom) {
|
||||
x = between(-30_000_000, 30_000_000)
|
||||
y = 100
|
||||
z = between(-30_000_000, 30_000_000)
|
||||
} else if (bot.options.isSavage) {
|
||||
x = between(-4096, 4096);
|
||||
y = 100
|
||||
z = between(-4096, 4096);
|
||||
}
|
||||
// bot.tellraw("@a", `Randomly Teleported: ${sender.profile.name} to x:${x} y:${y} z:${z} `)
|
||||
// bot.core.run(`minecraft:tp ${sender.profile.name} ${x} ${y} ${z}`)
|
||||
if (args.slice(1).join(' ')) {
|
||||
bot.tellraw("@a", [
|
||||
{ text: 'Randomly Teleported: ', color: 'gray' },
|
||||
{ text: args.slice(1).join(' '), color: 'blue' },
|
||||
{ text: ' to ', color: 'gray' },
|
||||
{ text: `${x} `, color: 'gold' },
|
||||
{ text: `${y} `, color: 'gold' },
|
||||
{ text: `${z}`, color: 'gold' }
|
||||
])
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.command(`minecraft:tp ${args.slice(1).join(' ')} ${x} ${y} ${z}`)
|
||||
} else if (bot.options.isKaboom) {
|
||||
bot.core.run(`minecraft:tp ${args.slice(1).join(' ')} ${x} ${y} ${z}`);
|
||||
}
|
||||
} else {
|
||||
bot.tellraw("@a", [
|
||||
{ text: 'Randomly Teleported: ', color: 'gray' },
|
||||
{ text: source.player.profile.name, color: 'blue' },
|
||||
{ text: ' to ', color: 'gray' },
|
||||
{ text: `${x} `, color: 'gold' },
|
||||
{ text: `${y} `, color: 'gold' },
|
||||
{ text: `${z}`, color: 'gold' }
|
||||
])
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.command(`minecraft:tp ${source.player.profile.name} ${x} ${y} ${z}`)
|
||||
} else if (bot.options.isKaboom) {
|
||||
bot.core.run(`minecraft:tp ${source.player.profile.name} ${x} ${y} ${z}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,14 +19,25 @@ module.exports = {
|
||||
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.console.log(bot.getMessageAsPrismarine({ text: util.inspect(eval(args.join(' ')), { stylize })})?.toAnsi())
|
||||
} else if (bot.options.useChat || bot.options.isSavage) {
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })?.toMotd().replaceAll('§','&'))
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source.player.profile.name}"]`, [
|
||||
{
|
||||
text: util.inspect(eval(script), { stylize }).substring(0, 32700)
|
||||
}
|
||||
{
|
||||
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) {
|
||||
|
||||
@@ -6,9 +6,6 @@ module.exports = {
|
||||
description:['urban dictionary'],
|
||||
aliases:['urbandictionary'],
|
||||
trustLevel: 0,
|
||||
usage:[
|
||||
"<definition>",
|
||||
],
|
||||
usages: [
|
||||
"<definition>",
|
||||
],
|
||||
|
||||
@@ -13,20 +13,6 @@ module.exports = {
|
||||
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 +28,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}]`)
|
||||
|
||||
+65
-7
@@ -1,9 +1,11 @@
|
||||
const http = require('http');
|
||||
const https = require('https');
|
||||
const util = require('util');
|
||||
const fixansi = require('../util/ansi');
|
||||
const CommandError = require('../util/command_error')
|
||||
module.exports = {
|
||||
name: 'website',
|
||||
trustLevel: 0,
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
],
|
||||
description: 'look up website data',
|
||||
@@ -13,8 +15,8 @@ module.exports = {
|
||||
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');
|
||||
@@ -22,7 +24,7 @@ module.exports = {
|
||||
res.on('data', (chunk) => { rawData += chunk; });
|
||||
res.on('end', () => {
|
||||
try {
|
||||
bot.tellraw("@a", { text: util.inspect(rawData), color: "dark_green" })
|
||||
bot.tellraw("@a", { text: util.inspect(rawData.toString().substring(0, 32750)), color: "dark_green" })
|
||||
} catch (e) {
|
||||
bot.tellraw("@a", e.toString());
|
||||
}
|
||||
@@ -30,10 +32,10 @@ module.exports = {
|
||||
}).on('error', (e) => {
|
||||
bot.chat.message(`&4${e.toString()}`);
|
||||
});
|
||||
} else if (args.join(' ').toLowerCase().startsWith('https://')) {
|
||||
https.get(args.join(' '), (res) => {
|
||||
} else {
|
||||
https.get(args.slice(1).join(' '), (res) => {
|
||||
res.on('data', (d) => {
|
||||
bot.tellraw("@a", { text: util.inspect(d.toString()), color: "dark_green", })
|
||||
bot.tellraw("@a", { text: util.inspect(d.toString().substring(0, 32750)), color: "dark_green", })
|
||||
// console.log(Object.keys(d.toString().length));
|
||||
});
|
||||
}).on('error', (e) => {
|
||||
@@ -44,5 +46,61 @@ module.exports = {
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
let Embed;
|
||||
let fix;
|
||||
let ansi;
|
||||
//bot.discord.message.reply('e');
|
||||
if (args.join(' ').toLowerCase().startsWith("http://")) {
|
||||
http.get(args.join(' '), (res) => {
|
||||
const { statusCode } = res;
|
||||
const contentType = res.headers['content-type'];
|
||||
res.setEncoding('utf8');
|
||||
let rawData = '';
|
||||
res.on('data', (chunk) => { rawData += chunk; });
|
||||
res.on('end', () => {
|
||||
// try {
|
||||
// bot.tellraw("@a", { text: util.inspect(rawData), color: "dark_green" })
|
||||
ansi = bot.getMessageAsPrismarine({ text: util.inspect(rawData.toString()), color: 'dark_green'})?.toAnsi()
|
||||
fix = fixansi(ansi.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
// } catch (e) {
|
||||
// bot.tellraw("@a", e.toString());
|
||||
//throw new CommandError(e.toString())
|
||||
// }
|
||||
});
|
||||
}).on('error', (e) => {
|
||||
//bot.chat.message(`&4${e.toString()}`);
|
||||
});
|
||||
} else {
|
||||
https.get(args.join(' '), (res) => {
|
||||
res.on('data', (d) => {
|
||||
// bot.tellraw("@a", { text: util.inspect(d.toString()), color: "dark_green", })
|
||||
// console.log(Object.keys(d.toString().length));
|
||||
ansi = bot.getMessageAsPrismarine({ text: util.inspect(d.toString()), color: 'dark_green'})?.toAnsi()
|
||||
fix = fixansi(ansi.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
// bot.discord.message.reply('e');
|
||||
});
|
||||
}).on('error', (e) => {
|
||||
//bot.chat.message(`&4${e.toString()}`);
|
||||
//throw new CommandError(e.toString())
|
||||
});
|
||||
/*
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix1}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ module.exports = {
|
||||
description:['wikipedia'],
|
||||
trustLevel: 0,
|
||||
aliases:['wikipedia'],
|
||||
usage:["<definition>"],
|
||||
usages:["<definition>"],
|
||||
async execute (context) {
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
|
||||
@@ -30,6 +30,25 @@
|
||||
"+"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "Hydra",
|
||||
"color": "dark_red"
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
"popbob/aaa"
|
||||
],
|
||||
"exclaimer": "",
|
||||
"foundation": "nodejs/node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"+",
|
||||
"$",
|
||||
"h:",
|
||||
"hydra:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# FNFBoyfriendBot v6.0.0-alpha config
|
||||
|
||||
prefixes:
|
||||
- "!"
|
||||
- "fnfbfbot!"
|
||||
@@ -25,6 +23,8 @@ core:
|
||||
y: 0
|
||||
z: 15
|
||||
|
||||
commandSetMessage: true
|
||||
|
||||
keys:
|
||||
trusted: "trusted key here"
|
||||
admin: "admin key here"
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"bot": {
|
||||
"buildstring": {
|
||||
"version": "v6.0.0-beta",
|
||||
"build":"800",
|
||||
"codename":"§#fe019aGraffiti §7Groovin"
|
||||
"version": "v6.0.5",
|
||||
"build":"1050",
|
||||
"codename":""
|
||||
},
|
||||
"source": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot/"
|
||||
}
|
||||
|
||||
+2
-2
@@ -27,9 +27,9 @@ const rl = readline.createInterface({
|
||||
if (config.discord.enabled) discordClient.login(config.discord.token);
|
||||
const bots = [];
|
||||
for (const options of config.bots) {
|
||||
const bot = createBot(options, config);
|
||||
const bot = new createBot(options, config);
|
||||
bots.push(bot);
|
||||
bot.bots = bots;
|
||||
loadModules(bot, options, config, discordClient);
|
||||
bot.console.useReadlineInterface(rl);
|
||||
bot.console.readlineInterface(rl);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const readline = require('readline');
|
||||
function boot (bot, options, discordClient, config) {
|
||||
bot.on("packet.login", (data) => {
|
||||
if (bot.options.isCreayun) return
|
||||
if (new Date().getDay() === 5) {
|
||||
bot.chat.message('Gettin\' freaky on a friday night!');
|
||||
} else {
|
||||
|
||||
+36
-20
@@ -4,7 +4,7 @@ const ChipmunkModChatParser = require('../util/ChatParsers/ChipmunkMod');
|
||||
const CreayunChatParser = require('../util/ChatParsers/Creayun');
|
||||
const sayConsoleChatParser = require('../util/ChatParsers/sayConsole');
|
||||
const VanillaChatParser = require("../util/ChatParsers/VanillaChat");
|
||||
const nbt = require('prismarine-nbt');
|
||||
const yfdCustomChatParser = require('../util/ChatParsers/yfdCustomChat');
|
||||
function tryParse (json) {
|
||||
try {
|
||||
return JSON.parse(json)
|
||||
@@ -18,43 +18,55 @@ function chat (bot, options, config) {
|
||||
bot.on('registry_ready', registry => {
|
||||
ChatMessage = loadPrismarineChat(registry)
|
||||
})
|
||||
if (options.isSavage) {
|
||||
if (options.isSavage || options.isCreayun) {
|
||||
bot.chatParsers = [CreayunChatParser, sayConsoleChatParser]
|
||||
} else {
|
||||
bot.chatParsers = [KaboomChatParser, ChipmunkModChatParser, VanillaChatParser, sayConsoleChatParser]
|
||||
bot.chatParsers = [KaboomChatParser, ChipmunkModChatParser, VanillaChatParser, sayConsoleChatParser, yfdCustomChatParser]
|
||||
}
|
||||
bot.on('packet.profileless_chat', packet => {
|
||||
const message = tryParse(packet.message)
|
||||
const sender = tryParse(packet.name)
|
||||
// bot.tellraw("@a", `Packet type ${packet.type}`)
|
||||
bot.emit('profileless_chat', {
|
||||
message,
|
||||
type: packet.type,
|
||||
sender
|
||||
})
|
||||
const translateMessage = bot.getMessageAsPrismarine(message)?.toMotd()
|
||||
const translateUsername = bot.getMessageAsPrismarine(sender)?.toMotd()
|
||||
if (packet.type === 1) bot.emit('message', bot.getMessageAsPrismarine({translate:"chat.type.emote", with:[`${translateUsername}`,`${translateMessage}`]})?.toMotd())
|
||||
if (packet.type === 2) bot.emit('message', bot.getMessageAsPrismarine({"translate":"commands.message.display.incoming","with":[`${translateUsername}`,`${translateMessage}`],"color":"gray","italic":true})?.toMotd())
|
||||
if (packet.type === 3) bot.emit('message', bot.getMessageAsPrismarine({"translate":"commands.message.display.outgoing","with":[`${translateUsername}`,`${translateMessage}`],"color":"gray","italic":true})?.toMotd())
|
||||
if (packet.type === 4) bot.emit('message', message);
|
||||
if (packet.type === 5) bot.emit('message', bot.getMessageAsPrismarine({translate:"chat.type.announcement",color:'white', with:[`${translateUsername}`,`${translateMessage}`]})?.toMotd())
|
||||
/* switch (packet.type) {
|
||||
case "4":
|
||||
bot.emit('message', message)
|
||||
// console.log('packet type 4');
|
||||
switch (packet.type) {
|
||||
case 1:
|
||||
bot.emit('message', { translate: "chat.type.emote", with: [ sender, message ]})
|
||||
break
|
||||
}*/
|
||||
case 2:
|
||||
bot.emit('message', { translate: "commands.message.display.incoming", with: [ sender, message], color: "gray", italic: true })
|
||||
break
|
||||
case 3:
|
||||
bot.emit('message', [{ translate: "commands.message.display.outgoing", with: [ sender, message ], color: "gray", italic: true }])
|
||||
break
|
||||
case 4:
|
||||
bot.emit('message', [message]);
|
||||
break
|
||||
case 5:
|
||||
bot.emit('message', [{ translate: 'chat.type.announcement', with: [ sender, message ]}])
|
||||
break
|
||||
}
|
||||
tryParsingMessage(message, { senderName: sender, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
|
||||
})
|
||||
|
||||
bot.on('packet.player_chat', (packet, data) => {
|
||||
const unsigned = tryParse(packet.unsignedChatContent)
|
||||
// const unsigned = JSON.parse(loadPrismarineChat.processNbtMessage(nbt.comp(nbt.string(packet.unsignedChatContent))))
|
||||
// const unsigned = loadPrismarineChat.processNbtMessage(tryParse(packet.unsignedChatContent))
|
||||
bot.emit('player_chat', { plain: packet.plainMessage, unsigned, senderUuid: packet.senderUuid })
|
||||
if (packet.type === 5) bot.emit('message', bot.getMessageAsPrismarine({ translate: "chat.type.announcement", with: [`${bot.players.find(player => player.uuid === packet.senderUuid).profile.name}`, `${packet.plainMessage}`]})?.toMotd())
|
||||
if (packet.type !== 5) bot.emit("message", unsigned)
|
||||
switch (packet.type) {
|
||||
case 5:
|
||||
bot.emit('message', { translate: "chat.type.announcement", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
|
||||
break
|
||||
case 3:
|
||||
bot.emit('message', { translate: "commands.message.display.outgoing", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
|
||||
break
|
||||
case 2:
|
||||
bot.emit('message', { translate: "commands.message.display.incoming", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
|
||||
break
|
||||
default:
|
||||
bot.emit('message', unsigned)
|
||||
}
|
||||
tryParsingMessage(unsigned, { senderUuid: packet.senderUuid, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
|
||||
})
|
||||
|
||||
@@ -63,6 +75,7 @@ function chat (bot, options, config) {
|
||||
if (config.commandSetMessage) {
|
||||
if (message.translate === 'advMode.setCommand.success') return // Ignores command set message
|
||||
}
|
||||
if (message.translate === 'multiplayer.message_not_delivered') return
|
||||
bot.emit('system_chat', { message, actionbar: packet.isActionBar })
|
||||
|
||||
if (packet.isActionBar) {
|
||||
@@ -122,5 +135,8 @@ function chat (bot, options, config) {
|
||||
})
|
||||
}
|
||||
}
|
||||
bot.tellraw = (selector, message) => {
|
||||
bot.core.run(`minecraft:tellraw ${selector} ` + JSON.stringify(message))
|
||||
}
|
||||
}
|
||||
module.exports = chat;
|
||||
|
||||
@@ -11,9 +11,16 @@ function core (bot, options, config) {
|
||||
const { start, end } = bot.core.area
|
||||
|
||||
if (!pos) return
|
||||
if (bot.options.useChat ?? bot.options.isCreayun ?? bot.options.isSavage) return
|
||||
// if (isNaN(pos.x + start.x)) bot.chat.command('world 3');
|
||||
// console.log(isNaN(pos.x + start.x))
|
||||
if (bot.options.useChat || bot.options.isCreayun || bot.options.isSavage) return
|
||||
if (isNaN(pos.x + start.x)) {
|
||||
bot.chat.command('spawn');
|
||||
return
|
||||
}
|
||||
/*^^^
|
||||
for checking is the core pos is null and if so
|
||||
it will not refill core until the pos is not NaN
|
||||
instead of tping to a set cords cuz fuck you im not doing that
|
||||
*/
|
||||
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)}'}`)
|
||||
},
|
||||
|
||||
@@ -60,7 +67,7 @@ function core (bot, options, config) {
|
||||
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()
|
||||
@@ -68,7 +75,7 @@ function core (bot, options, config) {
|
||||
}
|
||||
}
|
||||
// if (bot.options.useChat ?? bot.options.isCreayun ?? bot.options.isSavage) return
|
||||
if (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)
|
||||
|
||||
@@ -2,27 +2,29 @@ function command_loop (bot, options, config) {
|
||||
bot.cloop = {
|
||||
list: [],
|
||||
add (command, interval) {
|
||||
setTimeout(() => {
|
||||
this.list.push({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
|
||||
}, 10)
|
||||
let timer;
|
||||
timer = ({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
|
||||
this.list.push(timer)
|
||||
|
||||
bot.on('end', () => {
|
||||
this.clear()
|
||||
})
|
||||
|
||||
bot.on('packet.login', () => {
|
||||
timer = ({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
|
||||
this.list.push(timer);
|
||||
})
|
||||
},
|
||||
|
||||
remove (index) {
|
||||
clearInterval(this.list[index].timer)
|
||||
bot.cloop.list.splice(index, 1)
|
||||
},
|
||||
|
||||
clear () {
|
||||
for (const cloop of this.list) clearInterval(cloop.timer)
|
||||
this.list = []
|
||||
}
|
||||
}
|
||||
/* bot.on('end', () => {
|
||||
// clearInterval(this.list);
|
||||
for (const cloop of this.list) console.log(cloop)
|
||||
console.log('e')
|
||||
})*/
|
||||
}
|
||||
module.exports = command_loop;
|
||||
|
||||
@@ -20,24 +20,23 @@ function command_manager (bot, options, config, discordClient) {
|
||||
}
|
||||
} else if (!source?.sources?.discord && !source?.sources?.console) {
|
||||
if (!command || !command.execute)
|
||||
throw new CommandError(
|
||||
bot.getMessageAsPrismarine([
|
||||
{
|
||||
translate: `command.unknown.command`
|
||||
},
|
||||
{
|
||||
text: '\n'
|
||||
},
|
||||
{
|
||||
text: `${commandName} `
|
||||
},
|
||||
{
|
||||
translate: "command.context.here"
|
||||
}])?.toMotd(bot.registry.language)
|
||||
)
|
||||
throw new CommandError([
|
||||
{
|
||||
translate: `command.unknown.command`
|
||||
},
|
||||
{
|
||||
text: '\n'
|
||||
},
|
||||
{
|
||||
text: `${commandName} `
|
||||
},
|
||||
{
|
||||
translate: "command.context.here"
|
||||
}
|
||||
])
|
||||
} else if (source?.sources?.console && !source?.sources?.discord) {
|
||||
if (!command || !command.execute)
|
||||
bot.console.warn(bot.getMessageAsPrismarine([
|
||||
bot.console.warn([
|
||||
{
|
||||
translate: 'command.unknown.command',
|
||||
color: "dark_red"
|
||||
@@ -53,21 +52,20 @@ function command_manager (bot, options, config, discordClient) {
|
||||
translate: "command.context.here",
|
||||
color: "dark_red"
|
||||
}
|
||||
])?.toAnsi())
|
||||
])
|
||||
}
|
||||
if (command?.trustLevel > 0) {
|
||||
const event = bot?.discord?.message;
|
||||
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" })
|
||||
// const hash = args[0]
|
||||
if (args.length === 0 && bot.validation.trusted && bot.validation.admin && bot.validation.owner && !source?.sources?.console) throw new CommandError({ text: "Please provide an trusted or an admin or an owner hash" })
|
||||
if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.admin && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted or admin or owner hash', color: 'dark_red' })
|
||||
} else if (command?.trustLevel === 1 && source?.sources.discord) {
|
||||
const hasRole = roles?.some(role => role.name === `${config.discord.roles.trusted}` || role.name === `${config.discord.roles.owner}`)
|
||||
if (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!' })
|
||||
}
|
||||
if (command?.trustLevel === 2 && !source.sources.console) {
|
||||
// bot.chat.message('trust level 2 does nothing currently'); placeholder code
|
||||
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' })
|
||||
}
|
||||
@@ -80,18 +78,18 @@ function command_manager (bot, options, config, discordClient) {
|
||||
} else if (command?.trustLevel === 4 && !source.sources.console) {
|
||||
throw new CommandError('This command can only be ran via console');
|
||||
}
|
||||
} if (!command?.discordExecute && command && source.sources.discord) {
|
||||
}
|
||||
if (!command?.discordExecute && command && source?.sources?.discord) {
|
||||
throw new CommandError(`${command.name} command is not supported in discord!`)
|
||||
} else if (command?.discordExecute && command && source.sources.discord) {
|
||||
} else if (command?.discordExecute && command && source?.sources?.discord) {
|
||||
return command.discordExecute({ bot, source, arguments: args, config, discordClient })
|
||||
} else if (!command?.execute && command && !source.sources.discord) {
|
||||
} 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) {
|
||||
} else if (command?.execute && command && !source?.sources?.discord) {
|
||||
return command?.execute({ bot, source, arguments: args, config, discordClient})
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
bot?.console?.filelogging(error.stack);
|
||||
console.error(error.stack)
|
||||
if (source?.sources?.discord && !source?.sources?.console) {
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.error}`)
|
||||
@@ -103,9 +101,21 @@ 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 {
|
||||
bot.tellraw("@a", { text: error.message, color: "dark_red" })
|
||||
}
|
||||
} 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}` } }])
|
||||
}
|
||||
}
|
||||
// else bot.tellraw("@a", [{ translate: 'command.failed', color: "dark_red", hoverEvent: { action: 'show_text', contents: `${error.stack}` } }])
|
||||
//}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -120,6 +130,7 @@ function command_manager (bot, options, config, discordClient) {
|
||||
return this.discordExecute(source, commandName, args)
|
||||
}
|
||||
},
|
||||
|
||||
register (command) {
|
||||
this.commands[command.name] = command
|
||||
if (command.aliases) {
|
||||
@@ -127,7 +138,6 @@ function command_manager (bot, options, config, discordClient) {
|
||||
}
|
||||
},
|
||||
unregister (command) {
|
||||
// commands = {};
|
||||
this.commands = {};
|
||||
},
|
||||
getCommand (name) {
|
||||
@@ -136,6 +146,21 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,33 +190,11 @@ function command_manager (bot, options, config, discordClient) {
|
||||
}, 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)
|
||||
}
|
||||
})
|
||||
})
|
||||
bot.commandManager.reload = function () {
|
||||
//commandlist = [];
|
||||
// bot.commandManager.unregister();
|
||||
// bot.commandManager.commandlist = [];
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, "../commands"))) {
|
||||
try {
|
||||
// bot.commandManager.unregister();
|
||||
delete require.cache[require.resolve(path.join(__dirname, "../commands/", filename))]
|
||||
const command = require(path.join(__dirname, "../commands/", filename));
|
||||
// bot.commandManager.unregister();
|
||||
// delete require.cache[require.resolve(path.join(__dirname, "../commands", filename))]
|
||||
// bot.commandManager.register(command);
|
||||
// bot.commandManager.commandlist.push(command);
|
||||
bot.commandManager.register(command);
|
||||
bot.commandManager.commandlist.pop(command)
|
||||
bot.commandManager.commandlist.push(command)
|
||||
} catch (error) {
|
||||
// bot.console.error(["Failed to load File ", filename, ":", error.stack])
|
||||
bot.tellraw("@a", { text: `Failed to reload file ${filename}\n${error.stack}`, color: "red" })
|
||||
bot?.console?.filelogger(error.stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = command_manager;
|
||||
|
||||
+71
-71
@@ -1,82 +1,82 @@
|
||||
const CommandSource = require('../util/command_source');
|
||||
function CommandConsole (bot, options, config) {
|
||||
const ChatMessage = require('prismarine-chat')(options.version);
|
||||
const prismarineChat = require('prismarine-chat')('1.20.2');
|
||||
function Console (bot, options, config) {
|
||||
let rateLimit = 0;
|
||||
bot.console = {
|
||||
readline: null,
|
||||
consoleServer: 'all',
|
||||
useReadlineInterface (rl) {
|
||||
server: 'all',
|
||||
readlineInterface (rl) {
|
||||
this.readline = rl
|
||||
rl.on('line', line => {
|
||||
if (bot.options.serverName !== this.consoleServer && this.consoleServer !== 'all') return
|
||||
if (line.startsWith(config.console.prefix)) {
|
||||
return bot.commandManager.executeString(bot.console.source, line.substring(config.console.prefix.length))
|
||||
} if (line.startsWith("")) {
|
||||
return bot.commandManager.executeString(bot.console.source, `console say ${line.substring(0)}`)
|
||||
rl.on('line', (args) => {
|
||||
if (bot.options.serverName !== this.server && this.server !== 'all') return
|
||||
if (args.startsWith(config.console.prefix)) {
|
||||
return bot.commandManager.executeString(bot.console.source, args.substring(config.console.prefix.length))
|
||||
} else if (args.startsWith("")) {
|
||||
return bot.commandManager.executeString(bot.console.source, `console say ${args.substring(0)}`);
|
||||
}
|
||||
rl.on('close', () => {
|
||||
this.readline = null;
|
||||
})
|
||||
})
|
||||
|
||||
rl.on('close', () => {
|
||||
this.readline = null
|
||||
})
|
||||
log = function (...args) {
|
||||
rl.output.write("\x1b[2K\r");
|
||||
console.log(args.toString());
|
||||
rl._refreshLine();
|
||||
},
|
||||
source: new CommandSource(bot.options.username, { console: true, discord: false }),
|
||||
refreshLine (...args) {
|
||||
this.readline.output.write("\x1b[2K\r");
|
||||
console.log.apply(console, arguments);
|
||||
this.readline._refreshLine();
|
||||
},
|
||||
log (message) {
|
||||
this.refreshLine(bot.getMessageAsPrismarine(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO" })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })} §6logs§8] §8[${options.serverName}§8] `)?.toAnsi() + message)
|
||||
},
|
||||
warn (error) {
|
||||
this.refreshLine(prismarineChat.fromNotch(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §ewarn§8] §8[${options.serverName}§8] `)?.toAnsi() + error)
|
||||
},
|
||||
error (error) {
|
||||
this.refreshLine(bot.getMessageAsPrismarine(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §4error§8] §8[${options.serverName}§8] `)?.toAnsi() + error)
|
||||
},
|
||||
info (message) {
|
||||
this.refreshLine(prismarineChat.fromNotch(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §2info§8] §8[${options.serverName}§8] `)?.toAnsi() + message)
|
||||
},
|
||||
customChat: {
|
||||
enabled: false,
|
||||
chat (message) {
|
||||
const prefix = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
color:'dark_gray',
|
||||
with: [
|
||||
{
|
||||
text: 'FNFBoyfriendBot Console',
|
||||
color:'#00FFFF'
|
||||
},
|
||||
{
|
||||
selector: `${bot.username}`, color:'#00FFFF',
|
||||
clickEvent: { action: 'suggest_command', value: `${config.prefixes[0]}help` }
|
||||
},
|
||||
{
|
||||
text: '',
|
||||
extra: [`${message}`],
|
||||
color:'white'
|
||||
},
|
||||
],
|
||||
hoverEvent: { action:"show_text", value: 'FNF Sky is a fangirl but a simp for boyfriend confirmed??'},
|
||||
clickEvent: 'https://doin-your.mom' ?
|
||||
{ action: 'open_url', value: 'https://doin-your.mom' } : undefined,
|
||||
}
|
||||
bot.tellraw('@a', prefix)
|
||||
}
|
||||
}
|
||||
}
|
||||
bot.console.logs = function (message) {
|
||||
log(ChatMessage.fromNotch(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §6logs§8] §8[${options.serverName}§8] `)?.toAnsi() + message)
|
||||
}
|
||||
bot.console.info = function (message) {
|
||||
log(ChatMessage.fromNotch(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §2info§8] §8[${options.serverName}§8] `)?.toAnsi() + message)
|
||||
}
|
||||
bot.console.warn = function (message) {
|
||||
console.log(ChatMessage.fromNotch(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §ewarn§8] §8[${options.serverName}§8] `)?.toAnsi() + message)
|
||||
}
|
||||
bot.console.source = new CommandSource(bot.options.username, { console: true, discord: false });
|
||||
bot.console.source.sendFeedback = message => {
|
||||
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(bot.registry.language).replaceAll('BlackStone Mafia On Top!', "Fuck off you god damn cunt")
|
||||
if (!options.logging) return
|
||||
bot.console.logs(ChatMessage.fromNotch('§8[§6Command§8] ')?.toAnsi() + ansi);
|
||||
}
|
||||
bot.console.error = function (message) {
|
||||
console.log(ChatMessage.fromNotch(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §4error§8] §8[${options.serverName}§8] `)?.toAnsi() + message)
|
||||
}
|
||||
bot.console.customChat = {
|
||||
enabled: false,
|
||||
chat (message) {
|
||||
const prefix = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
color:'dark_gray',
|
||||
with: [
|
||||
{
|
||||
text: 'FNFBoyfriendBot Console',
|
||||
color:'#00FFFF'
|
||||
},
|
||||
{
|
||||
selector: `${bot.username}`, color:'#00FFFF',
|
||||
clickEvent: { action: 'suggest_command', value: '~help' }
|
||||
},
|
||||
{
|
||||
text: '',
|
||||
extra: [`${message}`],
|
||||
color:'white'
|
||||
},
|
||||
],
|
||||
hoverEvent: { action:"show_text", value: 'FNF Sky is a fangirl but a simp for boyfriend confirmed??'},
|
||||
clickEvent: 'https://doin-your.mom' ?
|
||||
{ action: 'open_url', value: 'https://doin-your.mom' } : undefined,
|
||||
}
|
||||
bot.tellraw('@a', prefix)
|
||||
}
|
||||
}
|
||||
bot.on('message', message => {
|
||||
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(bot.registry.language).replaceAll('BlackStone Mafia On Top!', "Fuck off you god damn cunt")
|
||||
const string = bot.getMessageAsPrismarine(message)?.toString(bot.registry.language).replaceAll('BlackStone Mafia On Top!', "Fuck off you god damn cunt")
|
||||
if (!options.logging) return
|
||||
bot.console.logs(`${ansi}`)
|
||||
bot.console.filelogging(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${string}`)
|
||||
bot.on('message', (message) => {
|
||||
rateLimit++
|
||||
setTimeout(() => {
|
||||
rateLimit--
|
||||
}, 1000)
|
||||
if (!options.logging) return;
|
||||
/* if (rateLimit > 100) {
|
||||
return
|
||||
}*/
|
||||
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
||||
})
|
||||
}
|
||||
module.exports = CommandConsole;
|
||||
module.exports = Console;
|
||||
|
||||
@@ -20,13 +20,13 @@ function discord(bot, options, config, discordClient) {
|
||||
invite: config.discord.invite || undefined,
|
||||
prefix: config.discord.prefix,
|
||||
// presence: bot.discord.presence,
|
||||
token: config.discord.token,
|
||||
// token: config.discord.token,
|
||||
}
|
||||
discordClient.once('ready', (context) => {
|
||||
bot.discord.channel = discordClient.channels.cache.get(options.channelId)
|
||||
discordClient.user.setPresence({
|
||||
activities: [{
|
||||
name: `amogus ඞ`,
|
||||
name: `your mother`,
|
||||
type: 0
|
||||
}],
|
||||
status: `dnd`
|
||||
@@ -149,9 +149,5 @@ function discord(bot, options, config, discordClient) {
|
||||
}
|
||||
discordClient.on('messageCreate', messageCreate)
|
||||
|
||||
process.on("uncaughtException", (e) => {
|
||||
// sendDiscordMessage("uncaught " + e.stack);
|
||||
});
|
||||
|
||||
}
|
||||
module.exports = discord;
|
||||
|
||||
@@ -3,7 +3,7 @@ const path = require("path");
|
||||
const { createGzip } = require("zlib");
|
||||
const readline = require('readline');
|
||||
const { Console } = require("console");
|
||||
function consolefilelogger(bot, options, message) {
|
||||
function fileLogger(bot, options, message) {
|
||||
const currentDate = new Date();
|
||||
const timestamp = `${currentDate.getFullYear()}-${(currentDate.getMonth() + 1)
|
||||
.toString()
|
||||
@@ -53,8 +53,8 @@ function consolefilelogger(bot, options, message) {
|
||||
}
|
||||
compressFile(logFilePath, newFileName);
|
||||
}
|
||||
bot.console.filelogging = function logging (message) {
|
||||
bot.console.fileLogger = function logging (message) {
|
||||
logStream.write(message + "\n");
|
||||
};
|
||||
}
|
||||
module.exports = consolefilelogger;
|
||||
module.exports = fileLogger;
|
||||
@@ -0,0 +1,127 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
function filter (bot, options, config, discordClient) {
|
||||
if (options.isSavage || options.isCreayun) return;
|
||||
// filter v5 (not to be confused with the bot version)
|
||||
bot.filter = {
|
||||
list () {
|
||||
try {
|
||||
return JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
|
||||
} catch (e) {
|
||||
console.log(e.stack)
|
||||
}
|
||||
},
|
||||
|
||||
add (ignoreCase, regexed, player) {
|
||||
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
|
||||
var arrayadd = { ignoreCase: ignoreCase, regexed: regexed, name: player }
|
||||
data.push(arrayadd);
|
||||
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data))
|
||||
this.doAll();
|
||||
},
|
||||
|
||||
remove (index) {
|
||||
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
|
||||
data.splice(index, 1);
|
||||
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data));
|
||||
},
|
||||
|
||||
clear () {
|
||||
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
|
||||
data = [];
|
||||
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data))
|
||||
},
|
||||
|
||||
doAll () {
|
||||
for (const filteredPlayers of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
|
||||
if (filteredPlayers.ignoreCase) {
|
||||
check = bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase())
|
||||
} else if (filteredPlayers.regexed) {
|
||||
let regex = new RegExp(filteredPlayers.name);
|
||||
check = bot.players.find((players) => regex.test(players.profile.name))
|
||||
} else if (filteredPlayers.ignoreCase && filteredPlayers.regexed) {
|
||||
let regex = new RegExp(filteredPlayers.name.toLowerCase());
|
||||
check = bot.players.find((players) => regex.test(players.profile.name.toLowerCase()))
|
||||
} else {
|
||||
check = bot.players.find((players) => players.profile.name === filteredPlayers.name)
|
||||
}
|
||||
}
|
||||
if (!check) return;
|
||||
bot.core.run(`execute run gamemode adventure @a[name="${check?.profile?.name}"]`)
|
||||
bot.core.run(`execute run deop @a[name="${check?.profile?.name}"]`);
|
||||
bot.core.run(`essentials:mute ${check?.uuid} 10y`);
|
||||
}
|
||||
}
|
||||
bot.on('message', (message) => {
|
||||
try {
|
||||
const stringMessage = bot.getMessageAsPrismarine(message)?.toString()
|
||||
for (const filteredPlayers of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
|
||||
if (filteredPlayers.ignoreCase) {
|
||||
if (!bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase())) return;
|
||||
else if (bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase()).gamemode !== 2) {
|
||||
bot.core.run(`execute run gamemode adventure @a[name="${bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase()).profile.name}"]`);
|
||||
} else if (stringMessage.includes('op')) {
|
||||
setTimeout(() => {
|
||||
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase()).profile.name}"]`)
|
||||
}, 10);
|
||||
}
|
||||
} else if (filteredPlayers.regexed) {
|
||||
let regex = new RegExp(filteredPlayers.name);
|
||||
if (!bot.players.find((players) => regex.test(players.profile.name))) return;
|
||||
else if (bot.players.find((players) => regex.test(players.profile.name)).gamemode !== 2) {
|
||||
bot.core.run(`execute run gamemode adventure @a[name="${bot.players.find((players) => regex.test(players.profile.name)).profile.name}"]`);
|
||||
} else if (stringMessage.includes('op')) {
|
||||
setTimeout(() => {
|
||||
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => regex.test(players.profile.name)).profile.name}"]`);
|
||||
}, 10)
|
||||
}
|
||||
} else if (filteredPlayers.ignoreCase && filteredPlayers.regexed) {
|
||||
let regex = new RegExp(filteredPlayers.name.toLowerCase());
|
||||
if (!bot.players.find((players) => regex.test(players.profile.name.toLowerCase()))) return;
|
||||
else if (bot.players.find((players) => regex.test(players.profile.name.toLowerCase())).gamemode !== 2) {
|
||||
bot.core.run(`execute run gamemode adventure @a[name="${bot.players.find((players) => regex.test(players.profile.name.toLowerCase())).profile.name}"]`);
|
||||
} else if (stringMessage.includes('op')) {
|
||||
setTimeout(() => {
|
||||
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => regex.test(players.profile.name.toLowerCase())).profile.name}"]`);
|
||||
}, 10)
|
||||
}
|
||||
} else {
|
||||
if (!bot.players.find((players) => players.profile.name === filteredPlayers.name)) return;
|
||||
else if (bot.players.find((players) => players.profile.name === filteredPlayers.name).gamemode !== 2) {
|
||||
bot.core.run(`execute run gamemode adventure @a[name="${bot.players.find((players) => players.profile.name === filteredPlayers.name).profile.name}"]`);
|
||||
} else if (stringMessage.includes('op')) {
|
||||
setTimeout(() => {
|
||||
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => players.profile.name === filteredPlayers.name).profile.name}"]`);
|
||||
}, 10)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
bot.console.warn(e.stack);
|
||||
}
|
||||
})
|
||||
|
||||
bot.on('parsed_message', (message) => {
|
||||
const stringMessage = bot.getMessageAsPrismarine(message)?.toString();
|
||||
for (const filteredPlayers of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
|
||||
if (filteredPlayers.ignoreCase) {
|
||||
check = bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase())
|
||||
} else if (filteredPlayers.regexed) {
|
||||
let regex = new RegExp(filteredPlayers.name);
|
||||
check = bot.players.find((players) => regex.test(players.profile.name))
|
||||
} else if (filteredPlayers.ignoreCase && filteredPlayers.regexed) {
|
||||
let regex = new RegExp(filteredPlayers.name.toLowerCase());
|
||||
check = bot.players.find((players) => regex.test(players.profile.name.toLowerCase()))
|
||||
} else {
|
||||
check = bot.players.find((players) => players.profile.name === filteredPlayers.name)
|
||||
}
|
||||
}
|
||||
if (bot.filter.list().length === 0) return;
|
||||
if (!check) return;
|
||||
if (!bot.players) return;
|
||||
if (message.sender.profile.name === check?.profile?.name) {
|
||||
bot.core.run(`essentials:mute ${check?.uuid} 10y`);
|
||||
}
|
||||
})
|
||||
}
|
||||
module.exports = filter;
|
||||
@@ -18,11 +18,20 @@ function player_list (bot, options, config) {
|
||||
}
|
||||
})
|
||||
|
||||
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) {
|
||||
@@ -35,7 +44,8 @@ function player_list (bot, options, config) {
|
||||
gamemode: undefined,
|
||||
listed: undefined,
|
||||
latency: undefined,
|
||||
displayName: undefined
|
||||
displayName: undefined,
|
||||
vanished: false
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ function reconnect (bot, options, config) {
|
||||
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, bot.options.username = usernameGen(bot))
|
||||
} else {
|
||||
client = options.client ?? mc.createClient(options)
|
||||
}
|
||||
|
||||
+56
-24
@@ -10,31 +10,57 @@ function selfcare (bot, options, config) {
|
||||
let teleportToggle = false;
|
||||
let username = false;
|
||||
let nickname = false;
|
||||
let login = false;
|
||||
let register = false;
|
||||
// You now have the tag: &8[&bPrefix&8: &3~&8]
|
||||
// You no longer have a tag
|
||||
bot.on('message', (message) => {
|
||||
const stringMessage = bot.getMessageAsPrismarine(message)?.toString();
|
||||
if (stringMessage?.startsWith("Successfully enabled CommandSpy")) commandSpy = true;
|
||||
else if (stringMessage?.startsWith("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 === "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
|
||||
@@ -54,16 +80,22 @@ function selfcare (bot, options, config) {
|
||||
gameMode = packet.gameMode;
|
||||
clientLock = packet.gameMode;
|
||||
timer = setInterval(() => {
|
||||
if (bot.options.isSavage && !bot.options.isKaboom) {
|
||||
if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 });
|
||||
if (bot.options.isSavage && !bot.options.isKaboom && !bot.options.isCreayun) {
|
||||
if (login) bot.chat.command('login amogusissus');
|
||||
else if (register) bot.chat.command('register amogusissus amogusissus');
|
||||
// else if (permissionLevel < 2) bot.chat.command(`minecraft:op ${bot.options.username}`);
|
||||
else if (gameMode !== 1) bot.chat.command('minecraft:gamemode creative');
|
||||
else if (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) {
|
||||
if (permissionLevel < 2) bot.chat.command('op @s[type=player]');
|
||||
else if (gameMode !== 1) bot.chat.command('gamemode creative @s[type=player]');
|
||||
else if (gameMode !== 1) bot.chat.command('minecraft:gamemode creative');
|
||||
else if (!commandSpy) bot.chat.command('commandspy on');
|
||||
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.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`);
|
||||
|
||||
@@ -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,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,27 +1,27 @@
|
||||
function ChipmunkMod (message, data, context, bot) {
|
||||
try {
|
||||
if (message === null || typeof message !== 'object') return
|
||||
if (message.with?.length < 3 || (message.translate !== '[%s] %s › %s' && message.translate !== '%s %s › %s')) return
|
||||
if (message === null || typeof message !== 'object') return
|
||||
if (message.with?.length < 3 || (message.translate !== '[%s] %s › %s' && message.translate !== '%s %s › %s')) return
|
||||
|
||||
const senderComponent = message.with[1]
|
||||
const contents = message.with[2]
|
||||
let sender
|
||||
const hoverEvent = senderComponent.hoverEvent
|
||||
if (hoverEvent?.action === 'show_entity') {
|
||||
const id = hoverEvent.contents.id
|
||||
const senderComponent = message.with[1]
|
||||
const contents = message.with[2]
|
||||
let sender
|
||||
const hoverEvent = senderComponent.hoverEvent
|
||||
if (hoverEvent?.action === 'show_entity') {
|
||||
const id = hoverEvent.contents.id
|
||||
|
||||
sender = data.players.find(player => player.uuid === id)
|
||||
} else {
|
||||
const stringUsername = data.getMessageAsPrismarine(senderComponent).toString() // TypeError: data.getMessageAsPrismarine is not a function
|
||||
sender = data.players.find(player => player.uuid === id)
|
||||
} else {
|
||||
const stringUsername = data.getMessageAsPrismarine(senderComponent).toString() // TypeError: data.getMessageAsPrismarine is not a function
|
||||
|
||||
sender = data.players.find(player => player.profile.name === stringUsername)
|
||||
}
|
||||
sender = data.players.find(player => player.profile.name === stringUsername)
|
||||
}
|
||||
|
||||
if (!sender) return null
|
||||
if (!sender) return null;
|
||||
|
||||
return { sender, contents, type: 'minecraft:chat', senderComponent }
|
||||
return { sender, contents, type: 'minecraft:chat', senderComponent }
|
||||
} catch(e) {
|
||||
console.error(e)
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
module.exports = ChipmunkMod
|
||||
|
||||
@@ -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,11 +14,10 @@ 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.log(e.stack)
|
||||
console.error(`${e.toString()}`)
|
||||
}
|
||||
}
|
||||
module.exports = VanillaChat;
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
function yfdCustomChat (message, data, context, bot) {
|
||||
try {
|
||||
if (message === null || typeof message !== 'object') return
|
||||
if (message.with?.length < 3 || (message.translate !== '[%s] %s: %s' && message.translate !== '%s %s › %s')) return
|
||||
|
||||
const senderComponent = message.with[1]
|
||||
const contents = message.with[2]
|
||||
let sender
|
||||
const hoverEvent = senderComponent.hoverEvent
|
||||
if (hoverEvent?.action === 'show_entity') {
|
||||
const id = hoverEvent.contents.id
|
||||
sender = data.players.find(player => player.uuid === id)
|
||||
} else {
|
||||
const stringUsername = data.getMessageAsPrismarine(senderComponent).toString() // TypeError: data.getMessageAsPrismarine is not a function
|
||||
sender = data.players.find(player => player.profile.name === stringUsername)
|
||||
}
|
||||
|
||||
if (!sender) return null
|
||||
|
||||
return { sender, contents, type: 'minecraft:chat', senderComponent }
|
||||
} catch(e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
module.exports = yfdCustomChat
|
||||
@@ -9,6 +9,61 @@ function ansi (message) {
|
||||
"\x1B\[92m": "\x1B\[32m", // Green
|
||||
"\x1B\[0m": "\x1B\[0m\x1B\[37m", // White
|
||||
"\x1B\[97m": "\x1B\[0m\x1B\[37m", // White
|
||||
"\x1B\[30m": "\x1B[30m", // black
|
||||
"\x1B\[35m": "\x1B[35m", // purple
|
||||
'\x1B[3m': "\x1B[23m", // italic
|
||||
'\x1B[4m': "\x1B[24m", // underline
|
||||
'\x1B[9m': "\x1B[29m", // strike through
|
||||
'\x1B[6m': "\x1B[29m" // obfuscated
|
||||
|
||||
/*
|
||||
Black 30 40
|
||||
Red 31 41
|
||||
Green 32 42
|
||||
Yellow 33 43
|
||||
Blue 34 44
|
||||
Magenta 35 45
|
||||
Cyan 36 46
|
||||
White 37 47
|
||||
Default 39 49
|
||||
Reset 0 0
|
||||
ESC[1;34;{...}m Set graphics modes for cell, separated by semicolon (;).
|
||||
ESC[0m reset all modes (styles and colors)
|
||||
ESC[1m ESC[22m set bold mode.
|
||||
ESC[2m ESC[22m set dim/faint mode.
|
||||
ESC[3m ESC[23m set italic mode.
|
||||
ESC[4m ESC[24m set underline mode.
|
||||
ESC[5m ESC[25m set blinking mode
|
||||
ESC[7m ESC[27m set inverse/reverse mode
|
||||
ESC[8m ESC[28m set hidden/invisible mode
|
||||
ESC[9m ESC[29m set strikethrough mode.
|
||||
*/
|
||||
/*
|
||||
const defaultAnsiCodes = {
|
||||
'§0': '\u001b[30m',
|
||||
'§1': '\u001b[34m',
|
||||
'§2': '\u001b[32m',
|
||||
'§3': '\u001b[36m',
|
||||
'§4': '\u001b[31m',
|
||||
'§5': '\u001b[35m',
|
||||
'§6': '\u001b[33m',
|
||||
'§7': '\u001b[37m',
|
||||
'§8': '\u001b[90m',
|
||||
'§9': '\u001b[94m',
|
||||
'§a': '\u001b[92m',
|
||||
'§b': '\u001b[96m',
|
||||
'§c': '\u001b[91m',
|
||||
'§d': '\u001b[95m',
|
||||
'§e': '\u001b[93m',
|
||||
'§f': '\u001b[97m',
|
||||
'§l': '\u001b[1m',
|
||||
'§o': '\u001b[3m',
|
||||
'§n': '\u001b[4m',
|
||||
'§m': '\u001b[9m',
|
||||
'§k': '\u001b[6m',
|
||||
'§r': '\u001b[0m'
|
||||
}
|
||||
*/
|
||||
};
|
||||
let i = message;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
//const readline = require("readline");
|
||||
function loadModules (bot, options, config, discordClient) {
|
||||
bot.loadModule = module => module(bot, options, config, discordClient)
|
||||
|
||||
|
||||
+14
-9
@@ -1,10 +1,15 @@
|
||||
function usernameGen () {
|
||||
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
|
||||
let username = '';
|
||||
for (let i = 0; i < 10; i++ ) {
|
||||
const randomIndex = Math.floor(Math.random() * characters.length);
|
||||
username += characters[randomIndex];
|
||||
}
|
||||
return username;
|
||||
}
|
||||
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);
|
||||
username += characters[randomIndex];
|
||||
}
|
||||
return username;
|
||||
}
|
||||
module.exports = usernameGen;
|
||||
|
||||
Reference in New Issue
Block a user