forked from afspiegeling/NitoriBot
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
899d34188b | ||
|
|
6d849ff07f | ||
|
|
c3f153b1bf | ||
|
|
eca78227ea | ||
|
|
34445d7029 | ||
|
|
e1bd39a5e7 | ||
|
|
f207710fc6 | ||
|
|
36db3269d8 | ||
|
|
79250b3325 | ||
|
|
4ed575eae1 | ||
|
|
6063dcb4a3 | ||
|
|
880ffc6f70 | ||
|
|
afff6aea83 | ||
|
|
2e753c583b |
+4
-4
@@ -1,4 +1,4 @@
|
||||
node_modules
|
||||
config.js
|
||||
.env
|
||||
ChomensJS
|
||||
src/node_modules
|
||||
src/config.js
|
||||
src/.env
|
||||
amog
|
||||
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
|
||||
module.exports = {
|
||||
name: 'botsrun',
|
||||
description:[''],
|
||||
aliases:[],
|
||||
trustLevel: 2,
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
// const client = context.client
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
const message = context.arguments.join(' ')
|
||||
//const source = context.source
|
||||
// if (args.length === 0){
|
||||
//source.sendFeedback({translate:"Too few Arguments!", color:"red"})
|
||||
const amogus = args.slice(1).join(' ');
|
||||
if (!args && !args[0] && !args[1] && !args[2]) return
|
||||
try{
|
||||
switch (args[1]) {
|
||||
case 'source':
|
||||
|
||||
for (const eachBot of bot.bots) {
|
||||
eachBot.commandManager.executeString(source, `${args.slice(2).join(' ')} `)
|
||||
}
|
||||
break
|
||||
case 'consolesource':
|
||||
|
||||
for (const eachBot of bot.bots) {
|
||||
eachBot.commandManager.executeString(bot.console.source, `${args.slice(2).join(' ')} `)
|
||||
}
|
||||
break
|
||||
default:
|
||||
context.source.sendError([ { text: 'Invalid action', color: 'dark_red', bold:false }])
|
||||
source.sendFeedback({text:'Args are source and consolesource', color:'green'})
|
||||
}
|
||||
|
||||
}catch(error){
|
||||
source.sendFeedback(error.stack)
|
||||
}
|
||||
// context.source.sendFeedback({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })
|
||||
|
||||
|
||||
}//
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
const convert = require('color-convert')
|
||||
|
||||
function inject (bot) {
|
||||
bot.bruhifyTextTellraw = ''
|
||||
let startHue = 0
|
||||
const timer = setInterval(() => {
|
||||
if (bot.bruhifyTextTellraw === '') return
|
||||
|
||||
let hue = startHue
|
||||
const displayName = bot.bruhifyTextTellraw
|
||||
const increment = (360 / Math.max(displayName.length, 20))
|
||||
const component = []
|
||||
for (const character of displayName) {
|
||||
const color = convert.hsv.hex(hue, 100, 100)
|
||||
component.push({
|
||||
text: character,
|
||||
color: `#${color}`,
|
||||
|
||||
})
|
||||
|
||||
// hoverEvent: { action:"show_text", value: '§aMan i like frogs - _ChipMC_'},
|
||||
hue = (hue + increment) % 360
|
||||
}
|
||||
bot.core.run(`tellraw @a ${JSON.stringify(component)}`) // instead of doing just "tellraw" do "minecraft:tellraw"
|
||||
|
||||
startHue = (startHue + increment) % 360
|
||||
}, 50)
|
||||
|
||||
bot.on('end', () => {
|
||||
clearInterval(timer)
|
||||
})
|
||||
}
|
||||
module.exports = inject
|
||||
@@ -1,33 +0,0 @@
|
||||
const convert = require('color-convert')
|
||||
|
||||
function inject (bot) {
|
||||
bot.bruhifyTextTitle = ''
|
||||
let startHue = 0
|
||||
const timer = setInterval(() => {
|
||||
if (bot.bruhifyTextTitle === '') return
|
||||
|
||||
let hue = startHue
|
||||
const displayName = bot.bruhifyTextTitle
|
||||
const increment = (360 / Math.max(displayName.length, 20))
|
||||
const component = []
|
||||
for (const character of displayName) {
|
||||
const color = convert.hsv.hex(hue, 100, 100)
|
||||
component.push({
|
||||
text: character,
|
||||
color: `#${color}`,
|
||||
|
||||
})
|
||||
|
||||
// hoverEvent: { action:"show_text", value: '§aMan i like frogs - _ChipMC_'},
|
||||
hue = (hue + increment) % 360
|
||||
}
|
||||
bot.core.run(`title @a title ${JSON.stringify(component)}`) // instead of doing just "tellraw" do "minecraft:tellraw"
|
||||
|
||||
startHue = (startHue + increment) % 360
|
||||
}, 100)
|
||||
|
||||
bot.on('end', () => {
|
||||
clearInterval(timer)
|
||||
})
|
||||
}
|
||||
module.exports = inject
|
||||
@@ -1,74 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
module.exports = {
|
||||
name: 'calculator',
|
||||
description:['calculate maths'],
|
||||
trustLevel: 0,
|
||||
aliases:['calc'],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
const cmd = {//test.js
|
||||
translate: '[%s] ',
|
||||
bold: false,
|
||||
color: 'white',
|
||||
with: [
|
||||
{ color: 'blue', text: 'Calculator Cmd'},
|
||||
]
|
||||
}
|
||||
const operation = args[0]
|
||||
const operator1 = parseFloat(args[1])
|
||||
const operator2 = parseFloat(args[2])
|
||||
|
||||
//
|
||||
switch (operation) {
|
||||
case 'add':
|
||||
context.source.sendFeedback({
|
||||
translate: '[%s] %s is %s',
|
||||
with: [
|
||||
{color: 'blue', text:'Calculator Cmd'},
|
||||
`${operator1} + ${operator2}`,
|
||||
operator1 + operator2
|
||||
]
|
||||
});
|
||||
|
||||
break
|
||||
case 'subtract':
|
||||
context.source.sendFeedback({
|
||||
translate: `[%s] %s is %s`,
|
||||
with: [
|
||||
{ color: 'blue', text: 'Calculator Cmd'},
|
||||
`${operator1} - ${operator2}`,
|
||||
operator1 - operator2
|
||||
]
|
||||
});
|
||||
|
||||
break
|
||||
case 'multiply':
|
||||
context.source.sendFeedback({
|
||||
translate: '[%s] %s is %s',
|
||||
with: [
|
||||
{ color: 'blue', text: 'Calculator Cmd'},
|
||||
`${operator1} x ${operator2}`,
|
||||
operator1 * operator2
|
||||
]
|
||||
});
|
||||
|
||||
break
|
||||
case 'divide':
|
||||
context.source.sendFeedback({
|
||||
translate: '[%s] %s is %s',
|
||||
with: [
|
||||
{ color: 'blue', text: 'Calculator Cmd'},
|
||||
`${operator1} / ${operator2}`,
|
||||
operator1 / operator2
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
break
|
||||
default:
|
||||
context.source.sendError([cmd, { text: 'Invalid action', color: 'dark_red' }])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
const { VM } = require('vm2')
|
||||
const util = require('util')
|
||||
const { stylize } = require('../util/eval_colors')
|
||||
|
||||
const options = {
|
||||
timeout: 1000
|
||||
}
|
||||
let vm = new VM(options)
|
||||
|
||||
module.exports = {
|
||||
name: 'evaljsvm2',
|
||||
trustLevel: 1,
|
||||
description:['old evaljs code'],
|
||||
aliases:['evaljsold', 'evalvm2', 'evalold'],
|
||||
execute (context) {
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
|
||||
const cmd = {
|
||||
translate: '[%s] ',
|
||||
bold: false,
|
||||
color: 'white',
|
||||
with: [
|
||||
{ color: 'dark_green', text: 'EvalJS Cmd'},
|
||||
]
|
||||
}
|
||||
|
||||
// throw new CommandError('temp disabled')
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
switch (args[1]) {
|
||||
case 'run':
|
||||
try {
|
||||
const output = vm.run(args.slice(2).join(' '))
|
||||
if (!bot.options.Core.enabled){
|
||||
bot.chat(ChatMessage.fromNotch([cmd, { text: util.inspect(output, { stylize }) }]).toMotd().replaceAll('§', '&'))
|
||||
}else
|
||||
source.sendFeedback([cmd, { text: util.inspect(output, { stylize }) }])
|
||||
} catch (e) {
|
||||
if(!bot.options.Core.enabled){
|
||||
bot.chat(ChatMessage.fromNotch([cmd, { text: e.toString(), color: 'black' }]).toMotd().replaceAll('§', '&'))
|
||||
}else{
|
||||
source.sendFeedback([cmd, { text: e.toString(), color: 'black' }])
|
||||
}
|
||||
}
|
||||
break
|
||||
case 'reset':
|
||||
vm = new VM(options)
|
||||
if(!bot.options.Core.enabled){
|
||||
bot.chat(ChatMessage.fromNotch([cmd, { text: 'Successfully reset the eval context', color: 'green' }]).toMotd().replaceAll('§', '&'))
|
||||
}else{
|
||||
source.sendFeedback([cmd, { text: 'Successfully reset the eval context', color: 'green' }])
|
||||
}
|
||||
break
|
||||
default:
|
||||
if(!bot.options.Core.enabled){
|
||||
bot.chat(ChatMessage.fromNotch([cmd, { text: 'Invalid option!', color: 'dark_red' }]).toMotd().replaceAll('§', '&'))
|
||||
}else{
|
||||
source.sendFeedback([cmd, { text: 'Invalid option!', color: 'dark_red' }])
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,575 +0,0 @@
|
||||
const CommandError = require("../CommandModules/command_error");
|
||||
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const packageJSON = require("../package.json");
|
||||
|
||||
module.exports = {
|
||||
name: "info",
|
||||
description: [
|
||||
"check the bots info. the usages are version, discord, serverinfo, logininfo, uptime, creators",
|
||||
],
|
||||
aliases: ["information"],
|
||||
trustLevel: 0,
|
||||
async execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
// const client = context.client
|
||||
const cmd = {
|
||||
//test.js
|
||||
translate: "[%s] ",
|
||||
bold: false,
|
||||
color: "white",
|
||||
with: [{ color: "gold", text: "Info Cmd" }],
|
||||
};
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
const buildstring = process.env["buildstring"];
|
||||
const foundationbuildstring = process.env["FoundationBuildString"];
|
||||
const source = context.source;
|
||||
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
switch (args[0]) {
|
||||
case "version":
|
||||
const discordJSVersion = packageJSON.dependencies["discord.js"];
|
||||
const MinecraftProtocolVersion =
|
||||
packageJSON.dependencies["minecraft-protocol"];
|
||||
|
||||
if(!bot.options.Core.enabled){
|
||||
bot.chat(ChatMessage.fromNotch(`${process.env["buildstring"]}`).toMotd().replaceAll('§', '&'))
|
||||
await sleep(1000)
|
||||
|
||||
bot.chat(`${process.env["FoundationBuildString"]}`)
|
||||
await sleep(1000)
|
||||
bot.chat('Bot Release: 11/22/2022')
|
||||
await sleep(1000)
|
||||
bot.chat(`BotEngine: Node-Minecraft-Protocol @${MinecraftProtocolVersion}`)
|
||||
await sleep(1000)
|
||||
bot.chat(`Discord.js ${discordJSVersion}`)
|
||||
await sleep(1000)
|
||||
bot.chat(`Node JS Version ${process.version}`)
|
||||
}else{
|
||||
context.source.sendFeedback({
|
||||
color: "gray",
|
||||
text: `${process.env["buildstring"]}`,
|
||||
});
|
||||
|
||||
context.source.sendFeedback({
|
||||
color: "gray",
|
||||
text: `${process.env["FoundationBuildString"]}`,
|
||||
});
|
||||
|
||||
const date = new Date().toLocaleDateString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
|
||||
context.source.sendFeedback({
|
||||
text: `Bot Release: 11/22/2022 `,
|
||||
color: "gray",
|
||||
});
|
||||
|
||||
context.source.sendFeedback({
|
||||
text: `BotEngine:Node-Minecraft-Protocol @${MinecraftProtocolVersion}`,
|
||||
color: "gray",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "Node-Minecraft-protocol",
|
||||
color: "gray",
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `https://github.com/PrismarineJS/node-minecraft-protocol`,
|
||||
},
|
||||
});
|
||||
|
||||
context.source.sendFeedback({
|
||||
text: `Discord.js @${discordJSVersion}`,
|
||||
color: "gray",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "Discord.js",
|
||||
color: "gray",
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `https://github.com/discordjs/discord.js`,
|
||||
},
|
||||
});
|
||||
context.source.sendFeedback({
|
||||
color: "gray",
|
||||
text: `Node js Version @${process.version}`,
|
||||
});
|
||||
}
|
||||
// context.source.sendFeedback({color: 'gray', text:`npm Version:@${npmVersion}`})
|
||||
|
||||
break;
|
||||
case "thankyou":
|
||||
var prefix =
|
||||
"&8&l&m[&4&mParker2991&8]&8&m[&b&mBOYFRIEND&8]&8&m[&b&mCONSOLE&8]&r ";
|
||||
bot.core.run(
|
||||
"bcraw " +
|
||||
prefix +
|
||||
"Thank you for all that helped and contributed with the bot, it has been one hell of a ride with the bot hasnt it? From November 22, 2022 to now, 0.1 beta to 4.0 alpha, Mineflayer to Node-Minecraft-Protocol. I have enjoyed all the new people i have met throughout the development of the bot back to the days when the bot used mineflayer for most of its lifespan to the present as it now uses node-minecraft-protocol. Its about time for me to tell how development went in the bot well here it is, back in 0.1 beta of the bot it was skidded off of menbot 1.0 reason why? Well because LoginTimedout gave me the bot when ayunboom was still a thing and he helped throughout that time period bot and when 1.0 beta came around he he just stopped helping me on it why? because he had servers to run so yeah but anyway back then i didnt know what skidded like i do now so i thought i could get away with but i was wrong 💀. Early names considered for the bot were &6&lParkerBot &4&lDEMONBot &b&lWoomyBot &b&lBoyfriendBot,&r i kept the name &b&lBoyfriendBot&r throughout most of the early development but i got sick and tired of being harassed about the name being told it was gay but people really didnt know what it meant did they? It was referenced to Boyfriend from Friday Night Funkin’ so right around 1.0 released i renamed it to &b&lFNFBoyfriend&4&lBot &rand around 2.0 changed it to &5&lFNF&b&lBoyfriend&4&lBot &rand luckily avoided the harassment when i changed it i love coding and i want to learn how to code more thank you all!",
|
||||
);
|
||||
break;
|
||||
case "discord":
|
||||
if(!bot.options.Core.enabled){
|
||||
bot.chat(`${bot.options.discord.invite}`)
|
||||
}else {
|
||||
source.sendFeedback({
|
||||
text: bot.options.discord.invite,
|
||||
color: "gray",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "click here to join!",
|
||||
color: "gray",
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `${bot.options.discord.invite}`,
|
||||
},
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "serverinfo":
|
||||
const os = require("os");
|
||||
if(!bot.options.Core.enabled){
|
||||
bot.chat(`Hostname: ${os.hostname()}`)
|
||||
await sleep(1000)
|
||||
bot.chat(`Working Directory: ${path.join(__dirname, "..")}`)
|
||||
await sleep(1000)
|
||||
bot.chat(`OS architecture: ${os.arch()}`)
|
||||
await sleep(1000)
|
||||
bot.chat(`OS platform: ${os.platform()}`)
|
||||
await sleep(1000)
|
||||
bot.chat(`OS name ${os.version()}`)
|
||||
await sleep(1000)
|
||||
bot.chat(`Kernal Version: ${os.release()}`)
|
||||
await sleep(1000)
|
||||
bot.chat(`CPU cores ${os.cpus().length}`)
|
||||
await sleep(1000)
|
||||
bot.chat(`CPU Model: ${os.cpus()[0].model}`)
|
||||
await sleep(1000)
|
||||
bot.chat(`Server Free memory ${Math.floor(
|
||||
os.freemem() / 1048576)} MiB / ${Math.floor(os.totalmem() / 1048576)} MiB`)
|
||||
}else {
|
||||
|
||||
|
||||
context.source.sendFeedback({
|
||||
color: "gray",
|
||||
text: `Hostname: ${os.hostname()}`,
|
||||
});
|
||||
context.source.sendFeedback({
|
||||
color: "gray",
|
||||
text: `Working Directory: ${path.join(__dirname, "..")}`,
|
||||
});
|
||||
context.source.sendFeedback({
|
||||
color: "gray",
|
||||
text: `OS architecture: ${os.arch()}`,
|
||||
});
|
||||
context.source.sendFeedback({
|
||||
color: "gray",
|
||||
text: `OS platform: ${os.platform()}`,
|
||||
});
|
||||
context.source.sendFeedback({
|
||||
color: "gray",
|
||||
text: `OS name: ${os.version()}`,
|
||||
});
|
||||
context.source.sendFeedback({
|
||||
color: "gray",
|
||||
text: `Kernal Version: ${os.release()}`,
|
||||
});
|
||||
context.source.sendFeedback({
|
||||
color: "gray",
|
||||
text: `CPU cores: ${os.cpus().length}`,
|
||||
});
|
||||
|
||||
/*
|
||||
if (os.platform() !== 'linux'){
|
||||
source.sendFeedback({text:'cannot find the cpu model are you sure the bot is running on linux?', color:'red'})
|
||||
}
|
||||
else if (os.platform() === 'linux') {
|
||||
*/ source.sendFeedback({
|
||||
color: "gray",
|
||||
text: `CPU model: ${os.cpus()[0].model}`,
|
||||
});
|
||||
source.sendFeedback({
|
||||
translate:'%s%s%s',
|
||||
color: "gray",
|
||||
with: [{text:`Server Free memory `, color:'gray'},{text:`${Math.floor(
|
||||
os.freemem() / 1048576,
|
||||
)} `,color:'gray'},{text: `MiB / ${Math.floor(os.totalmem() / 1048576)} MiB`, color:'gray'}],
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
`Server Memory Usage `, color:'gray'},{text:`${Math.floor(
|
||||
os.freemem() / 1048576,
|
||||
)} `,color:'gray'},{text: `MiB / ${Math.floor(os.totalmem() / 1048576)} MiB
|
||||
*/
|
||||
break;
|
||||
case "logininfo":
|
||||
if (!bot.options.Core.enabled){
|
||||
bot.chat(`Bot Username: ${bot.username}`)
|
||||
await sleep(1000)
|
||||
bot.chat(`Bot uuid "${bot.uuid}"`)
|
||||
await sleep(1000)
|
||||
bot.chat(`Minecraft Java Version: ${bot.version}`)
|
||||
await sleep(1000)
|
||||
bot.chat(`Server: "${bot.options.host}:${bot.options.port}"`)
|
||||
await sleep(1000)
|
||||
bot.chat(`Prefixes: ${bot.options.commands.prefixes.join(', ')}`)
|
||||
await sleep(1000)
|
||||
bot.chat(`Discord Prefix: "${bot.options.discord.commandPrefix}"`)
|
||||
await sleep(1000)
|
||||
bot.chat(`Discord Username: "${bot.discord.client.user.username}#${bot.discord.client.user.discriminator}"`)
|
||||
await sleep(1000)
|
||||
bot.chat(`Discord Channel: ${bot.discord.channel.name}`)
|
||||
await sleep(1000)
|
||||
bot.chat(`ConsoleServer:"${bot.console.consoleServer}"`)
|
||||
await sleep(1000)
|
||||
const amonger2 = bot.bots.map((eachBot) => eachBot.options.host + "\n");
|
||||
const port2 = bot.bots.map((eachBot) => eachBot.options.port);
|
||||
|
||||
if (amonger2.length === 0) {
|
||||
const list = [];
|
||||
for (const host of bots) {
|
||||
if (list.length !== 0) {
|
||||
list.push(host.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
bot.chat(`Servers in Config ${amonger2.length}`);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
const amonger = bot.bots.map((eachBot) => eachBot.options.host + "\n");
|
||||
const port = bot.bots.map((eachBot) => eachBot.options.port);
|
||||
|
||||
if (amonger.length === 0) {
|
||||
const list = [];
|
||||
for (const host of bots) {
|
||||
if (list.length !== 0) {
|
||||
list.push(host.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
source.sendFeedback({ text: `Servers in Config ${amonger.length}` });
|
||||
|
||||
*/
|
||||
}else{
|
||||
source.sendFeedback({
|
||||
text: `Bot Username: "${bot.username}"`,
|
||||
color: "gray",
|
||||
});
|
||||
source.sendFeedback({ text: `Bot uuid:"${bot.uuid}"`, color: "gray" });
|
||||
|
||||
source.sendFeedback({
|
||||
text: `Minecraft Java Version: "${bot.version}"`,
|
||||
color: "gray",
|
||||
});
|
||||
|
||||
source.sendFeedback({
|
||||
text: `Server: "${bot.options.host}:${bot.options.port}"`,
|
||||
color: "gray",
|
||||
});
|
||||
|
||||
source.sendFeedback({
|
||||
text: `Prefixes: ${bot.options.commands.prefixes.join(', ')}`,
|
||||
color: "gray",
|
||||
});
|
||||
|
||||
source.sendFeedback({
|
||||
text: `Discord Prefix: "${bot.options.discord.commandPrefix}"`,
|
||||
color: "gray",
|
||||
});
|
||||
|
||||
source.sendFeedback({
|
||||
text: `Discord Username: "${bot.discord.client.user.username}#${bot.discord.client.user.discriminator}"`,
|
||||
color: "gray",
|
||||
});
|
||||
|
||||
source.sendFeedback({
|
||||
text: `Discord Channel: ${bot.discord.channel.name}`,
|
||||
});
|
||||
source.sendFeedback({
|
||||
color: "gray",
|
||||
text: `ConsoleServer:"${bot.console.consoleServer}"`,
|
||||
});
|
||||
|
||||
const amonger = bot.bots.map((eachBot) => eachBot.options.host + "\n");
|
||||
const port = bot.bots.map((eachBot) => eachBot.options.port);
|
||||
|
||||
if (amonger.length === 0) {
|
||||
const list = [];
|
||||
for (const host of bots) {
|
||||
if (list.length !== 0) {
|
||||
list.push(host.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
source.sendFeedback({ text: `Servers in Config ${amonger.length}` });
|
||||
|
||||
}
|
||||
break;
|
||||
case "loaded":
|
||||
|
||||
const util = "./util";
|
||||
const modules = "./modules";
|
||||
const commands = "./commands";
|
||||
const CommandModules = "./CommandModules";
|
||||
|
||||
const chat = "./chat";
|
||||
if (!bot.options.Core.enabled){
|
||||
fs.readdir(util, (err, files) => {
|
||||
bot.chat(`Util files loaded: ${files.length}`);
|
||||
});
|
||||
await sleep(1000)
|
||||
fs.readdir(modules, (err, files) => {
|
||||
bot.chat(`Modules files loaded: ${files.length}`);
|
||||
});
|
||||
await sleep(1000)
|
||||
fs.readdir(commands, (err, files) => {
|
||||
bot.chat(`Command files loaded: ${files.length}`);
|
||||
});
|
||||
await sleep(1000)
|
||||
fs.readdir(CommandModules, (err, files) => {
|
||||
bot.chat(`Command Module files loaded: ${files.length}`);
|
||||
});
|
||||
await sleep(1000)
|
||||
fs.readdir(chat, (err, files) => {
|
||||
bot.chat(`Chat files loaded: ${files.length}`);
|
||||
});
|
||||
}else {
|
||||
fs.readdir(util, (err, files) => {
|
||||
source.sendFeedback({text:`Util files loaded: ${files.length}`});
|
||||
});
|
||||
|
||||
fs.readdir(modules, (err, files) => {
|
||||
source.sendFeedback({text:`Modules files loaded: ${files.length}`});
|
||||
});
|
||||
|
||||
fs.readdir(commands, (err, files) => {
|
||||
source.sendFeedback({text:`Command files loaded: ${files.length}`});
|
||||
});
|
||||
|
||||
fs.readdir(CommandModules, (err, files) => {
|
||||
source.sendFeedback({text:`Command Module files loaded: ${files.length}`});
|
||||
});
|
||||
|
||||
fs.readdir(chat, (err, files) => {
|
||||
source.sendFeedback({text:`Chat files loaded: ${files.length}`});
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "test":
|
||||
// bot.tellraw('test')
|
||||
// const porta = bot.bots.map(eachBot => eachBot.options.port)
|
||||
const amongerus = bot.bots.map(
|
||||
(eachBot) => eachBot.options.host + ":" + eachBot.options.port + "\n",
|
||||
);
|
||||
/*
|
||||
if (amonger.length === 0){
|
||||
const list = [];
|
||||
for (const host of bots){
|
||||
if (list.length !== 0) {
|
||||
list.push({text:`Server Count: ${host.name}`})
|
||||
}
|
||||
}
|
||||
|
||||
} */
|
||||
//source.sendFeedback()
|
||||
source.sendFeedback(amongerus);
|
||||
// source.sendFeedback(amonger)
|
||||
break;
|
||||
case "uptime":
|
||||
function format(seconds) {
|
||||
function pad(s) {
|
||||
return (s < 10 ? "0" : "") + s;
|
||||
}
|
||||
var hours = Math.floor(seconds / (60 * 60));
|
||||
var minutes = Math.floor((seconds % (60 * 60)) / 60);
|
||||
var seconds = Math.floor(seconds % 60);
|
||||
|
||||
return (
|
||||
pad(`${hours} Hours`) +
|
||||
" " +
|
||||
pad(`${minutes} Minutes`) +
|
||||
" " +
|
||||
pad(`${seconds} Seconds`)
|
||||
);
|
||||
}
|
||||
|
||||
var uptime = process.uptime();
|
||||
if(!bot.options.Core.enabled){
|
||||
bot.chat(`Bot Uptime: ${format(uptime)}`)
|
||||
} else {
|
||||
|
||||
source.sendFeedback({
|
||||
color: "gray",
|
||||
text: `Bot Uptime: ${format(uptime)}`,
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
case "creators":
|
||||
if(!bot.options.Core.enabled){
|
||||
bot.chat('Thank you all that helped!')
|
||||
await sleep(1000)
|
||||
bot.chat(`&4Parker&02991`)
|
||||
await sleep(1000)
|
||||
bot.chat('&2_ChipMC_')
|
||||
await sleep(1000)
|
||||
bot.chat('&echayapak')
|
||||
await sleep(1000)
|
||||
bot.chat('&d_yfd')
|
||||
await sleep(1000)
|
||||
bot.chat('&6Poopcorn (Poopbob???)')
|
||||
}else{
|
||||
source.sendFeedback({
|
||||
color: "gray",
|
||||
text: "Thank you to all that helped!",
|
||||
});
|
||||
source.sendFeedback({
|
||||
translate: "%s%s",
|
||||
with: [
|
||||
{ color: "dark_red", text: "Parker" },
|
||||
{ color: "black", text: "2991" },
|
||||
],
|
||||
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "FNF",
|
||||
color: "dark_purple",
|
||||
bold: true,
|
||||
},
|
||||
{
|
||||
text: "Boyfriend",
|
||||
color: "aqua",
|
||||
bold: true,
|
||||
},
|
||||
{
|
||||
text: "Bot ",
|
||||
color: "dark_red",
|
||||
bold: true,
|
||||
},
|
||||
{
|
||||
text: "Discord",
|
||||
color: "blue",
|
||||
bold: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `${bot.options.discord.invite}`,
|
||||
},
|
||||
});
|
||||
source.sendFeedback({
|
||||
text: "_ChipMC_",
|
||||
color: "dark_green",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "chipmunk dot land",
|
||||
color: "green",
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `https://chipmunk.land`,
|
||||
},
|
||||
});
|
||||
source.sendFeedback({
|
||||
text: "chayapak",
|
||||
color: "yellow",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "Chomens ",
|
||||
color: "yellow",
|
||||
},
|
||||
{
|
||||
text: "Discord",
|
||||
color: "blue",
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `https://discord.gg/xdgCkUyaA4`,
|
||||
},
|
||||
});
|
||||
source.sendFeedback({
|
||||
text: "_yfd",
|
||||
color: "light_purple",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "ABot ",
|
||||
color: "gold",
|
||||
bold: true,
|
||||
},
|
||||
{
|
||||
text: "Discord",
|
||||
color: "blue",
|
||||
bold: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `https://discord.gg/CRfP2ZbG8T`,
|
||||
},
|
||||
});
|
||||
source.sendFeedback({ text: "Poopcorn(Poopbob???)", color: "gold" });
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
if (!bot.options.Core.enabled){
|
||||
bot.chat('&4Invalid action')
|
||||
await sleep(500)
|
||||
bot.chat('the usages are version, discord, serverinfo, logininfo, uptime, creators')
|
||||
}else{
|
||||
context.source.sendError([
|
||||
cmd,
|
||||
{ text: "Invalid action", color: "dark_red", bold: false },
|
||||
]);
|
||||
context.source.sendError([
|
||||
cmd,
|
||||
{
|
||||
text: "the usages are version, discord, serverinfo, logininfo, uptime, creators",
|
||||
color: "gray",
|
||||
bold: false,
|
||||
},
|
||||
]);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -1,159 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error.js')
|
||||
module.exports = {
|
||||
name: 'netmsg',
|
||||
description:['send a message to other servers'],
|
||||
trustLevel: 0,
|
||||
aliases:['networkmessage', 'netmessage', 'networkmsg'],
|
||||
execute (context) {
|
||||
|
||||
const message = context.arguments.join(' ')
|
||||
|
||||
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
const source = context.source
|
||||
|
||||
if (!message[0]) {
|
||||
|
||||
context.source.sendFeedback({text:'Message is empty', color:'red'}, false)
|
||||
if(source.sources.console && !bot.options.Core.enabled){
|
||||
|
||||
for (const eachBot of bot.bots)
|
||||
|
||||
eachBot.chat(`[${bot.options.host}:${bot.options.port}] ${ChatMessage.fromNotch(bot.options.username).toMotd().replaceAll('§', '&')} &f› ${message}`)
|
||||
}
|
||||
} else if (!bot.options.Core.enabled && !source.sources.console) {
|
||||
|
||||
|
||||
for (const eachBot of bot.bots)
|
||||
|
||||
eachBot.chat(`[${bot.options.host}:${bot.options.port}] ${ChatMessage.fromNotch(context.source.player.displayName ?? context.source.player.profile.name).toMotd().replaceAll('§', '&')} &f› ${message}`)//
|
||||
}else if(source.sources.console){
|
||||
const component = {
|
||||
translate: '[%s] [%s] %s \u203a %s',
|
||||
with: [
|
||||
{
|
||||
translate: '%s%s%s',
|
||||
bold:false,
|
||||
with: [
|
||||
{
|
||||
text: 'FNF',
|
||||
bold: true,
|
||||
color: 'dark_purple'
|
||||
|
||||
},
|
||||
{
|
||||
text: 'Boyfriend',
|
||||
bold: true,
|
||||
color: '#00FFFF'
|
||||
},
|
||||
{
|
||||
text: 'Bot',
|
||||
bold: true,
|
||||
color: 'dark_red'
|
||||
},
|
||||
],
|
||||
clickEvent: bot.options.Core.customName ? { action: 'open_url', value: bot.options.Core.customName } : undefined,
|
||||
hoverEvent: { action: 'show_text', contents: `idfk what to put here` }
|
||||
},
|
||||
{
|
||||
text:`${bot.options.host}:${bot.options.port}`,
|
||||
bold:false,
|
||||
color:'white',
|
||||
translate:"",
|
||||
hoverEvent:{
|
||||
action:"show_text",
|
||||
value:[
|
||||
{
|
||||
text:`Server: ${bot.options.host}:${bot.options.port}`,
|
||||
color:'white',
|
||||
}
|
||||
],
|
||||
clickEvent:{
|
||||
action:"copy_to_clipboard",value:`${bot.options.host}:${bot.options.port}`}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
bot.username,
|
||||
|
||||
//entry.displayName
|
||||
{text:bot.getMessageAsPrismarine(message).toMotd.replaceAll('&','\xa7')}
|
||||
]//command.split(' ')[0]
|
||||
}
|
||||
|
||||
|
||||
for (const eachBot of bot.bots)
|
||||
eachBot.tellraw(component)
|
||||
|
||||
}else if(bot.options.Core.enabled && !source.sources.console){
|
||||
|
||||
const component = {
|
||||
translate: '[%s] [%s] %s \u203a %s',
|
||||
with: [
|
||||
{
|
||||
translate: '%s%s%s',
|
||||
bold:false,
|
||||
with: [
|
||||
{
|
||||
text: 'FNF',
|
||||
bold: true,
|
||||
color: 'dark_purple'
|
||||
|
||||
},
|
||||
{
|
||||
text: 'Boyfriend',
|
||||
bold: true,
|
||||
color: '#00FFFF'
|
||||
},
|
||||
{
|
||||
text: 'Bot',
|
||||
bold: true,
|
||||
color: 'dark_red'
|
||||
},
|
||||
],
|
||||
clickEvent: bot.options.Core.customName ? { action: 'open_url', value: bot.options.Core.customName } : undefined,
|
||||
hoverEvent: { action: 'show_text', contents: `idfk what to put here` }
|
||||
},
|
||||
{
|
||||
text:`${bot.options.host}:${bot.options.port}`,
|
||||
bold:false,
|
||||
color:'white',
|
||||
translate:"",
|
||||
hoverEvent:{
|
||||
action:"show_text",
|
||||
value:[
|
||||
{
|
||||
text:`Server: ${bot.options.host}:${bot.options.port}`,
|
||||
color:'white',
|
||||
}
|
||||
],
|
||||
clickEvent:{
|
||||
action:"copy_to_clipboard",value:`${bot.options.host}:${bot.options.port}`}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
context?.source?.player?.displayName ?? context?.source?.player?.profile?.name,
|
||||
|
||||
|
||||
{text:bot.getMessageAsPrismarine(message).toMotd().replaceAll('&', '\xa7')}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
for (const eachBot of bot.bots)
|
||||
eachBot.tellraw(component)
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
const { translate } = require('@vitalets/google-translate-api')
|
||||
module.exports = {
|
||||
name:'translate',
|
||||
description:['<language 1> <language 2> <message>'],
|
||||
aliases:['translation'],
|
||||
trustLevel: 0,
|
||||
async execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
|
||||
try {
|
||||
const res = await translate(args.slice(2).join(' '), { from: args[0], to: args[1] })
|
||||
bot.tellraw( [{ text: 'Result: ', color: 'gold' }, { text: res.text, color: 'green' }])
|
||||
} catch (e) {
|
||||
bot.tellraw( { text: String(e), color: 'red' })
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
const wiki = require('wikipedia') //
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
module.exports = {
|
||||
name: 'wiki',
|
||||
description:['wikipedia'],
|
||||
trustLevel: 0,
|
||||
aliases:['wikipedia'],
|
||||
async execute (context) {
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
const cmd = {
|
||||
translate: '[%s] ',
|
||||
bold: false,
|
||||
color: 'white',
|
||||
with: [
|
||||
{ color: 'dark_green', text: 'Wiki Cmd'},
|
||||
]
|
||||
}
|
||||
try {
|
||||
const page = await wiki.page(args.join(' '))
|
||||
// const summary = await page.images()
|
||||
const summary2 = await page.intro()
|
||||
|
||||
//const definitions = await urban.define(args.join(' '))
|
||||
/// console.log(summary)
|
||||
|
||||
// source.sendFeedback({ text: JSON.stringify(summary), color: 'green' })
|
||||
if (!bot.options.Core.enabled){
|
||||
bot.chat(ChatMessage.fromNotch(await sleep(500)
|
||||
?? [cmd, { text:summary2, color: 'gray' }]).toMotd().replaceAll('§', '&'))
|
||||
}else{
|
||||
source.sendFeedback([cmd,{ text:`${summary2}`, color: 'green' }])
|
||||
}
|
||||
} catch (e) {
|
||||
if(!bot.options.Core.enabled){
|
||||
bot.chat(ChatMessage.fromNotch([cmd, { text: `${e.toString()}`, color: 'red' }]).toMotd().replaceAll('§', '&'))
|
||||
}else{
|
||||
source.sendFeedback([cmd, { text: `${e}`, color: 'red' }])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-65
@@ -1,65 +0,0 @@
|
||||
|
||||
{
|
||||
module.exports = {
|
||||
|
||||
bots: [
|
||||
{
|
||||
host: "serveriphere",
|
||||
username:username(),
|
||||
version:"1.20.2",
|
||||
reconnectDelay: 6000,
|
||||
endcredits:false,
|
||||
Console:{
|
||||
enabled: false,
|
||||
filelogging:false,
|
||||
prefix:'c.',
|
||||
},
|
||||
|
||||
|
||||
commands: {
|
||||
prefixes:
|
||||
["!", "!", "!"] // are those the prefixes?
|
||||
},
|
||||
Core: {
|
||||
customName:"corenamehere",
|
||||
enabled: false,
|
||||
interval:180000
|
||||
},
|
||||
discord: {
|
||||
channelId: "discordchannelidhere",
|
||||
invite: "discordinvitelinkhere",
|
||||
commandPrefix: "!"
|
||||
},
|
||||
selfcare: {
|
||||
vanished: false,
|
||||
unmuted: false,
|
||||
prefix: false,
|
||||
cspy: false,
|
||||
tptoggle:false,
|
||||
skin:false,
|
||||
gmc:false,
|
||||
op:false,
|
||||
nickname:false,
|
||||
username:false,
|
||||
god: false,
|
||||
interval:500,
|
||||
}
|
||||
},
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function username() {
|
||||
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; // remove sus characters like ` or like ( or whatever because it breaks whatever
|
||||
let username = '';
|
||||
for (let i = 0; i < 9; i++) {
|
||||
const randomIndex = Math.floor(Math.random() * characters.length);
|
||||
username += characters[randomIndex];
|
||||
}
|
||||
return username;
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
put your midi files here
|
||||
@@ -1,30 +0,0 @@
|
||||
function command_loop_manager (bot, options) {
|
||||
bot.cloop = {
|
||||
list: [],
|
||||
|
||||
add (command, interval) {
|
||||
|
||||
this.list.push({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
|
||||
},
|
||||
|
||||
/*
|
||||
if (message.startsWith('/')) {
|
||||
bot.command(message.substring(1))
|
||||
return
|
||||
}
|
||||
bot.chat(message)
|
||||
*/
|
||||
remove (index) {
|
||||
clearInterval(this.list[index].timer)
|
||||
},
|
||||
|
||||
clear () {
|
||||
for (const cloop of this.list) clearInterval(cloop.timer)
|
||||
|
||||
this.list = []
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = command_loop_manager
|
||||
@@ -1,62 +0,0 @@
|
||||
const nbs = require('./nbs-file.js')
|
||||
const instrumentNames = [
|
||||
'harp',
|
||||
'bass',
|
||||
'basedrum',
|
||||
'snare',
|
||||
'hat',
|
||||
'guitar',
|
||||
'flute',
|
||||
'bell',
|
||||
'chime',
|
||||
'xylophone',
|
||||
'iron_xylophone',
|
||||
'cow_bell',
|
||||
'didgeridoo',
|
||||
'bit',
|
||||
'banjo',
|
||||
'pling'
|
||||
]
|
||||
|
||||
function convertNBS (buf) {
|
||||
const parsed = nbs.parse(buf)
|
||||
const song = {
|
||||
name: parsed.songName,
|
||||
notes: [],
|
||||
loop: false,
|
||||
loopPosition: 0,
|
||||
length: 0
|
||||
}
|
||||
if (parsed.loop > 0) {
|
||||
song.loop = true
|
||||
song.loopPosition = parsed.loopStartTick
|
||||
}
|
||||
for (const note of parsed.nbsNotes) {
|
||||
let instrument = note.instrument
|
||||
if (note.instrument < instrumentNames.length) {
|
||||
instrument = instrumentNames[note.instrument]
|
||||
} else continue
|
||||
|
||||
if (note.key < 33 || note.key > 55) continue
|
||||
|
||||
const layerVolume = 100
|
||||
// will add layer volume later
|
||||
|
||||
const time = tickToMs(note.tick, parsed.tempo)
|
||||
song.length = Math.max(song.length, time)
|
||||
|
||||
song.notes.push({
|
||||
instrument,
|
||||
pitch: note.key - 33,
|
||||
volume: note.velocity * layerVolume / 10000,
|
||||
time
|
||||
})
|
||||
}
|
||||
return song
|
||||
}
|
||||
|
||||
function tickToMs (tick = 1, tempo) {
|
||||
return Math.floor(1000 * tick * 100 / tempo)
|
||||
}
|
||||
|
||||
module.exports = convertNBS
|
||||
Generated
-5105
File diff suppressed because it is too large
Load Diff
@@ -1,37 +0,0 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@tonejs/midi": "^2.0.28",
|
||||
"@vitalets/google-translate-api": "^9.2.0",
|
||||
"axios": "^1.6.2",
|
||||
"chalk": "^5.3.0",
|
||||
"chromium": "^3.0.3",
|
||||
"color-convert": "^2.0.1",
|
||||
"cowsay2": "^2.0.4",
|
||||
"discord.js": "^14.14.1",
|
||||
"dockerode": "^4.0.2",
|
||||
"dotenv": "^16.3.1",
|
||||
"isolated-vm": "^4.7.2",
|
||||
"minecraft-data": "^3.61.0",
|
||||
"minecraft-protocol": "^1.46.0",
|
||||
"minecraft-protocol-forge": "^1.0.0",
|
||||
"mineflayer": "^4.14.0",
|
||||
"mineflayer-cmd": "^1.1.3",
|
||||
"moment-timezone": "^0.5.45",
|
||||
"node_characterai": "^1.2.4",
|
||||
"node-fetch": "^2.7.0",
|
||||
"prismarine-chat": "^1.9.1",
|
||||
"prismarine-nbt": "^2.2.1",
|
||||
"prismarine-physics": "^1.8.0",
|
||||
"prismarine-registry": "^1.7.0",
|
||||
"randomstring": "^1.3.0",
|
||||
"readline": "^1.3.0",
|
||||
"sharp": "^0.32.6",
|
||||
"urban-dictionary": "git+https://code.chipmunk.land/ChipmunkMC/urban-dictionary.git",
|
||||
"urban-dictionary-client": "^3.1.0",
|
||||
"uuid-by-string": "^4.0.0",
|
||||
"vec3": "^0.1.8",
|
||||
"vm2": "^3.9.19",
|
||||
"weather-js": "^2.0.0",
|
||||
"wikipedia": "^2.1.1"
|
||||
}
|
||||
}
|
||||
+25
-56
@@ -4,53 +4,34 @@ const fs = require("fs");
|
||||
const path = require("path");
|
||||
const util = require("node:util");
|
||||
|
||||
require("events").EventEmitter.defaultMaxListeners = 31;
|
||||
require("events").EventEmitter.defaultMaxListeners = Infinity;
|
||||
const ChatMessage = require('prismarine-chat')('1.20.2')
|
||||
function createBot(options = {}) {
|
||||
const bot = new EventEmitter();
|
||||
const rs = require("randomstring");
|
||||
// const rs = require("randomstring");
|
||||
// Set some default values in options
|
||||
let r = Math.floor(Math.random() * 255) + 1;
|
||||
options.host ??= "localhost";
|
||||
options.username ??= "FNFBoyfriendBot";
|
||||
options.hideErrors ??= false; // HACK: Hide errors by default as a lazy fix to console being spammed with them
|
||||
options.Console.enabled ??= true;
|
||||
options.Console.filelogging ??= false;
|
||||
|
||||
options.selfcare.vanished ??= true;
|
||||
|
||||
options.selfcare.prefix ??= true;
|
||||
|
||||
options.selfcare.skin ??= true;
|
||||
|
||||
options.selfcare.cspy ??= true;
|
||||
|
||||
options.selfcare.op ??= true;
|
||||
|
||||
options.selfcare.gmc ??= true;
|
||||
|
||||
options.selfcare.interval ??= 500;
|
||||
|
||||
options.selfcare.username ??= true;
|
||||
|
||||
options.selfcare.nickname ??= true;
|
||||
|
||||
options.selfcare.god ??= true;
|
||||
|
||||
options.selfcare.tptoggle ??= true;
|
||||
|
||||
options.discord.commandPrefix ??= "~";
|
||||
|
||||
options.reconnectDelay ??= 1000;
|
||||
|
||||
bot.options = {
|
||||
host: options.host ??= "localhost",
|
||||
username: options.username ??= "FNFBoyfriendBot",
|
||||
hideErrors: options.hideErrors ??= false, // HACK: Hide errors by default as a lazy fix to console being spammed with the console
|
||||
version: options.version ??= '1.20.2',
|
||||
}
|
||||
bot.options = options;
|
||||
|
||||
// Create our client object, put it on the bot, and register some events
|
||||
bot.on("init_client", (client) => {
|
||||
client.on("packet", (data, meta) => {
|
||||
bot.emit("packet", data, meta);
|
||||
bot.emit("packet." + meta.name, data);
|
||||
});
|
||||
try{
|
||||
bot.emit('packet.' + meta.name, data)
|
||||
} catch(e) {
|
||||
if(e.toString() === 'RangeError: Invalid string length'){
|
||||
bot._client.end()
|
||||
}else{
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
});
|
||||
const timer = setInterval(() => {
|
||||
if(!bot.options.endcredits){
|
||||
return
|
||||
@@ -64,16 +45,10 @@ client.on("login", async function (data) {
|
||||
bot.uuid = client.uuid;
|
||||
bot.username = client.username;
|
||||
bot.port = bot.options.port;
|
||||
bot.version = bot.options.version;
|
||||
|
||||
|
||||
bot.version = bot.options.version;
|
||||
|
||||
|
||||
if(!bot.options.Core.enabled){
|
||||
var day = new Date().getDay()
|
||||
if(day === 5){
|
||||
bot.chat('Getting freaky on a Friday Night!')
|
||||
}else{
|
||||
|
||||
var day = new Date().getDay()
|
||||
if(day === 5){
|
||||
bot.chat('Getting freaky on a Friday Night!')
|
||||
@@ -81,14 +56,11 @@ bot.chat('Getting freaky on a Friday Night!')
|
||||
const buildstring = process.env["buildstring"]
|
||||
bot.chat(ChatMessage.fromNotch(JSON.stringify(process.env['buildstring'])).toMotd().replaceAll('§', '&'))
|
||||
}
|
||||
}
|
||||
|
||||
timer
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
client.on("end", (reason) => {
|
||||
bot.emit("end", reason);
|
||||
bot.emit("end", reason);
|
||||
bot.console.warn(`Disconnected: ${JSON.stringify(reason)}`);
|
||||
bot.cloop.clear()
|
||||
bot.memusage.off()
|
||||
@@ -96,7 +68,7 @@ bot.tps.off()
|
||||
clearInterval(timer)
|
||||
bot?.discord?.channel?.send('``Disconnected:' + JSON.stringify(reason) + '``' )
|
||||
});
|
||||
|
||||
|
||||
client.on("disconnect", (reason) => {
|
||||
bot.emit("disconnect", reason);
|
||||
bot.console.warn(`Disconnected: ${JSON.stringify(reason)}`);
|
||||
@@ -133,9 +105,6 @@ bot.emit("error", error)
|
||||
|
||||
return bot;
|
||||
}
|
||||
const amonger = "../";
|
||||
if (fs.existsSync("../FridayNightFunkinBoyfriendBot") == false) { // this isn't full proof. if the replit name is the same as this value, it will count as not a amonger | I have an idea, my idea is like check if the name of the system / info is whatever so if it's win32 but it should be whatever ubuntu or something it doesn't run | I might put it in minecraft-protocol files :skull:
|
||||
process.exit(1);//but that would be overwritten when minecraft-protocol is being updated or smh
|
||||
}
|
||||
|
||||
|
||||
module.exports = createBot;
|
||||
@@ -255,6 +255,7 @@ module.exports = {
|
||||
description: ["shows a list of known bots"],
|
||||
aliases: ["knownbots"],
|
||||
trustLevel: 0,
|
||||
usage:[""],
|
||||
execute(context) {
|
||||
const query = context.arguments.join(" ").toLowerCase();
|
||||
const bot = context.bot;
|
||||
@@ -5,6 +5,7 @@ module.exports = {
|
||||
description:['bruhify text'],
|
||||
aliases:['bruhifytext', 'bruh'],
|
||||
trustLevel: 0,
|
||||
usage:["smexy text here"],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
@@ -16,4 +17,4 @@ context.source.sendFeedback(JSON.stringify(bot.bruhifyText))
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,7 @@ module.exports = {
|
||||
description:['check the bots changelog'],
|
||||
trustLevel: 0,
|
||||
aliases:['cl', 'changes'],
|
||||
usage:[""],
|
||||
execute (context) {
|
||||
const query = context.arguments.join(' ').toLowerCase()
|
||||
const bot = context.bot
|
||||
@@ -346,6 +346,7 @@ module.exports = {
|
||||
description:['check the bots changelog'],
|
||||
trustLevel: 0,
|
||||
aliases:['clv4.3.4', 'changesv4.3.4'],
|
||||
usage:[""],
|
||||
execute (context) {
|
||||
const query = context.arguments.join(' ').toLowerCase()
|
||||
const bot = context.bot
|
||||
@@ -1,12 +1,15 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
module.exports = {
|
||||
name: 'cloop',
|
||||
//hashOnly: true,
|
||||
// consoleOnly:false,
|
||||
// ownerOnly:false,
|
||||
trustLevel: 1,
|
||||
description:['command loop commands, the args are add, remove, clear, and list'],
|
||||
description:['command loop commands'],
|
||||
aliases:['commandloop'],
|
||||
usage:[
|
||||
"add <interval> <command/message>",
|
||||
"clear",
|
||||
"remove <id>",
|
||||
"list",
|
||||
],
|
||||
execute (context, selector) {
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
@@ -23,10 +26,7 @@ module.exports = {
|
||||
|
||||
const interval = parseInt(args[2])
|
||||
const command = args.slice(3).join(' ')
|
||||
if(!bot.options.Core.enabled){
|
||||
throw new CommandError('Coreless mode is active can not execute command!')
|
||||
|
||||
} else{
|
||||
|
||||
bot.cloop.add(command, interval)
|
||||
|
||||
source.sendFeedback({
|
||||
@@ -34,13 +34,13 @@ module.exports = {
|
||||
color:'gray',
|
||||
with: [ command, interval ]
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
break
|
||||
case 'remove':
|
||||
if (parseInt(args[2]) === NaN) source.sendFeedback({ text: 'Invalid index', color: 'red' }, false)
|
||||
if (bot.cloop.list[args[2]].id === undefined) source.sendFeedback({ text: 'Invalid index', color: 'red' }, false)
|
||||
|
||||
const index = parseInt(args[2])
|
||||
const index = (args[2])
|
||||
|
||||
bot.cloop.remove(index)
|
||||
|
||||
@@ -5,6 +5,10 @@ module.exports = {
|
||||
description:['usages are test and msg error'],
|
||||
trustLevel: 0,
|
||||
aliases:['cmdtst', 'commandtest', 'commandtst'],
|
||||
usage:[
|
||||
"msg",
|
||||
"error",
|
||||
],
|
||||
execute (context) {
|
||||
|
||||
const bot = context.bot
|
||||
@@ -12,8 +12,8 @@ module.exports = {
|
||||
|
||||
const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"})
|
||||
|
||||
const servers = bot.bots.map(eachBot => eachBot.options.host)
|
||||
const ports = bot.bots.map(eachBot => eachBot.options.port)
|
||||
// const servers = bot.bots.map(eachBot => eachBot.options.host)
|
||||
const serverName = bot.bots.map(eachBot => eachBot.options.serverName)
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
for (const eachBot of bot.bots) {
|
||||
|
||||
@@ -27,10 +27,9 @@ const ports = bot.bots.map(eachBot => eachBot.options.port)
|
||||
continue
|
||||
|
||||
|
||||
}//.repeat(Math.floor((32767 - 22) / 16))
|
||||
//"a".repeat(10)
|
||||
}
|
||||
|
||||
const server = servers.find(server => server.toLowerCase().includes(args[0]))
|
||||
const server = serverName.find(server => server.toLowerCase().includes(args[0]))
|
||||
|
||||
if (!server) {
|
||||
source.sendFeedback({ text: 'Invalid server', color: 'red' })
|
||||
@@ -43,5 +42,5 @@ const ports = bot.bots.map(eachBot => eachBot.options.port)
|
||||
// eachBot.console.consoleServer = port
|
||||
|
||||
}
|
||||
}//[${now} \x1b[0m\x1b[33mLOGS\x1b[0m\x1b[90m] [${options.host}:${options.port}] ${ansi}
|
||||
}//\x1b[0m\x1b[92m[INFO]\x1b[0m\x1b[90m Set the console server to
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ module.exports = {
|
||||
description:['make me run a command in core'],
|
||||
aliases:['cb','corerun','run','commandblockrun','cbrun'],
|
||||
trustLevel: 0,
|
||||
usage:["<command/message>"],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
// const client = context.client
|
||||
@@ -13,12 +14,6 @@ module.exports = {
|
||||
const message = context.arguments.join(' ')
|
||||
// if (args.length === 0){
|
||||
//source.sendFeedback({translate:"Too few Arguments!", color:"red"})
|
||||
if (args[0] === undefined){
|
||||
source.sendFeedback({translate:"Too few Arguments!", color:"red"})
|
||||
}
|
||||
if (!bot.options.Core.enabled){
|
||||
throw new CommandError('&4Coreless mode is active can not execute command!')
|
||||
}else{
|
||||
if (message.startsWith('/')) {
|
||||
bot.core.run(message.substring(1))
|
||||
return
|
||||
@@ -28,4 +23,3 @@ if (message.startsWith('/')) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ module.exports = {
|
||||
description:['mooooo'],
|
||||
aliases:['cws', 'cow'],
|
||||
trustLevel: 0,
|
||||
usage:["list"],
|
||||
execute (context, selector) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
@@ -5,6 +5,7 @@ module.exports = {
|
||||
description:['crashes a server'],
|
||||
trustLevel: 1,
|
||||
aliases:['crashserver', '69'],//69 cuz yes
|
||||
usage:["exe","give"],
|
||||
execute (context) {
|
||||
|
||||
const bot = context.bot
|
||||
@@ -41,10 +42,10 @@ const args = context.arguments
|
||||
}
|
||||
if(source.sources.console){
|
||||
bot.console.info([cmd, { text: 'Invalid action', color: 'dark_red', bold:false }])
|
||||
bot.console.info([cmd, { text: 'the args are give, and exe', color: 'green', bold:false }])
|
||||
// bot.console.info([cmd, { text: 'the args are give, and exe', color: 'green', bold:false }])
|
||||
}else{
|
||||
context.source.sendError([cmd, { text: 'Invalid action', color: 'dark_red', bold:false }])
|
||||
context.source.sendError([cmd, { text: 'the args are give, and exe', color: 'green', bold:false }])
|
||||
// context.source.sendError([cmd, { text: 'the args are give, and exe', color: 'green', bold:false }])
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,4 +53,4 @@ const args = context.arguments
|
||||
}
|
||||
|
||||
//what is wi
|
||||
// IDK
|
||||
// IDK
|
||||
@@ -5,6 +5,7 @@ module.exports = {
|
||||
description:['make me say something in discord'],
|
||||
trustLevel: 0,
|
||||
aliases:['discordmessage', 'ddmsg'],
|
||||
usage:["message"],
|
||||
execute (context) {
|
||||
//const args = context.args
|
||||
const bot = context.bot
|
||||
@@ -3,6 +3,9 @@ module.exports = {
|
||||
description:['make me say something in chat'],
|
||||
aliases:['chatsay'],
|
||||
trustLevel: 0,
|
||||
usage:[
|
||||
"<command/message>",
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
@@ -4,6 +4,7 @@ module.exports = {
|
||||
description:['/kill the bot or make it /suicide'],
|
||||
trustLevel: 1,
|
||||
aliases:['kys','kill','suicide'],
|
||||
usage:[""],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
@@ -15,4 +16,4 @@ process.exit()
|
||||
}
|
||||
/*context.source.sendFeedback('farding right now....')
|
||||
process.exit(1)
|
||||
*/
|
||||
*/
|
||||
@@ -9,6 +9,7 @@ module.exports = {
|
||||
trustLevel: 1,
|
||||
aliases:['evaljsisolatedvm', 'evaljsnew', 'evaljsivm', 'eval', 'evalivm', 'evalisolatedvm', 'evaljsnew'],
|
||||
description:['run code in a vm note: amcforum members had a sh##fit over this command'],
|
||||
usage:["re fucking doing"],
|
||||
async execute (context) {
|
||||
const bot = context.bot
|
||||
const source = context.source
|
||||
@@ -3,21 +3,24 @@ const CommandError = require('../CommandModules/command_error')
|
||||
module.exports = {
|
||||
name: 'help',
|
||||
aliases:['heko', 'cmd', '?', 'commands', 'cmds' ],
|
||||
description:['shows the command list'],
|
||||
description:['shows the command list or the usage of a command'],
|
||||
trustLevel: 0,
|
||||
usage:'[COMMAND]',
|
||||
async execute (context) {
|
||||
const bot = context.bot
|
||||
const commandList = []
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const {EmbedBuilder } = require('discord.js')
|
||||
// const amogus = bot.prefix
|
||||
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
const cmd = {
|
||||
const CommandManager = bot.commandManager
|
||||
const cmd = {
|
||||
translate: '[%s] ',
|
||||
bold: false,
|
||||
color: 'white',
|
||||
with: [
|
||||
{ color: 'blue', text: 'Help Cmd'},
|
||||
{ color: 'blue', text: 'help cmd'},
|
||||
]
|
||||
}
|
||||
const category = {
|
||||
@@ -25,11 +28,11 @@ module.exports = {
|
||||
bold: false,
|
||||
color: 'white',
|
||||
with: [
|
||||
{ color: '#00FFFF', text: 'Public'},
|
||||
{ color: `${bot.helpTheme.pub_lickColor}`, text: 'Public'},
|
||||
{ color: 'white', text: ' | '},
|
||||
{ color: 'dark_purple', text: 'Trusted'},
|
||||
{ color: `${bot.helpTheme.t_rustedColor}`, text: 'Trusted'},
|
||||
{ color: 'white', text: ' | '},
|
||||
{ color: 'dark_red', text: 'Owner'},
|
||||
{ color: `${bot.helpTheme.own_herColor}`, text: 'Owner'},
|
||||
]
|
||||
}
|
||||
|
||||
@@ -38,21 +41,22 @@ module.exports = {
|
||||
for (const commands in bot.commandManager.commandlist) { // i broke a key woops
|
||||
const command = bot.commandManager.commandlist[commands]
|
||||
|
||||
if (args[0].toLowerCase() === command.name )
|
||||
// if (args[0].toLowerCase() === command.aliases)
|
||||
{//text:`Trust Level: `,color:'white'},
|
||||
//{text:`${command.trustLevel}\n`,color:'red'},
|
||||
if (args[0].toLowerCase() === command.name)
|
||||
|
||||
|
||||
|
||||
{
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}//bot.getMessageAsPrismarine([cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole])?.toAnsi()
|
||||
|
||||
valid = true
|
||||
if(source.sources.console){
|
||||
bot.console.info(bot.getMessageAsPrismarine([cmd, `Description: ${command.description}`])?.toAnsi())
|
||||
bot.console.info(bot.getMessageAsPrismarine([cmd, {text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'#00ffff'},{text:`${command.aliases} › ${command.description}`,color:'dark_purple'}])?.toAnsi())
|
||||
|
||||
bot.console.info(bot.getMessageAsPrismarine([cmd, {text:`Trust Level: ${command.trustLevel}`}])?.toAnsi())//[cmd, {text:`Trust Level: ${command.trustLevel}`}]
|
||||
bot.console.info(bot.getMessageAsPrismarine([cmd,{text:`Trust Level: `,color:'#00ffff'},{text:`${command.trustLevel}`,color:'dark_purple'}])?.toAnsi())
|
||||
|
||||
bot.console.info(bot.getMessageAsPrismarine([cmd, `aliases: ${command.aliases}`])?.toAnsi())
|
||||
bot.console.info(bot.getMessageAsPrismarine([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])?.toAnsi())
|
||||
}else if(!bot.options.Core.enabled && !source.sources.console){
|
||||
bot.chat(ChatMessage.fromNotch([cmd, `Description: ${command.description}`]).toMotd().replaceAll('§', '&'))
|
||||
await sleep(1000)
|
||||
@@ -60,18 +64,17 @@ module.exports = {
|
||||
await sleep(1000)
|
||||
bot.chat(ChatMessage.fromNotch([cmd, `aliases: ${command.aliases}`]).toMotd().replaceAll('§', '&'))
|
||||
}else{
|
||||
source.sendFeedback([cmd, `Description: ${command.description}`])
|
||||
|
||||
source.sendFeedback([cmd, {text:`Trust Level: ${command.trustLevel}`}])
|
||||
|
||||
source.sendFeedback([cmd, `aliases: ${command.aliases}`])
|
||||
break
|
||||
|
||||
source.sendFeedback([cmd, {text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'#00ffff'},{text:`(${command.aliases}) › ${command.description}`,color:'dark_purple'}])
|
||||
source.sendFeedback([cmd,{text:`Trust Level: `,color:'#00ffff'},{text:`${command.trustLevel}`,color:'dark_purple'}])
|
||||
source.sendFeedback([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])
|
||||
|
||||
break
|
||||
}
|
||||
} else valid = false
|
||||
}
|
||||
|
||||
//source is defined btw
|
||||
//source.sendFeedback([cmd, 'This command is ' + valid + ' to this for loop'])
|
||||
|
||||
if (valid) {
|
||||
|
||||
} else {
|
||||
@@ -80,21 +83,17 @@ module.exports = {
|
||||
|
||||
source.sendFeedback([cmd, {translate: `Unknown command %s. Type "${bot.options.commands.prefixes[0]}help" for help or click on this for the command`,color:'red', with: [args[0]], clickEvent: bot.options.Core.customName ? { action: 'suggest_command', value: `${bot.options.commands.prefixes[0]}help` } : undefined}])
|
||||
|
||||
// bot.tellraw([cmd, {translate: `Unknown command %s. Type "${bot.options.commands.prefix}help" for help or click on this for the command`, with: [args[0]], clickEvent: bot.options.Core.customName ? { action: 'suggest_command', value: `${bot.options.commands.prefix}help`, color:'red' } : undefined}])
|
||||
}//i will add the descriptions reading as tests and action add the descriptions for the commands after
|
||||
const length = context.bot.commandManager.commandlist.length // ok
|
||||
//i guess i did delete smh woops
|
||||
|
||||
//context.source.sendFeedback([cmd, 'Commands (', length, ') ', category, ...commandList], false)
|
||||
|
||||
}
|
||||
} else {
|
||||
let pub_lick = []
|
||||
let t_rust = []
|
||||
let own_her = []
|
||||
let cons_ole = []
|
||||
for (const commands in bot.commandManager.commandlist) {
|
||||
const command = bot.commandManager.commandlist[commands]
|
||||
for (const commands in CommandManager.commandlist) {
|
||||
const command = CommandManager.commandlist[commands]
|
||||
|
||||
// if (command.consoleOnly == true) return console.log(command);
|
||||
|
||||
if(command.trustLevel === 3) {
|
||||
cons_ole.push(
|
||||
{
|
||||
@@ -128,7 +127,7 @@ module.exports = {
|
||||
else
|
||||
|
||||
if (command.trustLevel === 2) {
|
||||
if(!bot.options.Core.enabled && !source.sources.console){
|
||||
if(!bot.options.Core.enabled && !source.sources.console && !source.sources.discord){
|
||||
own_her.push(`&4${command.name + ' '}`)
|
||||
}else{
|
||||
|
||||
@@ -136,7 +135,7 @@ module.exports = {
|
||||
own_her.push(
|
||||
{
|
||||
text: command.name + ' ',
|
||||
color: 'dark_red',
|
||||
color: `${bot.helpTheme.own_herColor}`,
|
||||
|
||||
|
||||
translate:"",
|
||||
@@ -153,25 +152,23 @@ module.exports = {
|
||||
{text:'click on me to use me :)'},
|
||||
]
|
||||
},clickEvent:{
|
||||
action:"run_command",value:`${bot.options.commands.prefixes[0]}${command.name}`
|
||||
action:"run_command",value:`${bot.Commands.prefixes[0]}${command.name}`
|
||||
},
|
||||
// ${command.name}\nhashOnly:§c${command.hashOnly}§r\nconsoleOnly:§c${command.consoleOnly && !context.console}§r\n${command.description}
|
||||
|
||||
///tellraw @a {"translate":"","hoverEvent":{"action":"show_text","value":[{"text":""},{"text":""}]},"clickEvent":{"action":"run_command","value":"a"}}
|
||||
|
||||
|
||||
}
|
||||
)//my w
|
||||
)
|
||||
}
|
||||
}
|
||||
// let valid
|
||||
|
||||
else if (command.trustLevel === 1){
|
||||
if(!bot.options.Core.enabled && !source.sources.console){
|
||||
if(!bot.options.Core.enabled && !source.sources.console && !source.sources.discord){
|
||||
t_rust.push(`&5${command.name + ' '}`)
|
||||
}else {
|
||||
t_rust.push(
|
||||
{
|
||||
text: command.name + ' ',
|
||||
color: 'dark_purple',
|
||||
color:`${bot.helpTheme.t_rustedColor}`,
|
||||
|
||||
|
||||
translate:"",
|
||||
@@ -187,27 +184,24 @@ module.exports = {
|
||||
{text:'click on me to use me :)'},
|
||||
]
|
||||
},clickEvent:{
|
||||
action:"run_command",value:`${bot.options.commands.prefixes[0]}${command.name}`
|
||||
action:"run_command",value:`${bot.Commands.prefixes[0]}${command.name}`
|
||||
},
|
||||
// ${command.name}\nhashOnly:§c${command.hashOnly}§r\nconsoleOnly:§c${command.consoleOnly && !context.console}§r\n${command.description}
|
||||
|
||||
///tellraw @a {"translate":"","hoverEvent":{"action":"show_text","value":[{"text":""},{"text":""}]},"clickEvent":{"action":"run_command","value":"a"}}
|
||||
// clickEvent: command.name ? { action: 'suggest_command', value: `~${command.name}` },
|
||||
|
||||
|
||||
}
|
||||
)
|
||||
}
|
||||
//my w
|
||||
|
||||
}
|
||||
else if (command.trustLevel === 0){
|
||||
if (!bot.options.Core.enabled && !source.sources.console){
|
||||
if (!bot.options.Core.enabled && !source.sources.console && !source.sources.discord){
|
||||
pub_lick.push(`&b${command.name + ' '}`)
|
||||
} else{
|
||||
pub_lick.push(
|
||||
{
|
||||
text: command.name + ' ',
|
||||
color: '#00FFFF',
|
||||
translate:"",
|
||||
color: `${bot.helpTheme.pub_lickColor}`,
|
||||
|
||||
translate:"",
|
||||
hoverEvent:{
|
||||
action:"show_text", // Welcome to Kaboom!\n > Free OP - Anarchy - Creative (frfr)
|
||||
value:[
|
||||
@@ -222,7 +216,7 @@ module.exports = {
|
||||
{text:'click on me to use me :)'},
|
||||
]
|
||||
},clickEvent:{
|
||||
action:"suggest_command",value:`${bot.options.commands.prefixes[0]}${command.name}`}
|
||||
action:"suggest_command",value:`${bot.Commands.prefixes[0]}${command.name}`}
|
||||
|
||||
})
|
||||
|
||||
@@ -231,49 +225,45 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
return new Promise((resolve) => setTimeout(resolve, ms))
|
||||
}
|
||||
|
||||
// Use the sleep function with async/await
|
||||
/*async function main() {
|
||||
console.log("Before sleep");
|
||||
await sleep(1000); // Wait for one second
|
||||
console.log("After sleep");
|
||||
}
|
||||
*/
|
||||
const isConsole = context.source.player ? false : true
|
||||
|
||||
if(source.sources.console) {
|
||||
// mabe idk
|
||||
const length = context.bot.commandManager.commandlist.length
|
||||
if(source.sources.console && !source.sources.discord) {
|
||||
|
||||
bot.console.info(bot.getMessageAsPrismarine([cmd, 'Commands (', CommandManager.commandlist.length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole])?.toAnsi(), false)//[cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole]
|
||||
} else if(source.sources.discord&& !source.sources.console){
|
||||
|
||||
bot.console.info(bot.getMessageAsPrismarine([cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole])?.toAnsi(), false)//[cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole]
|
||||
} else if (!bot.options.Core.enabled) {
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor('#00FFFF')
|
||||
.setTitle('help Command')
|
||||
.setDescription(bot.getMessageAsPrismarine(['Commands (',JSON.stringify(CommandManager.commandlist.filter(c => c.trustLevel != 3).length),')'])?.toString())
|
||||
.addFields(
|
||||
{ name: 'Public Commands', value:`${bot.getMessageAsPrismarine(pub_lick)?.toString()}`},
|
||||
{ name: 'Trusted Commands', value: `${bot.getMessageAsPrismarine(t_rust)?.toString()}`, inline: true },
|
||||
{ name: 'Owner Commands', value: `${bot.getMessageAsPrismarine(own_her)?.toString()}`, inline: true },
|
||||
)
|
||||
bot?.discord?.Message?.reply({ embeds: [Embed] })
|
||||
|
||||
}else if (!bot.options.Core.enabled) {
|
||||
|
||||
const length = context.bot.commandManager.commandlist.filter(c => c.trustLevel != 3).length
|
||||
|
||||
|
||||
bot.chat('Commands (' + length + ') (&bPublic &f| &5Trusted &f| &4Owner&f)')
|
||||
await sleep(1000)
|
||||
bot.chat('Commands (' + JSON.stringify(length) + ') (&bPublic &f| &5Trusted &f| &4Owner&f)')
|
||||
await sleep(3000)
|
||||
bot.chat(`${pub_lick}`)
|
||||
await sleep(1000)
|
||||
await sleep(3000)
|
||||
bot.chat(`${t_rust}`)
|
||||
await sleep(1000)
|
||||
await sleep(3000)
|
||||
bot.chat(`${own_her}`)
|
||||
|
||||
|
||||
}else {//+ t_rust + own_her
|
||||
}else {
|
||||
const length = context.bot.commandManager.commandlist.filter(c => c.trustLevel != 3).length
|
||||
//trustlevel
|
||||
source.sendFeedback([cmd, 'Commands (', JSON.stringify(length), ') ', category, ...pub_lick, t_rust ,own_her], false)
|
||||
source.sendFeedback([cmd, 'Commands (', JSON.stringify(CommandManager.commandlist.filter(c => c.trustLevel != 3).length), ') ', category, ...pub_lick, t_rust ,own_her], false)
|
||||
}
|
||||
// bot.
|
||||
/*
|
||||
bot.tellraw([pub_lick])
|
||||
bot.tellraw([t_rust])
|
||||
bot.tellraw([own_her])
|
||||
*/
|
||||
//console.log(t_rust)
|
||||
}//
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
const CommandError = require("../CommandModules/command_error");
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const packageJSON = require("../package.json");
|
||||
const os = require('os');
|
||||
const date = new Date().toLocaleDateString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
module.exports = {
|
||||
name: "info",
|
||||
description: [
|
||||
"check the bots info",
|
||||
],
|
||||
aliases: ["information"],
|
||||
trustLevel: 0,
|
||||
usage:[
|
||||
"version",
|
||||
"invite",
|
||||
"server",
|
||||
"packages",
|
||||
"login",
|
||||
"config",
|
||||
"uptime",
|
||||
"contributors",
|
||||
],
|
||||
async execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source
|
||||
function format(seconds) {
|
||||
function pad(s) {
|
||||
return (s < 10 ? "0" : "") + s;
|
||||
}
|
||||
var hours = Math.floor(seconds / (60 * 60));
|
||||
var minutes = Math.floor((seconds % (60 * 60)) / 60);
|
||||
var seconds = Math.floor(seconds % 60);
|
||||
return (pad(`${hours} Hours`) + " " +
|
||||
pad(`${minutes} Minutes`) + " " +
|
||||
pad(`${seconds} Seconds`))
|
||||
}
|
||||
switch(args.join(' ').toLowerCase()) {
|
||||
case 'version':
|
||||
source.sendFeedback({text:`${process.env.buildstring}`})
|
||||
source.sendFeedback({text:`${process.env.FoundationBuildString}`})
|
||||
source.sendFeedback({text:`11/22/2022 - ${date}`})
|
||||
break
|
||||
case 'invites':
|
||||
source.sendFeedback({ text: 'Discord Invite', color: "dark_gray", translate: "", hoverEvent: { action: "show_text", value: [ { text: "click here to join!", color: "gray", }, ], }, clickEvent: { action: "open_url", value: `${bot.discord.invite}`, }, });
|
||||
source.sendFeedback({ text: 'Matrix Invite', color: "dark_gray", translate: "", hoverEvent: { action: "show_text", value: [ { text: "click here to join!", color: "gray", }, ], }, clickEvent: { action: "open_url", value: `${bot.matrix.invite}`, }, });
|
||||
break
|
||||
case 'server':
|
||||
source.sendFeedback({ color: "dark_gray", text: `Hostname \u203a ${os.hostname()}`, });
|
||||
source.sendFeedback({ color: "dark_gray", text: `Working Directory \u203a ${process.mainModule.path}`, });
|
||||
source.sendFeedback({ color: "dark_gray", text: `${os.arch()}`})
|
||||
source.sendFeedback({ color: "dark_gray", text:`OS \u203a ${os.platform()}`})
|
||||
source.sendFeedback({ color: "dark_gray", text: `OS Version/distro \u203a ${os.version()}`, });
|
||||
source.sendFeedback({ color: "dark_gray", text: `Kernal Version \u203a ${os.release()}`, });
|
||||
source.sendFeedback({ color: "dark_gray", text: `cores \u203a ${os.cpus().length}`, });
|
||||
source.sendFeedback({ color: "dark_gray", text: `CPU \u203a ${os.cpus()[0].model}`, });
|
||||
source.sendFeedback([{text:`Server Free memory `, color:'dark_gray'},{text:`${Math.floor( os.freemem() / 1048576, )} `,color:'dark_gray'},{text: `MiB / ${Math.floor(os.totalmem() / 1048576)} MiB`, color:'dark_gray'}]);
|
||||
source.sendFeedback({text:`Device uptime \u203a ${format(os.uptime())}`,color:'dark_gray'})
|
||||
source.sendFeedback({text:`Node version \u203a ${process.version}`,color:'dark_gray'})
|
||||
break
|
||||
case 'packages':
|
||||
// source.sendFeedback([{text:'Package Count \u203a ',color:'dark_gray'},{text:`${Object.keys(packageJSON.dependencies).length}`,color:'gold'}])
|
||||
source.sendFeedback([{text:'Packages \u203a ',color:'dark_gray'},{text:`${Object.entries(packageJSON.dependencies).map((key, value) => key + ' ' + value).join(' ')}`}])
|
||||
source.sendFeedback([{text:'Package Count \u203a ', color:'dark_gray'},{text:`${Object.keys(packageJSON.dependencies).length}`,color:'gold'}])
|
||||
break
|
||||
case 'login':
|
||||
source.sendFeedback({text:`Minecraft Username \u203a ${bot.options.username}`,color:'dark_gray'})
|
||||
source.sendFeedback({text: `uuid \u203a ${bot.uuid}`,color:'dark_gray'})
|
||||
if(bot.discord === undefined){
|
||||
source.sendFeedback({text:'Currently not logged into discord',color:'dark_red'})
|
||||
}else{
|
||||
source.sendFeedback({text:`Discord Username \u203a ${bot.discord.client.user.username + '#' + bot.discord.client.user.discriminator}`,color:'dark_gray'})
|
||||
}
|
||||
if (bot.matrix.client === undefined){
|
||||
source.sendFeedback({text:'Currently not logged into matrix',color:'dark_red'})
|
||||
}else{
|
||||
source.sendFeedback({text: `Matrix Username \u203a ${bot.matrix.client.credentials.userId}`,color:'dark_gray'})
|
||||
}
|
||||
source.sendFeedback({text:`Server \u203a ${bot.options.serverName}`,color:'dark_gray'})
|
||||
source.sendFeedback({text:`Server IP \u203a ${bot.options.host + ':' + bot.options.port}`,color:'dark_gray'})
|
||||
source.sendFeedback({text:`Version \u203a ${bot.options.version}`,color:'dark_gray'})
|
||||
break
|
||||
case 'config':
|
||||
source.sendFeedback({text:`Prefixes \u203a ${bot.Commands.prefixes}`,color:'dark_gray'})
|
||||
source.sendFeedback([{text:`Core enabled? `,color:'dark_gray'},{text:`${bot.options.Core.enabled}`,color:'gold'}])
|
||||
source.sendFeedback([{text:'Discord enabled? ',color:'dark_gray'},{text:`${bot.Discord.enabled}`,color:'gold'}])
|
||||
source.sendFeedback([{text:'Matrix enabled? ',color:'dark_gray'},{text:`${bot.matrix.enabled}`,color:'gold'}])
|
||||
source.sendFeedback([{text:'Console logging enabled? ',color:'dark_gray'},{text:`${bot.options.Console.enabled}`,color:'gold'}])
|
||||
source.sendFeedback([{text:'Chat filelogging enabled? ',color:'dark_gray'},{text:`${bot.Console.filelogging}`,color:'gold'}])
|
||||
source.sendFeedback([{text:'Multiconnect Server count \u203a ',color:'dark_gray'},{text:`${Object.keys(bot.bots).length}`,color:'gold'}])
|
||||
break
|
||||
case 'uptime':
|
||||
source.sendFeedback([{text:`${format(process.uptime())}`,color:'dark_gray'}])
|
||||
break
|
||||
case 'contributors':
|
||||
source.sendFeedback({ translate: "%s%s", with: [ { color: "dark_red", text: "Parker" }, { color: "black", text: "2991" }, ], hoverEvent: { action: "show_text", value: [ { text: "FNF", color: "dark_purple", bold: true, }, { text: "Boyfriend", color: "aqua", bold: true, }, { text: "Bot ", color: "dark_red", bold: true, }, { text: "Discord", color: "blue", bold: false, }, ], }, clickEvent: { action: "open_url", value: `${bot.Discord.invite}`, }, });
|
||||
source.sendFeedback({ text: "_ChipMC_", color: "dark_green", translate: "", hoverEvent: { action: "show_text", value: [ { text: "chipmunk dot land", color: "green", }, ], }, clickEvent: { action: "open_url", value: `https://chipmunk.land`, }, });
|
||||
source.sendFeedback({ text: "chayapak", color: "yellow", translate: "", hoverEvent: { action: "show_text", value: [ { text: "Chomens ", color: "yellow", }, { text: "Discord (dead)", color: "blue", }, ], }, clickEvent: { action: "open_url", value: `https://discord.gg/xdgCkUyaA4`, }, });
|
||||
source.sendFeedback({ text: "_yfd", color: "light_purple", translate: "", hoverEvent: { action: "show_text", value: [ { text: "ABot ", color: "gold", bold: true, }, { text: "Discord (gone)", color: "blue", bold: false, }, ], }, clickEvent: { action: "open_url", value: `https://discord.gg/CRfP2ZbG8T`, }, });
|
||||
source.sendFeedback({ text: "aaa", color: "gold" });
|
||||
break
|
||||
case 'thankyou':
|
||||
var prefix = "&8&l&m[&4&mParker2991&8]&8&m[&b&mBOYFRIEND&8]&8&m[&b&mCONSOLE&8]&r ";
|
||||
bot.core.run( "bcraw " + prefix + "Thank you for all that helped and contributed with the bot, it has been one hell of a ride with the bot hasnt it? From November 22, 2022 to now, 0.1 beta to 4.0 alpha, Mineflayer to Node-Minecraft-Protocol. I have enjoyed all the new people i have met throughout the development of the bot back to the days when the bot used mineflayer for most of its lifespan to the present as it now uses node-minecraft-protocol. Its about time for me to tell how development went in the bot well here it is, back in 0.1 beta of the bot it was skidded off of menbot 1.0 reason why? Well because LoginTimedout gave me the bot when ayunboom was still a thing and he helped throughout that time period bot and when 1.0 beta came around he he just stopped helping me on it why? because he had servers to run so yeah but anyway back then i didnt know what skidded like i do now so i thought i could get away with but i was wrong 💀. Early names considered for the bot were &6&lParkerBot &4&lDEMONBot &b&lWoomyBot &b&lBoyfriendBot,&r i kept the name &b&lBoyfriendBot&r throughout most of the early development but i got sick and tired of being harassed about the name being told it was gay but people really didnt know what it meant did they? It was referenced to Boyfriend from Friday Night Funkin’ so right around 1.0 released i renamed it to &b&lFNFBoyfriend&4&lBot &rand around 2.0 changed it to &5&lFNF&b&lBoyfriend&4&lBot &rand luckily avoided the harassment when i changed it i love coding and i want to learn how to code more thank you all!",)
|
||||
break
|
||||
default:
|
||||
source.sendError({text:'Invalid Argument!!'})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ module.exports = {
|
||||
name: 'kick',
|
||||
|
||||
description:['kicks a player'],
|
||||
|
||||
usage:["re fucking doing"],
|
||||
trustLevel: 1,
|
||||
aliases:[],
|
||||
execute(context) {
|
||||
@@ -39,4 +39,4 @@ function repeat(bot, repetitions, cmd) {
|
||||
for (let i = 0; i < repetitions; i++) {
|
||||
bot.core.run(cmd)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ module.exports = {
|
||||
description:['check the player list'],
|
||||
trustLevel: 0,
|
||||
aliases:['playerlist', 'plist', 'pl'],
|
||||
usage:[""],
|
||||
async execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
@@ -6,6 +6,10 @@ module.exports = {
|
||||
description:['check the bots memusage'],
|
||||
trustLevel: 0,
|
||||
aliases:['memoryusage', 'memused','memoryused'],
|
||||
usage:[
|
||||
"on",
|
||||
"off"
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const source = context.source
|
||||
@@ -35,4 +39,4 @@ module.exports = {
|
||||
// You should remove the with thing and the translate and replace
|
||||
|
||||
// Parker, why is hashing just random characters???
|
||||
//wdym
|
||||
//wdym
|
||||
@@ -11,7 +11,7 @@ const os = require('os')
|
||||
|
||||
let SONGS_PATH
|
||||
|
||||
if (os.hostname() === 'chomens-kubuntu') {
|
||||
if (os.hostname() === ':3') {
|
||||
SONGS_PATH = path.join(__dirname, '..', '..', 'nginx-html', 'midis')
|
||||
} else {
|
||||
SONGS_PATH = path.join(__dirname, '..', 'midis')
|
||||
@@ -138,10 +138,10 @@ async function list (bot, discord, channeldc, prefix, selector, args, config) {
|
||||
|
||||
module.exports = {
|
||||
name: 'music',
|
||||
description: 'Plays music usages:play <song|url>, stop, loop <all|current|off> list [directory], skip nowplaying queue',
|
||||
description: 'Plays music',
|
||||
aliases: [],
|
||||
trustLevel: 0,
|
||||
/* usage: [
|
||||
usage: [
|
||||
'play <song|url>',
|
||||
'stop',
|
||||
'loop <all|current|off>',
|
||||
@@ -149,11 +149,12 @@ module.exports = {
|
||||
'skip',
|
||||
'nowplaying',
|
||||
'queue'
|
||||
],*/
|
||||
],
|
||||
execute (context, selector, config) {
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
const prefix = bot.options.commands.prefixes[0]
|
||||
if (!bot.options.Core.enabled) throw new CommandError({text:':3'})
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
switch (args[0]) {
|
||||
case 'play':
|
||||
@@ -0,0 +1,62 @@
|
||||
const CommandError = require('../CommandModules/command_error.js')
|
||||
module.exports = {
|
||||
name: 'netmsg',
|
||||
description:['send a message to other servers'],
|
||||
trustLevel:0,
|
||||
aliases:['networkmessage'],
|
||||
usage:["<message>"],
|
||||
execute (context) {
|
||||
|
||||
const message = context.arguments.join(' ')
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
|
||||
//throw new CommandError('ohio')
|
||||
const component = {
|
||||
translate: '[%s] [%s] %s \u203a %s',
|
||||
with: [
|
||||
{
|
||||
translate: '%s%s%s',
|
||||
bold:false,
|
||||
with: [
|
||||
{
|
||||
text: 'FNF',
|
||||
bold: true,
|
||||
color: 'dark_purple'
|
||||
},
|
||||
{
|
||||
text: 'Boyfriend',
|
||||
bold: true,
|
||||
color: 'aqua'
|
||||
},
|
||||
{
|
||||
text: 'Bot',
|
||||
bold: true,
|
||||
color: 'dark_red'
|
||||
},
|
||||
],
|
||||
},
|
||||
bot.options.serverName,
|
||||
|
||||
context.source.player.displayName ?? context.source.player.profile.name,
|
||||
message
|
||||
]//command.split(' ')[0]
|
||||
}//string.replace()
|
||||
if (!message[0]) {
|
||||
context.source.sendFeedback({text:'Message is empty', color:'red'}, false)
|
||||
} else {
|
||||
for (const eachBot of bot.bots)
|
||||
if(!bot.options.Core.enabled){
|
||||
eachBot.chat(`[${bot.options.serverName}] ${bot.getMessageAsPrismarine(context.source.player.displayName ?? context.source.player.profile.name)?.toMotd().replaceAll('§','&')} \u203a ${message}`)
|
||||
}else{
|
||||
eachBot.tellraw(component)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
bot.options.host + ':' + bot.options.port,
|
||||
context.source.player.displayName ?? context.source.player.profile.name,
|
||||
message
|
||||
[%s%s%s] [%s] %s \u203a %s
|
||||
*/
|
||||
@@ -4,6 +4,7 @@ module.exports = {
|
||||
description:['refill the bots core'],
|
||||
trustLevel: 0,
|
||||
aliases:['refillcore'],
|
||||
usages:[""],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
|
||||
@@ -15,4 +16,4 @@ if (!bot.options.Core.enabled){
|
||||
context.source.sendFeedback('Successfully Refilled Core!')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ module.exports = {
|
||||
description:['reconnect the bot when?'],
|
||||
trustLevel: 1,
|
||||
aliases:['rec'],
|
||||
usage:[""],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
@@ -17,4 +18,4 @@ context.source.sendFeedback({ text: `Reconnecting to ${bot.options.host}:${bot.o
|
||||
}
|
||||
/*context.source.sendFeedback('farding right now....')
|
||||
process.exit(1)
|
||||
*/
|
||||
*/
|
||||
@@ -0,0 +1,19 @@
|
||||
module.exports = {
|
||||
name: 'reload',
|
||||
description:[],
|
||||
aliases:[],
|
||||
trustLevel: 0,
|
||||
usage:["reload"],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
try {
|
||||
source.sendFeedback({text:'Reloading commands,..........'});
|
||||
for (const eachBot of bot.bots)
|
||||
eachBot.reload()
|
||||
}catch(e){
|
||||
source.sendFeedback(e.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ module.exports = {
|
||||
"ssfbmsg",
|
||||
"ssfmessage",
|
||||
],
|
||||
usage:["<message>"],
|
||||
execute(context) {
|
||||
const message = context.arguments.join(" ");
|
||||
const bot = context.bot;
|
||||
@@ -4,6 +4,7 @@ module.exports = {
|
||||
description:['toggle the selfcare'],
|
||||
aliases:['selfcaretoggle'],
|
||||
trustLevel: 1,
|
||||
usage:["vanish","mute","god","tptoggle","nickname","username","cspy","skin","gmc","op","prefix","on/off/true/false"],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
@@ -8,6 +8,7 @@ module.exports = {
|
||||
trustLevel: 2,
|
||||
aliases:['sfd'],
|
||||
description:['selfdestruct server'],
|
||||
usage:[""],
|
||||
execute (context) {
|
||||
//throw new CommandError('temp disabled')
|
||||
|
||||
@@ -4,6 +4,7 @@ module.exports = {
|
||||
description:['no'],
|
||||
trustLevel: 2,
|
||||
aliases:['svreval'],
|
||||
usage:["<code>"],
|
||||
async execute (context, arguments, selector) {
|
||||
const bot = context.bot
|
||||
// const args = context.arguments.join(' ')
|
||||
@@ -18,7 +19,8 @@ const source = context.source
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4] ) return
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}//ChatMessage.fromNotch(await sleep(500) ).toMotd().replaceAll('§', '&')`
|
||||
}//ChatMessage.fromNotch(await sleep(500) ).toMotd().replaceAll('§', '&')
|
||||
//if
|
||||
try {
|
||||
if(source.sources.console){
|
||||
bot.console.info({ text: util.inspect(eval(args.slice(0).join(' ')), { stylize }).substring(0, 32700) })
|
||||
@@ -52,4 +54,4 @@ bot.console.warn({ text: err.message, color: 'red' })
|
||||
} catch (err) {
|
||||
bot.tellraw({ text: util.inspect(err).replaceAll('runner', 'runner'), color: 'red' })
|
||||
}
|
||||
*/
|
||||
*/
|
||||
@@ -3,6 +3,7 @@ module.exports = {
|
||||
name: 'soundbreaker',
|
||||
description:["make peoples ears bleed"],
|
||||
aliases:["earpierce","earhell"],
|
||||
usage:[""],
|
||||
trustLevel:1,
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
@@ -0,0 +1,17 @@
|
||||
module.exports = {
|
||||
name: 'theme',
|
||||
description:['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'],
|
||||
aliases:[],
|
||||
trustLevel: 0,
|
||||
usage:[":3"],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
|
||||
if (message.startsWith('/')) {
|
||||
bot.command(message.substring(1))
|
||||
return
|
||||
}
|
||||
bot.chat(message)
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,8 @@ module.exports = {
|
||||
name: 'time',
|
||||
description:['check the time'],
|
||||
aliases:['clock', 'timezone'],
|
||||
hashOnly:false,
|
||||
consoleOnly:false,
|
||||
ownerOnly:false,
|
||||
trustLevel:0,
|
||||
usage:["timezone"],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
@@ -5,6 +5,7 @@ module.exports = {
|
||||
description:['teleport to a random place'],
|
||||
trustLevel: 0,
|
||||
aliases:['rtp', 'teleportrandom', 'randomteleport'],
|
||||
usage:[""],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const sender = context.source.player
|
||||
@@ -22,4 +23,4 @@ if (!bot.options.Core.enabled){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,27 +6,23 @@ module.exports = {
|
||||
description:['tps'],
|
||||
trustLevel: 0,
|
||||
aliases:['tickspersecondbar', 'tickspersecond', 'tps'],
|
||||
usage:["on","off"],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
switch (args[0]) {
|
||||
case 'on':
|
||||
if(!bot.options.Core.enabled){
|
||||
throw new CommandError('Coreless mode is active can not execute command!')
|
||||
}else{
|
||||
bot.tps.on()
|
||||
case 'on':
|
||||
bot.tps.on()
|
||||
|
||||
source.sendFeedback({text: 'TPSBar is now enabled', color:'green'})
|
||||
}
|
||||
|
||||
break
|
||||
case 'off':
|
||||
if(!bot.options.Core.enabled){
|
||||
throw new CommandError('Coreless mode is active can not execute command!')
|
||||
}else{
|
||||
|
||||
bot.tps.off()
|
||||
source.sendFeedback({text:'TPSBar is now disabled', color:'red'})
|
||||
}
|
||||
|
||||
break
|
||||
default:
|
||||
throw new CommandError('Invalid argument')
|
||||
@@ -41,4 +37,4 @@ module.exports = {
|
||||
// You should remove the with thing and the translate and replace
|
||||
|
||||
// Parker, why is hashing just random characters???
|
||||
//wdym
|
||||
//wdym
|
||||
@@ -0,0 +1,39 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
|
||||
module.exports = {
|
||||
name: 'translate',
|
||||
//<< this one line of code broke it lmao
|
||||
usage:['<language 1> <message>'],
|
||||
aliases:['translation'],
|
||||
trustLevel: 0,
|
||||
description:["translate languages"],
|
||||
async execute (context) {
|
||||
const { translate } = require('@vitalets/google-translate-api')
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
const { HttpProxyAgent } = require('http-proxy-agent');
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
try {
|
||||
const agent = new HttpProxyAgent('http://103.152.112.162:80');
|
||||
const { text } = await translate(`${args.slice(1).join(' ')}`, {
|
||||
to: 'args[0]',
|
||||
fetchOptions: {agent}
|
||||
});
|
||||
source.sendFeedback([{text:'Result \u203a '},{text:`${text}`,color:'gold'}])
|
||||
}catch(e){
|
||||
//if (e.name === 'TooManyRequestsError') {
|
||||
// source.sendFeedback({text:'reconnecting proxy'})
|
||||
//}else{
|
||||
bot.tellraw(`${e}`)
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
//[%s] %s › %s
|
||||
//was it showing like that before?
|
||||
// just do text bc too sus rn ig
|
||||
// You should remove the with thing and the translate and replace
|
||||
|
||||
// Parker, why is hashing just random characters???
|
||||
//wdym
|
||||
@@ -5,6 +5,7 @@ let timer = null
|
||||
module.exports = {
|
||||
name: 'troll',
|
||||
trustLevel:1,
|
||||
usage:[""],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const source = context.source
|
||||
@@ -5,6 +5,7 @@ module.exports = {
|
||||
description:['urban dictionary'],
|
||||
aliases:['urbandictionary'],
|
||||
trustLevel: 0,
|
||||
usage:["re fucking doing"],
|
||||
async execute (context) {
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
@@ -94,4 +95,4 @@ bot.chat(ChatMessage.fromNotch(await sleep(2300)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ module.exports = {
|
||||
|
||||
trustLevel: 1,
|
||||
aliases:['val'],
|
||||
usage:["hash"],
|
||||
execute (context) {
|
||||
const source = context.source
|
||||
const bot = context.bot
|
||||
@@ -33,4 +34,4 @@ const hash = bot.hash
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (args[0] === hash) {
|
||||
//if (args[0] === hash) {
|
||||
@@ -3,6 +3,7 @@ module.exports = {
|
||||
description:['check the weather in a location via zip code or city name'],
|
||||
aliases:[],
|
||||
trustLevel: 0,
|
||||
usage:["redoing mabe"],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
@@ -3,9 +3,10 @@ const CommandError = require('../CommandModules/command_error')
|
||||
//const fetch = import("node-fetch");
|
||||
module.exports = {
|
||||
name: 'website',
|
||||
trustLevel:1,
|
||||
trustLevel:0,
|
||||
aliases:['web','websitedata','webdata'],
|
||||
description:['check website data'],
|
||||
usage:["<url"],
|
||||
async execute (context) {
|
||||
try{
|
||||
const fetch = require("node-fetch");
|
||||
@@ -14,7 +15,7 @@ const source = context.source
|
||||
const message = context.arguments.join(' ')
|
||||
const args = context.arguments
|
||||
if (!args && !args[0] && !args[1] && !args[2]) return
|
||||
const response = await fetch(args[1]);
|
||||
const response = await fetch(args[0]);
|
||||
const body = await response.text();
|
||||
|
||||
bot.tellraw({text:body,color:'green'})
|
||||
@@ -26,4 +27,4 @@ bot.tellraw({text:body,color:'green'})
|
||||
source.sendFeedback({text:e.toString(), color:'dark_red'})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
const wiki = require('wikipedia') //
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
module.exports = {
|
||||
name: 'wiki',
|
||||
description:['wikipedia'],
|
||||
trustLevel: 0,
|
||||
aliases:['wikipedia'],
|
||||
usage:["<definition"],
|
||||
async execute (context) {
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
|
||||
try {
|
||||
const page = await wiki.page(args.join(' '))
|
||||
// source.sendFeedback({text:`${page.html()}`,color:'dark_gray'})
|
||||
const summary = await page.intro();
|
||||
source.sendFeedback({text:`${summary}`,color:'dark_gray'});
|
||||
|
||||
} catch (error) {
|
||||
if(error.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')"){
|
||||
source.sendFeedback({text:'Definition not found!',color:'dark_red'})
|
||||
}
|
||||
// source.sendFeedback(error.toString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
{
|
||||
module.exports = {
|
||||
Commands:{
|
||||
prefixes:['!']
|
||||
//since the prefix array doesnt have a set number more prefixes can be set
|
||||
},
|
||||
Core:{
|
||||
|
||||
JSON:``,//needs to be a valid json
|
||||
area:{
|
||||
start:{ x: 0, y: 0, z: 0 },
|
||||
end:{ x: 15, y: 0, z: 15 },
|
||||
}
|
||||
},
|
||||
|
||||
tellrawTag:{
|
||||
fnftellraw:{text:"FNF",color:"dark_purple"},
|
||||
boyfriendtellraw:{text:"Boyfriend",color:"#00FFFF"},
|
||||
bottellraw:{text:"Bot",color:"dark_red"},
|
||||
},
|
||||
helpTheme:{
|
||||
pub_lickColor:"#00FFFF",
|
||||
t_rustedColor:"dark_purple",
|
||||
own_herColor:"dark_red",
|
||||
},
|
||||
Discord: {
|
||||
enabled:false,
|
||||
invite: "https://discord.gg/GCKtG4erux",
|
||||
commandPrefix: "!",
|
||||
presence:{
|
||||
name:'', //set status text here
|
||||
type:4,
|
||||
status:'dnd',//status here
|
||||
}
|
||||
},
|
||||
console:{
|
||||
filelogging:false,
|
||||
prefix:'c.',
|
||||
},
|
||||
bots: [
|
||||
{
|
||||
host: "localhost",
|
||||
username:username(),
|
||||
version:"1.20.2",
|
||||
serverName:'localhost',
|
||||
reconnectDelay: 6000,
|
||||
endcredits:false,
|
||||
Console:{
|
||||
enabled:false,
|
||||
ratelimit:10,
|
||||
},
|
||||
|
||||
Core: {
|
||||
enabled: true,
|
||||
interval:180000
|
||||
},
|
||||
discord: {
|
||||
channelId: "",//discord channel id here
|
||||
},
|
||||
matrix:{
|
||||
roomId:'',//matrix room id here
|
||||
},
|
||||
selfcare: {
|
||||
vanished: false,
|
||||
unmuted: false,
|
||||
prefix: false,
|
||||
cspy: false,
|
||||
tptoggle:false,
|
||||
skin:false,
|
||||
gmc:false,
|
||||
op:false,
|
||||
nickname:false,
|
||||
username:false,
|
||||
god: false,
|
||||
interval:500,
|
||||
}
|
||||
},
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function username() {
|
||||
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; // remove sus characters like ` or like ( or whatever because it breaks whatever
|
||||
let username = '';
|
||||
for (let i = 0; i < 9; i++) {
|
||||
const randomIndex = Math.floor(Math.random() * characters.length);
|
||||
username += characters[randomIndex];
|
||||
}
|
||||
return username;
|
||||
}
|
||||
}
|
||||
+23
-2
@@ -1,3 +1,4 @@
|
||||
const CommandError = require('./CommandModules/command_error.js')
|
||||
const util = require("util");
|
||||
const createBot = require("./bot.js");
|
||||
// TODO: Load a default config
|
||||
@@ -18,20 +19,35 @@ function load() {
|
||||
|
||||
require("dotenv").config();
|
||||
const bots = [];
|
||||
const core = config.Core
|
||||
const commands = config.Commands;
|
||||
const Console = config.console;
|
||||
const tellrawtag = config.tellrawTag
|
||||
const helptheme = config.helpTheme
|
||||
const discord = config.Discord
|
||||
const matrix = config.matrix
|
||||
for (const options of config.bots) {
|
||||
const bot = createBot(options);
|
||||
bots.push(bot);
|
||||
bot.bots = bots;
|
||||
bot.Core = core;
|
||||
bot.Commands = commands;
|
||||
bot.Console = Console;
|
||||
bot.Discord = discord;
|
||||
bot.tellrawTag = tellrawtag;
|
||||
bot.helpTheme = helptheme;
|
||||
bot.matrix = matrix
|
||||
|
||||
bot.options.username;
|
||||
|
||||
bot.loadModule = (module) => module(bot, options);
|
||||
bot.loadModule = (module) => module(bot, options);
|
||||
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, "modules"))) {
|
||||
try {
|
||||
const module = require(path.join(__dirname, "modules", filename));
|
||||
bot.loadModule(module);
|
||||
} catch (error) {
|
||||
console.error(
|
||||
console.log(
|
||||
"Failed to load module",
|
||||
filename,
|
||||
":",
|
||||
@@ -52,6 +68,11 @@ function load() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
process.on("uncaughtException", (e) => {
|
||||
console.log(e.stack)
|
||||
});
|
||||
|
||||
async function checkConfig() {
|
||||
if (!(await fileExist(path.join(__dirname, "config.js")))) {
|
||||
console.error("Config not found! Creating a new Config from ");
|
||||
@@ -0,0 +1,6 @@
|
||||
a
|
||||
m
|
||||
o
|
||||
g
|
||||
u
|
||||
s
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -6,6 +6,7 @@ const convert = require('color-convert')
|
||||
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
const timer = setInterval(() => {
|
||||
if (bot.bruhifyText === '') return
|
||||
|
||||
let tag = 'bruhify'
|
||||
let hue = startHue
|
||||
const displayName = bot.bruhifyText
|
||||
@@ -6,7 +6,7 @@ function chat_command_handler(bot) {
|
||||
bot.on("parsed_message", (data) => {
|
||||
if (data.type !== "minecraft:chat") return;
|
||||
|
||||
const prefixes = bot.options.commands.prefixes;
|
||||
const prefixes = bot.Commands.prefixes;
|
||||
|
||||
prefixes.map((prefix) => {
|
||||
const plainMessage = bot
|
||||
@@ -18,14 +18,10 @@ function chat_command_handler(bot) {
|
||||
/*
|
||||
lifes sus
|
||||
*/
|
||||
const source = new CommandSource(
|
||||
data.sender,
|
||||
{ discord: false, console: false }, //
|
||||
|
||||
);
|
||||
const source = new CommandSource(data.sender,{ discord: false, console: false,matrix:false },);
|
||||
source.sendFeedback = (message) => {
|
||||
const prefix = {
|
||||
translate: "[%s%s%s] \u203a ",
|
||||
translate: "%s%s%s \u203a ",
|
||||
bold: false,
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
@@ -0,0 +1,7 @@
|
||||
function chatDelay (bot,options, ms){
|
||||
bot.chatDelay = function delay(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
}
|
||||
module.exports = chatDelay;
|
||||
@@ -3,8 +3,8 @@ async function command_core (bot, options) {
|
||||
bot.core = {
|
||||
// what you think im doing? look at line 17
|
||||
area: {
|
||||
start: options.core?.area.start ?? { x: 0, y: 0, z: 0 },
|
||||
end: options.core?.area.end ?? { x: 15, y: 0, z: 15 }
|
||||
start: bot.Core.area.start ?? { x: 0, y: 0, z: 0 },
|
||||
end: bot.Core.area.end ?? { x: 15, y: 0, z: 15 }
|
||||
},
|
||||
position: null,
|
||||
currentBlockRelative: { x: 0, y: 0, z: 0 },
|
||||
@@ -15,7 +15,7 @@ async function command_core (bot, options) {
|
||||
|
||||
if (!pos) return
|
||||
|
||||
bot.command(`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: '{"text":"${bot.options.Core.customName}","color":"#00FFFF","clickEvent":{"action":"open_url","value":"https://chipmunk.land"}}'} destroy`)
|
||||
bot.command(`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${bot.Core.JSON} destroy`)
|
||||
|
||||
},
|
||||
|
||||
@@ -62,14 +62,16 @@ async function command_core (bot, options) {
|
||||
run (command) {
|
||||
const location = bot.core.currentBlock()
|
||||
if (!location) return
|
||||
|
||||
if (!bot.options.Core.enabled) {
|
||||
bot.command(command.substring(0,255))
|
||||
}else{
|
||||
bot._client.write('update_command_block', { command: command.substring(0, 32767), location, mode: 1, flags: 0b100 })
|
||||
|
||||
bot.core.incrementCurrentBlock()
|
||||
|
||||
// added .substring(0, 32767) so it won't kick the bot if the command is too long.
|
||||
},
|
||||
|
||||
}
|
||||
},
|
||||
}
|
||||
/*
|
||||
bot.on('parsed_message', data => {
|
||||
@@ -0,0 +1,25 @@
|
||||
function command_loop_manager (bot, options) {
|
||||
bot.cloop = {
|
||||
list: [],
|
||||
add (command, interval, list = true) {
|
||||
const id = setInterval(() => bot.core.run(command), interval)
|
||||
|
||||
const thingsToPush = { id, interval, command, list }
|
||||
bot.cloop.list.push(thingsToPush)
|
||||
|
||||
return thingsToPush
|
||||
},
|
||||
remove (item) {
|
||||
clearInterval(bot.cloop.list[item].id)
|
||||
|
||||
bot.cloop.list.splice(item, 1)
|
||||
},
|
||||
clear () {
|
||||
for (const interval of bot.cloop.list) clearInterval(interval.id)
|
||||
|
||||
bot.cloop.list = []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = command_loop_manager
|
||||
@@ -1,105 +1,77 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const CommandError = require("../CommandModules/command_error.js");
|
||||
const { PermissionsBitField, Client, Events, GatewayIntentBits } = require('discord.js');
|
||||
//check command_source
|
||||
//it would be both the command_source.js and command_manager.js files
|
||||
async function command_manager(bot, options) {
|
||||
const time = new Date().toLocaleTimeString("en-US", {timeZone: "America/CHICAGO",});
|
||||
const date = new Date().toLocaleDateString("en-US", {timeZone: "America/CHICAGO",});
|
||||
const {EmbedBuilder } = require('discord.js')
|
||||
/*async*/ function command_manager(bot, options) {
|
||||
bot.commandManager = {
|
||||
commands: {},
|
||||
commandlist: [],
|
||||
//ohio
|
||||
execute(source, commandName, args, message) {
|
||||
const command = this.getCommand(commandName.toLowerCase());
|
||||
//Unknown command. Type "/help" for help
|
||||
const now = new Date().toLocaleString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
const player = source?.player?.profile?.name;
|
||||
const uuid = source?.player?.uuid;
|
||||
try {
|
||||
|
||||
|
||||
if(source.sources.console && !source.sources.discord){
|
||||
if (!command || !command.execute) {
|
||||
bot.console.warn({text:`Unknown Command ${commandName}. type "${bot.options.Console.prefix}help" for help`,color:'dark_red'})
|
||||
}
|
||||
}else if(source.sources.discord && !source.sources.console) {
|
||||
if (!command || !command.execute) {
|
||||
throw new CommandError(`Unknown Command ${commandName}. Type "${bot.options.discord.commandPrefix}help" for help`)
|
||||
}
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor('#FF0000')
|
||||
.setTitle('Unknown Command')
|
||||
.setDescription(`Unknown Command ${commandName}. type "${bot.discord.commandPrefix}help" for help`)
|
||||
bot.discord.channel.send({ embeds: [Embed] })
|
||||
}
|
||||
}else if(!source.sources.discord && !source.sources.console) {
|
||||
if (!bot.options.Core.enabled){
|
||||
if (!command || !command.execute) {
|
||||
throw new CommandError(`Unknown command ${commandName}. Type "${bot.options.commands.prefixes[0]}help" for help`)
|
||||
throw new CommandError(`Unknown command ${commandName}. Type "${bot.Commands.prefixes[0]}help" for help`)
|
||||
}
|
||||
}else{
|
||||
if (!command || !command.execute) { // bot.options.command.prefixes[0]
|
||||
throw new CommandError({ // sus
|
||||
translate: `Unknown command %s. Type "${bot.options.commands.prefixes[0]}help" for help or click on this for the command`,
|
||||
with: [commandName],
|
||||
translate: `Unknown command %s. Type "${bot.Commands.prefixes[0]}help" for help or click on this for the command`,
|
||||
/*
|
||||
with: [commandName],
|
||||
clickEvent: 'https://discord.gg'
|
||||
|
||||
? {//fr
|
||||
// theme moment
|
||||
? {/
|
||||
*/
|
||||
with: [commandName],
|
||||
clickEvent:'https://discord.gg'
|
||||
? {
|
||||
action: "suggest_command",
|
||||
value: `${bot.options.commands.prefixes[0]}help`,
|
||||
value: `${bot.Commands.prefixes[0]}help`,
|
||||
}
|
||||
: undefined,
|
||||
}); //ohio
|
||||
}
|
||||
}
|
||||
}
|
||||
const event = bot?.discord?.Message
|
||||
|
||||
const roles = event?.member?.roles?.cache
|
||||
if (command?.trustLevel > 0) {
|
||||
|
||||
const event = source.discordMessageEvent
|
||||
|
||||
const roles = message?.member?.roles?.cache
|
||||
if(command?.trustLevel === 1 && !source?.sources?.discord && !source?.sources?.console){
|
||||
const hash = `${args[0]}`
|
||||
|
||||
if (
|
||||
|
||||
source.sources.discord &&
|
||||
command.trustLevel === 1 &&
|
||||
if(args.length === 0 && bot.hash && bot.owner && bot.hashing.hash) throw new CommandError([{text:'Please provide an ',color:'gray'},{text:'Trusted ',color:'dark_purple'},{text:'hash or an ',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}])
|
||||
if (hash !== bot.hash && hash !== bot.owner && hash !== bot.hashing.hash) throw new CommandError([{text:'Invalid ',color:'gray'},{text:'Trusted ',color:'dark_purple'},{text:'hash or Invalid ',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}])
|
||||
|
||||
!roles?.some((role) => role.name === 'Trusted' || role.name === 'FNFBoyfriendBot Owner')
|
||||
)
|
||||
throw new CommandError({
|
||||
text: "You are not Trusted!",
|
||||
color: "red",
|
||||
});
|
||||
} else if (command.trustLevel === 1 && source.sources.discord && !source.sources.console) {
|
||||
|
||||
|
||||
const hasRole = roles?.some(role => role.name === 'trusted' || role.name === 'FNFBoyfriendBot Owner')
|
||||
|
||||
|
||||
|
||||
if (
|
||||
!source?.sources?.discord &&
|
||||
!source?.sources?.console &&
|
||||
command.trustLevel === 1 &&
|
||||
args[0] !== bot.hash &&
|
||||
args[0] !== bot.owner &&
|
||||
args[0] !== bot.hashing.hash
|
||||
) if (!bot.options.Core.enabled){
|
||||
|
||||
throw new CommandError('&4Invalid Hash or Invalid Owner Hash')
|
||||
// throw new CommandError('')
|
||||
}else{
|
||||
throw new CommandError({
|
||||
text: "Invalid Hash or Invalid Owner Hash",
|
||||
color: "red",
|
||||
});
|
||||
}
|
||||
bot.hashing.updateHash();
|
||||
const now = new Date().toLocaleString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
const player = source?.player?.profile?.name;
|
||||
const uuid = source?.player?.uuid;
|
||||
const time = new Date().toLocaleTimeString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
const date = new Date().toLocaleDateString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
|
||||
if (!hasRole) throw new CommandError({ translate: 'You are not trusted!' })
|
||||
}
|
||||
bot?.hashing?.updateHash();
|
||||
|
||||
bot.console.hash = function (error, source) {
|
||||
console.log(
|
||||
`<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` +
|
||||
@@ -124,55 +96,39 @@ throw new CommandError({
|
||||
bot.console.hash();
|
||||
} else if (args[0] === bot.owner) {
|
||||
bot.console.ownerHash();
|
||||
}
|
||||
if (
|
||||
source?.sources?.discord &&
|
||||
command.trustLevel === 2 &&
|
||||
!roles?.some((role) => role.name === "FNFBoyfriendBot Owner")
|
||||
)
|
||||
|
||||
throw new CommandError({
|
||||
text: "You are not the Owner!",
|
||||
color: "dark_red",
|
||||
});
|
||||
const owner = `${args[0]}`;
|
||||
if (
|
||||
!source?.sources?.discord &&
|
||||
!source?.sources?.console &&
|
||||
command.trustLevel === 2 &&
|
||||
owner !== bot.owner
|
||||
)
|
||||
if (!bot.options.Core.enabled){
|
||||
|
||||
throw new CommandError('&4Invalid Owner Hash')
|
||||
}else{
|
||||
throw new CommandError({
|
||||
text: "Invalid Owner Hash",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
}
|
||||
if(command?.trustLevel === 2 && !source?.sources?.discord && !source?.sources?.console){
|
||||
const owner = `${args[0]}`
|
||||
|
||||
if(args.length === 0 && bot.owner) throw new CommandError([{text:'Please provide a ',color:'red',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}])
|
||||
if(owner === bot.hash && owner === bot.hashing.hash) throw new CommandError([{text:"THATS A ",color:'gray'},{text:'TRUSTED ',color:'dark_purple'},{text:'HASH AFAIK',color:'gray'}])
|
||||
if (owner !== bot.owner) throw new CommandError([{text:"Invalid ",color:'gray'},{text:'Owner ',color:'dark_red'},{text:'Hash',color:'gray'}])
|
||||
|
||||
} else if (command.trustLevel === 2 && source.sources.discord && !source.sources.console) {
|
||||
// const events = source.discordMessageEvent
|
||||
|
||||
// const roless = events?.member?.roles?.cache
|
||||
|
||||
const hasRole = roles?.some(role => role.name === 'FNFBoyfriendBot Owner')
|
||||
|
||||
if (!hasRole) throw new CommandError({ translate: 'You are the Owner!' })
|
||||
}
|
||||
if (command.trustLevel === 3 && !source?.sources?.console)
|
||||
if(!bot.options.Core.enabled){
|
||||
throw new CommandError('&9This command can only be execute via console')
|
||||
}else{
|
||||
throw new CommandError({
|
||||
translate: "This command can only be executed via console",
|
||||
color: "blue",
|
||||
});
|
||||
}
|
||||
|
||||
throw new CommandError({translate: "This command can only be executed via console",color: "blue",});
|
||||
}
|
||||
|
||||
return command?.execute({ bot, source, arguments: args });
|
||||
} catch (error) {
|
||||
const now = new Date().toLocaleString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
bot.console.warn(error.stack);
|
||||
|
||||
if (!bot.options.Core.enabled){
|
||||
if (!bot.options.Core.enabled){
|
||||
if (error instanceof CommandError)
|
||||
bot.chat(error._message)
|
||||
else bot.chat('a error has occured!')
|
||||
} else {
|
||||
bot.chat(bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&'))
|
||||
else bot.chat(bot.getMessageAsPrismarine('an error has occured please check console')?.toMotd().replaceAll('§','&'))
|
||||
} else if(!source.sources.discord && !source.sources.console) {
|
||||
if (error instanceof CommandError)
|
||||
source.sendError(error._message)
|
||||
else source.sendError({
|
||||
@@ -185,17 +141,26 @@ throw new CommandError({
|
||||
|
||||
|
||||
|
||||
if (source.sources.discord) {
|
||||
source.sendError(error);
|
||||
}
|
||||
else if (source.sources.discord && !source.sources.console) {
|
||||
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor('#FF0000')
|
||||
.setTitle('Uh oh i went to get the 🥛 give me :cancer: years to come back with it')
|
||||
.setDescription(`\`\`\`${error}\`\`\``)
|
||||
bot.discord.channel.send({ embeds: [Embed] })
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
executeString(source, command) {
|
||||
const [commandName, ...args] = command.split(" ");
|
||||
return this.execute(source, commandName, args);
|
||||
|
||||
return this.execute(source, commandName, args)
|
||||
|
||||
},
|
||||
|
||||
|
||||
register(command) {
|
||||
this.commands[command.name] = command;
|
||||
|
||||
@@ -209,9 +174,10 @@ throw new CommandError({
|
||||
|
||||
getCommands() {
|
||||
return Object.values(this.commands);
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
//
|
||||
|
||||
commandlist = [];
|
||||
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, "../commands"))) {
|
||||
@@ -224,7 +190,7 @@ throw new CommandError({
|
||||
}
|
||||
|
||||
if (process.env["anti-skid"] !== "amogus is sus") {
|
||||
process.exit(0);
|
||||
//process.exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
const CommandSource = require("../CommandModules/command_source");
|
||||
// idk if it's modules or utils though
|
||||
//modules is automatically loaded
|
||||
const prismarine = require('prismarine-chat')('1.20.2')
|
||||
function Console(bot, options, context, source) {
|
||||
let ratelimit = 0
|
||||
bot.console = {
|
||||
@@ -13,12 +12,12 @@ function Console(bot, options, context, source) {
|
||||
|
||||
rl.on("line", (line) => {
|
||||
if (
|
||||
bot.options.host !== this.consoleServer &&
|
||||
bot.options.serverName !== this.consoleServer &&
|
||||
this.consoleServer !== "all"
|
||||
)
|
||||
return;
|
||||
|
||||
if (line.startsWith(`${bot.options.Console.prefix}`)) {
|
||||
if (line.startsWith(`${bot.Console.prefix}`)) {
|
||||
return bot.commandManager.executeString(
|
||||
bot.console.source,
|
||||
|
||||
@@ -37,7 +36,7 @@ function Console(bot, options, context, source) {
|
||||
// what does it have to be
|
||||
|
||||
if (line.startsWith("")) {
|
||||
if(bot.options.Core.CorelessMode){
|
||||
if(!bot.options.Core.enabled){
|
||||
|
||||
return bot.commandManager.executeString(
|
||||
bot.console.source,
|
||||
@@ -74,21 +73,19 @@ function Console(bot, options, context, source) {
|
||||
}
|
||||
|
||||
bot.console.warn = function (error) {
|
||||
log(prefix + `[\x1b[0m\x1b[93mWARN\x1b[0m]: ${bot.getMessageAsPrismarine(error)?.toAnsi()}`);
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'dark_purple'},{text:`${date}`,color:'#00FFFF'},{text:' WARN',color:'yellow'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(error)?.toAnsi());
|
||||
};
|
||||
bot.console.error = function (error) {
|
||||
log(prefix + `[\x1b[0m\x1b[31mERROR\x1b[0m]: ${error}`);
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'dark_purple'},{text:`${date}`,color:'#00FFFF'},{text:' ERROR',color:'dark_red'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(error)?.toAnsi());
|
||||
};
|
||||
|
||||
bot.console.info = function (message) {
|
||||
log(prefix + `[\x1b[0m\x1b[32mInfo\x1b[0m]: ` + bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'dark_purple'},{text:`${date}`,color:'#00FFFF'},{text:' INFO',color:'green'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(message)?.toAnsi());
|
||||
};
|
||||
bot.console.log = function (message, ansi) {
|
||||
log(prefix + `[\x1b[0m\x1b[33mLOGS\x1b[0m]: ` + bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
};
|
||||
bot.console.debug = function (message, ansi) {
|
||||
log(prefix + `[\x1b[0m\x1b[33mDEBUG\x1b[0m]: ` + bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'dark_purple'},{text:`${date}`,color:'#00FFFF'},{text:' LOGS',color:'gold'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + message);
|
||||
};
|
||||
|
||||
|
||||
/* const ansimap = {
|
||||
0: '\x1b[0m\x1b[30m',
|
||||
@@ -122,9 +119,7 @@ function Console(bot, options, context, source) {
|
||||
bot.console.source.sendFeedback = (message) => {
|
||||
|
||||
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi();
|
||||
|
||||
if (!bot.options.Console.input) return;
|
||||
if (!bot.options.Console.enabled) return;
|
||||
if (!bot.options.Console) return;
|
||||
bot.console.info(ansi);
|
||||
};
|
||||
|
||||
@@ -179,48 +174,24 @@ function Console(bot, options, context, source) {
|
||||
setTimeout(() => {
|
||||
ratelimit--
|
||||
}, 1000)
|
||||
if (ratelimit > 35) { // ,.
|
||||
if (ratelimit > bot.options.Console.ratelimit) { // ,.
|
||||
|
||||
// bot.console.logs = function () {}
|
||||
bot._client.end("Anti spam :3")
|
||||
} else {
|
||||
//bot.console.log(`${ansi}`);
|
||||
//oh real
|
||||
|
||||
//can i change the variable name so its name isnt confusing?
|
||||
|
||||
bot.console.logs(`${ansi}`);
|
||||
bot.console.log(`${ansi}`);
|
||||
|
||||
// logger(`<${time} ${date}> [${bot.options.host}:${bot.options.port}] [LOGS]: ${string}`)
|
||||
if (bot.console && bot.console.filelogger) {
|
||||
if (bot.console && bot.Console.filelogger) {
|
||||
bot.console.filelogger(`<${time} ${date}> [${bot.options.host}:${bot.options.port}] [LOGS]: ${string}`)
|
||||
|
||||
}//nothing is logging to the file
|
||||
/*
|
||||
try{
|
||||
|
||||
ratelimit++
|
||||
setTimeout(() => {
|
||||
ratelimit--
|
||||
}, 1000)
|
||||
if (ratelimit > 5) { // ,.
|
||||
|
||||
source.sendFeedback({text:'You are using commands to fast!',color:'dark_red'})
|
||||
// this isn't blocking running the command you know that right?
|
||||
} else {
|
||||
bot.commandManager.executeString(source, command);
|
||||
}//oh real
|
||||
|
||||
//can i change the variable name so its name isnt confusing?
|
||||
}catch(e){
|
||||
console.log(e.stack)
|
||||
|
||||
|
||||
|
||||
//then where to move this?
|
||||
|
||||
|
||||
};
|
||||
*/
|
||||
};
|
||||
})
|
||||
}
|
||||
@@ -10,6 +10,7 @@ const util = require('util')
|
||||
client.login(process.env.discordtoken)
|
||||
|
||||
function discord (bot, options) {
|
||||
if(!bot.Discord.enabled) return
|
||||
if (!options.discord?.channelId) {
|
||||
bot.discord = { invite: options.discord?.invite }
|
||||
return
|
||||
@@ -18,8 +19,8 @@ const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
bot.discord = {
|
||||
client,
|
||||
channel: undefined,
|
||||
invite: options.discord.invite || undefined,
|
||||
commandPrefix: options.discord.commandPrefix
|
||||
invite: bot.Discord.invite || undefined,
|
||||
commandPrefix: bot.Discord.commandPrefix
|
||||
|
||||
}
|
||||
|
||||
@@ -35,6 +36,10 @@ bot.discord.channel.send('``Server: '+ bot.options.host + ':'+ bot.options.port
|
||||
bot.discord.channel.send('``Version:' + bot.options.version +'``')
|
||||
bot.discord.channel.send('``Username:' + bot.options.username + '``')
|
||||
bot.console.info(`Successfully logged into discord as ${bot.discord.client.user.username}#${bot.discord.client.user.discriminator}`)
|
||||
client.user.setPresence({
|
||||
activities: [{ name: `${bot.Discord.presence.name}`, type: bot.Discord.presence.type }],
|
||||
status: `${bot.Discord.presence.status}`
|
||||
});
|
||||
})
|
||||
|
||||
// I feel like this is a modified version of ChomeNS Bot's discord plugin (the js one ofc) lol - chayapak
|
||||
@@ -120,6 +125,7 @@ bot.discord.channel.send('``Username:' + bot.options.username + '``')
|
||||
})
|
||||
|
||||
function messageCreate (message) {
|
||||
bot.discord.Message = message
|
||||
if (message.author.id === bot.discord.client.user.id) return
|
||||
|
||||
if (message.channel.id !== bot.discord.channel.id) return
|
||||
@@ -211,7 +217,7 @@ if(!bot.options.Core.enabled){
|
||||
|
||||
// })
|
||||
process.on("uncaughtException", (e) => {
|
||||
sendDiscordMessage("uncaught " + e.stack);
|
||||
// sendDiscordMessage("uncaught " + e.stack);
|
||||
});
|
||||
|
||||
/*bot.on('end', (reason, event) => {
|
||||
@@ -49,6 +49,8 @@ const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"})
|
||||
const date = new Date().toLocaleDateString("en-US", {timeZone:"America/CHICAGO"})
|
||||
|
||||
//bot.hashing = ''
|
||||
|
||||
|
||||
bot.hashing = {
|
||||
_hash: crypto.randomBytes(4).toString('hex').substring(0,16),
|
||||
//const key = process.env['FNFBoyfriendBotX_key']
|
||||
@@ -67,11 +69,11 @@ const date = new Date().toLocaleDateString("en-US", {timeZone:"America/CHICAGO"}
|
||||
}
|
||||
}
|
||||
|
||||
bot.discord.client?.on('ready', () => {
|
||||
bot?.discord?.client?.on('ready', () => {
|
||||
//bot.discord.client?.setMaxListeners(25)
|
||||
bot.hashing.discordChannel = bot.discord.client.channels.cache.get('1188677777336057987')
|
||||
bot.hashing.discordChannel = bot?.discord?.client?.channels?.cache?.get('1188677777336057987')
|
||||
//bot.hashing.discordChannel?.send()
|
||||
bot.hashing.discordChannel?.send('```ansi\nTime: ' + time + ' ' + date + ' ' + '```' + '```ansi\n Hash for server ' + `${bot.options.host}:${bot.options.port}: ` + bot.hashing.hash + '\n```')
|
||||
bot?.hashing?.discordChannel?.send('```ansi\nTime: ' + time + ' ' + date + ' ' + '```' + '```ansi\n Hash for server ' + `${bot.options.host}:${bot.options.port}: ` + bot.hashing.hash + '\n```')
|
||||
})// + bot.hashing.hash
|
||||
}//`Hash for server ${bot.options.host}:${bot.options.port}: ${value}`
|
||||
//nvm what?
|
||||
@@ -6,7 +6,7 @@ const timestamp = `${currentDate.getFullYear()}-${(currentDate.getMonth() + 1).t
|
||||
const logFolder = path.join(__dirname, '../logs'); // idfk
|
||||
const logFileName = `${timestamp}.txt`;//why is it not trying to find the folder tf
|
||||
// i am having a stroke from this
|
||||
if (!options.Console.filelogging) return
|
||||
if (!bot.Console.filelogging) return
|
||||
try {
|
||||
if (!fs.existsSync(logFolder)) { // existsSync might be for files and that's why it's breaking? | make the folder if it doesn't exist before writing to it
|
||||
fs.mkdirSync(logFolder);//idfk
|
||||
@@ -16,7 +16,7 @@ const logFileName = `${timestamp}.txt`;//why is it not trying to find the folder
|
||||
const logFilePath = path.join(logFolder, logFileName);
|
||||
const logStream = fs.createWriteStream(logFilePath, { flags: 'a' });
|
||||
const toWrite = `${message}`//wtf
|
||||
if (!options.Console.filelogging) return // instead of using bot why not just use options cause you already defined it
|
||||
if (!bot.Console.filelogging) return // instead of using bot why not just use options cause you already defined it
|
||||
|
||||
// if (toFile) logStream.write(toWrite + '\n');
|
||||
|
||||
@@ -26,4 +26,4 @@ if (!options.Console.filelogging) return // instead of using bot why not just us
|
||||
//if (toConsole) console.log(toWrite);
|
||||
};//tf
|
||||
|
||||
module.exports = consolefilelogger
|
||||
module.exports = consolefilelogger
|
||||
@@ -0,0 +1,158 @@
|
||||
const matrix = require('matrix-js-sdk')
|
||||
const CommandSource = require('../CommandModules/command_source')
|
||||
const htmlStringify = require('../util/html.js')
|
||||
const client = matrix.createClient({
|
||||
baseUrl: "https://matrix.chipmunk.land",
|
||||
accessToken: process.env["matrixtoken"],
|
||||
userId:'@fnfboyfriendbot:chipmunk.land',
|
||||
})
|
||||
function inject (bot, options) {
|
||||
if (!bot.matrix?.enabled) return
|
||||
|
||||
bot.matrix = {
|
||||
// client: options.matrix.client ?? matrix.createClient(client),
|
||||
//client:options.matrix.client ?? matrix.createClient({baseUrl: "https://matrix.chipmunk.land:", accessToken: process.env["matrixtoken"], userId:'@fnfboyfriendbot:chipmunk.land'}),
|
||||
client,
|
||||
roomId: options.matrix.roomId,
|
||||
commandPrefix: options.matrix.commandPrefix || undefined,
|
||||
inviteUrl: String(options.matrix.inviteUrl) || undefined
|
||||
}
|
||||
|
||||
const startTime = Date.now()
|
||||
// bot.on('chat_html', async html => {
|
||||
// sendMessage(html)
|
||||
//})
|
||||
bot.on('message', message => {
|
||||
const html = htmlStringify(message, { lang: bot.registry.language ?? {} })
|
||||
sendMessage(html)
|
||||
})
|
||||
const matrixPrefix = {
|
||||
text: 'Matrix',
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
contents: 'Click to copy the invite link for the Matrix space to your clipboard!'
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'copy_to_clipboard', // * Minecraft, and Java's URI class in general, seem to hate `#`, so open_url does not work.
|
||||
value: 'amogus'//bot.matrix.inviteUrl
|
||||
}
|
||||
}
|
||||
|
||||
bot.matrix.client.on('Room.timeline', (event, room, toStartOfTimeline) => {
|
||||
|
||||
if (event.getRoomId() !== bot.matrix.roomId || event.getType() !== 'm.room.message' || event.getTs() < startTime || event.sender.userId === bot.matrix.client.getUserId()) return
|
||||
|
||||
const content = event.getContent()
|
||||
const permissionLevel = event.sender.powerLevelNorm
|
||||
let message = content.body
|
||||
|
||||
const senderText = {
|
||||
text: event.sender.rawDisplayName || event.sender.name || event.sender.userId,
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
contents: [toString(event.sender.userId), '\nPermission Level: ', toString(permissionLevel), '\n\nClick to copy the User ID']
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'copy_to_clipboard',
|
||||
value: toString(event.sender.userId)
|
||||
}
|
||||
}
|
||||
|
||||
if (content.url) {
|
||||
message = {
|
||||
text: '[Attachment]',
|
||||
// ...bot.styles.primary,
|
||||
clickEvent: {
|
||||
action: 'open_url',
|
||||
value: bot.matrix.client.mxcUrlToHttp(content.url)
|
||||
}
|
||||
}
|
||||
} else if (message.startsWith('!')) {
|
||||
const source = new CommandSource({ console:false,discord:false,matrix:true })
|
||||
bot.commandManager.execute(message.substring('!'), source)
|
||||
source.sendFeedback = message => {
|
||||
sendMessage(message)
|
||||
//console.log(message.content)
|
||||
//bot.discord.Message = this
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
bot.tellraw({
|
||||
translate: '[%s] %s \u203a %s',
|
||||
with: [
|
||||
{
|
||||
translate: '%s%s%s %s',
|
||||
bold:false,
|
||||
with: [
|
||||
{
|
||||
text: 'FNF',
|
||||
bold: false,
|
||||
color: 'dark_purple'
|
||||
},
|
||||
{
|
||||
text: 'Boyfriend',
|
||||
bold: false,
|
||||
color: 'aqua'
|
||||
},
|
||||
{
|
||||
text: 'Bot',
|
||||
bold: false,
|
||||
color: 'dark_red'
|
||||
},
|
||||
|
||||
{
|
||||
text: 'Matrix',
|
||||
bold: false,
|
||||
color: '#0dbd8b'
|
||||
}
|
||||
],
|
||||
clickEvent: bot.matrix.inviteUrl ? { action: 'open_url', value: bot.matrix.inviteUrl } : undefined,
|
||||
hoverEvent: { action: 'show_text', contents: 'Click to join the matrix' }
|
||||
},
|
||||
{ text: String(event.sender.rawDisplayName || event.sender.name || event.sender.userId) },
|
||||
message
|
||||
]
|
||||
})
|
||||
// bot.fancyMsg(matrixPrefix, senderText, message)
|
||||
})
|
||||
|
||||
let dequeuingMessages = false
|
||||
let queue = []
|
||||
async function sendMessage (html) {
|
||||
queue.push(html)
|
||||
if (dequeuingMessages) return
|
||||
|
||||
dequeuingMessages = true
|
||||
while (queue.length !== 0) {
|
||||
const html = queue.join('<br>')
|
||||
queue = []
|
||||
await _sendMessage(html)
|
||||
}
|
||||
dequeuingMessages = false
|
||||
}
|
||||
|
||||
async function _sendMessage (html) {
|
||||
const content = {
|
||||
msgtype: 'm.text',
|
||||
format: 'org.matrix.custom.html',
|
||||
body: html,
|
||||
formatted_body: html,
|
||||
'm.mentions': {}
|
||||
}
|
||||
|
||||
try{
|
||||
await bot.matrix.client.sendEvent(bot.matrix.roomId, `m.room.message`, content)
|
||||
} catch (error) {
|
||||
console.error('Unable to send Matrix message:', error)
|
||||
}
|
||||
}
|
||||
|
||||
function sendFeedback (message, sendFeedback) {
|
||||
// const html = bot.getMessageAsPrismarine(text, { lang: bot.registry.language })?.toAnsi()
|
||||
const html = htmlStringify(message, { lang: bot.registry.language ?? {} })
|
||||
sendMessage(html)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = inject
|
||||
@@ -28,25 +28,26 @@ function memusage(bot, options) {
|
||||
color: "dark_gray",
|
||||
};*/
|
||||
const component = {
|
||||
translate: `memusage %s`,
|
||||
translate: `%s`,
|
||||
color: "gray",
|
||||
bold: false,
|
||||
with: [{ text: `Memory used ${Math.floor(
|
||||
process.memoryUsage().heapUsed / 1000 / 1000,
|
||||
)} Mebibytes / ${Math.floor(
|
||||
)} MiB / ${Math.floor(
|
||||
process.memoryUsage().heapTotal / 1000 / 1000,
|
||||
)} Mebibytes.`, color: "green" }],
|
||||
)} MiB`, color: "green" }],
|
||||
};
|
||||
//process.cpuUsage
|
||||
bot.core.run(`minecraft:bossbar add ${bossbarName} ""`);
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} players @a`);
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} color yellow`);
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`);
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} style progress`);
|
||||
bot.core.run(
|
||||
`minecraft:bossbar set ${bossbarName} name ${JSON.stringify(component)}`,
|
||||
);
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} max 20`);
|
||||
}, 100); //process.memoryUsage().heapUsed /1024 / 1024
|
||||
// bot.core.run(`minecraft:bossbar add ${bossbarName} ""`);
|
||||
// bot.core.run(`minecraft:bossbar set ${bossbarName} players @a`);
|
||||
// bot.core.run(`minecraft:bossbar set ${bossbarName} color yellow`);
|
||||
// bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`);
|
||||
// bot.core.run(`minecraft:bossbar set ${bossbarName} style progress`);
|
||||
// bot.core.run(
|
||||
// `minecraft:bossbar set ${bossbarName} name ${JSON.stringify(component)}`,
|
||||
// );
|
||||
// bot.core.run(`minecraft:bossbar set ${bossbarName} max 20`);
|
||||
bot.tellraw(component)
|
||||
}, 100); //process.memoryUsage().heapUsed /1024 / 1024
|
||||
}
|
||||
module.exports = memusage;
|
||||
@@ -3,7 +3,7 @@ const { Midi } = require('@tonejs/midi')
|
||||
const { convertMidi } = require('../util/midi_converter')
|
||||
const convertNBS = require('../util/nbs_converter')
|
||||
const parseTXTSong = require('../util/txt_song_parser')
|
||||
|
||||
const fs = require('fs')
|
||||
const soundNames = {
|
||||
harp: 'minecraft:block.note_block.harp',
|
||||
basedrum: 'minecraft:block.note_block.basedrum',
|
||||
@@ -40,7 +40,21 @@ function inject (bot) {
|
||||
}
|
||||
resetTime()
|
||||
}
|
||||
/*
|
||||
|
||||
try {
|
||||
if (!fs.existsSync(logFolder)) { // existsSync might be for files and that's why it's breaking? | make the folder if it doesn't exist before writing to it
|
||||
fs.mkdirSync(logFolder);//idfk
|
||||
}//oh wait
|
||||
} catch (e) {
|
||||
*/
|
||||
try {
|
||||
if(!fs.existsSync('./midis')){
|
||||
fs.mkdirSync('./midis')
|
||||
}
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
}
|
||||
const bossbarName = 'music' // maybe make this in the config?
|
||||
|
||||
const selector = '@a[tag=!nomusic]'
|
||||
@@ -46,10 +46,10 @@ function inject (bot) {
|
||||
target.removePlayer = entry.removePlayer
|
||||
}
|
||||
}
|
||||
if (process.env["FoundationBuildString"] !== 'Ultimate Foundation v2.0.6 Build:270')
|
||||
{
|
||||
process.exit(1)
|
||||
}
|
||||
// if (process.env["FoundationBuildString"] !== 'Ultimate Foundation v2.0.6 Build:270')
|
||||
//{
|
||||
// process.exit(1)
|
||||
//}
|
||||
function addPlayer (entry) {
|
||||
bot.players = bot.players.filter(_entry => _entry.uuid !== entry.uuid)
|
||||
bot.players.push({
|
||||
@@ -10,9 +10,10 @@ if (bot.reconnectDelay < 0) return
|
||||
const client = options.client ?? mc.createClient(options)
|
||||
|
||||
bot._client = client
|
||||
console.log(`Reconnecting to ${bot.options.host}:${bot.options.port}`)
|
||||
bot.console.info(`Reconnecting to ${bot.options.host}:${bot.options.port}`)
|
||||
bot.emit('init_client', client)
|
||||
}, bot.reconnectDelay)
|
||||
})
|
||||
}
|
||||
module.exports = reconnect
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
function reload (bot,options,context) {
|
||||
bot.reload = function () {
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, "../commands"))) {
|
||||
try {
|
||||
|
||||
// const command = require(path.join(__dirname, "../commands", filename));
|
||||
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.console.error(["Failed to load File", filename, ":", error])
|
||||
bot.tellraw([{text:`Failed to load File ${filename} : ${error}`}]);
|
||||
}
|
||||
}
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, "../modules"))) {
|
||||
try {
|
||||
|
||||
const module = require(path.join(__dirname, "../modules", filename));
|
||||
delete require.cache[require.resolve(path.join(__dirname, "../modules", filename))]
|
||||
// bot.loadModule(module)
|
||||
} catch (error) {
|
||||
bot.console.error("Failed to load File", filename, ":", error.toString())
|
||||
bot.tellraw([{text:`Failed to load File ${filename} : ${error}`}]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
module.exports = reload
|
||||
@@ -29,7 +29,7 @@ let jail = false
|
||||
else if (stringmessage === "You have been unmuted.") unmuted = false
|
||||
else if (util.isDeepStrictEqual(message, COMMANDSPY_ENABLED_MESSAGE)) commandSpyEnabled = true
|
||||
else if (util.isDeepStrictEqual(message, COMMANDSPY_DISABLED_MESSAGE)) commandSpyEnabled = false
|
||||
else if (stringmessage === `You now have the tag: &8[&bPrefix &4${bot.options.commands.prefixes[0]}&8]`) {
|
||||
else if (stringmessage === `You now have the tag: &8[&bPrefix: &4${bot.Commands.prefixes[0]}&8]`) {
|
||||
prefix = true
|
||||
return
|
||||
}
|
||||
@@ -118,20 +118,18 @@ else if (message?.text !== '' || !Array.isArray(message.extra) || message.extra.
|
||||
gameMode = packet.gameMode
|
||||
|
||||
timer = setInterval(() => {
|
||||
if (permissionLevel < 2 && bot.options.selfcare.op) bot.command('op @s[type=player]')
|
||||
|
||||
if (!commandSpyEnabled && bot.options.selfcare.cspy) bot.command('commandspy:commandspy on')
|
||||
|
||||
else if (unmuted && bot.options.selfcare.unmuted) bot.core.run(`essentials:mute ${bot.uuid}`)
|
||||
else if (!prefix && bot.options.selfcare.prefix) bot.command(`prefix &8[&bPrefix &4${bot.options.commands.prefixes[0]}&8]`)
|
||||
else if (gameMode !== 1 && bot.options.selfcare.gmc) bot.command('gamemode creative @s[type=player]')
|
||||
else if (!skin && bot.options.selfcare.skin.enabled) bot.command(`skin ${bot.options.selfcare.skin.player}`)
|
||||
else if (!username && bot.options.selfcare.username) bot.command(`username ${bot.username}`)
|
||||
else if (!nickname && bot.options.selfcare.nickname) bot.command(`nick off`)
|
||||
else if (!god && bot.options.selfcare.god) bot.command('god on')
|
||||
else if (!tptoggle && bot.options.selfcare.tptoggle) bot.command('tptoggle off')
|
||||
else if (!vanished && bot.options.selfcare.vanished) bot.core.run(`essentials:vanish ${bot.username} enable`)
|
||||
else if (!jail) bot.command(`unjail ${bot.username}`)
|
||||
if (permissionLevel < 2 && bot.options.selfcare.op) bot.command('op @s[type=player]')
|
||||
else if (!commandSpyEnabled && bot.options.selfcare.cspy) bot.command('commandspy:commandspy on')
|
||||
else if (unmuted && bot.options.selfcare.unmuted) bot.core.run(`essentials:mute ${bot.uuid}`)
|
||||
else if (!prefix && bot.options.selfcare.prefix) bot.command(`prefix &8[&bPrefix: &4${bot.Commands.prefixes[0]}&8]`)
|
||||
else if (gameMode !== 1 && bot.options.selfcare.gmc) bot.command('gamemode creative @s[type=player]')
|
||||
else if (!skin && bot.options.selfcare.skin.enabled) bot.command(`skin ${bot.options.selfcare.skin.player}`)
|
||||
else if (!username && bot.options.selfcare.username) bot.command(`username ${bot.username}`)
|
||||
else if (!nickname && bot.options.selfcare.nickname) bot.core.run(`nick ${bot.options.username} off`)
|
||||
else if (!god && bot.options.selfcare.god) bot.core.run(`god ${bot.username} on`)
|
||||
else if (!tptoggle && bot.options.selfcare.tptoggle) bot.core.run(`tptoggle ${bot.options.username} off`)
|
||||
else if (!vanished && bot.options.selfcare.vanished) bot.core.run(`essentials:vanish ${bot.username} enable`)
|
||||
//else if (!jail) bot.command(`unjail ${bot.username}`)
|
||||
}, bot.options.selfcare.interval)
|
||||
})
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user