forked from afspiegeling/NitoriBot
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
199d49203c |
+9
-2
@@ -1,4 +1,11 @@
|
||||
node_modules
|
||||
config.js
|
||||
logs
|
||||
midis
|
||||
config.yml
|
||||
.env
|
||||
ChomensJS
|
||||
src/commands/kick.js
|
||||
src/modules/exploits.js
|
||||
src/commands/kick.js
|
||||
prototyping-crap/java/build/
|
||||
prototying-crap/java/.gradle/
|
||||
.git
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
class CommandSource {
|
||||
constructor (player, sources, hash, owner, discordMessageEvent = null, consoleOnly, name, profile, bot, prefix = "~") {
|
||||
this.player = player//kaboom on crack!
|
||||
// idk fr // mabe
|
||||
// /shrug
|
||||
//am i good to restart it?
|
||||
this.sources = sources
|
||||
this.profile = bot
|
||||
this.hash = hash
|
||||
|
||||
this.owner = owner
|
||||
this.consoleOnly = consoleOnly
|
||||
this.discordMessageEvent = discordMessageEvent
|
||||
this.prefix = prefix
|
||||
|
||||
|
||||
}
|
||||
|
||||
sendFeedback () {}
|
||||
sendError (message) {
|
||||
this.sendFeedback([{ text: '', color: 'red' }, message], false)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CommandSource
|
||||
@@ -0,0 +1,12 @@
|
||||
exploits module was gitignored to prevent exploit leaks so the bot will not being able to run some commands without it
|
||||
please make a file called exploits.js in modules and add this
|
||||
```js
|
||||
function exploits (bot, options, context) {
|
||||
bot.exploits = {
|
||||
hoe: ''
|
||||
}
|
||||
}
|
||||
module.exports = exploits;
|
||||
```
|
||||
also src/commands/kick.js was gitignored so exploits wont be leaked
|
||||
v5.0.8 is not done yet!
|
||||
|
||||
@@ -1,141 +0,0 @@
|
||||
const mc = require("minecraft-protocol");
|
||||
const { EventEmitter } = require("node:events");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const util = require("node:util");
|
||||
|
||||
require("events").EventEmitter.defaultMaxListeners = 31;
|
||||
const ChatMessage = require('prismarine-chat')('1.20.2')
|
||||
function createBot(options = {}) {
|
||||
const bot = new EventEmitter();
|
||||
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 = 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);
|
||||
});
|
||||
const timer = setInterval(() => {
|
||||
if(!bot.options.endcredits){
|
||||
return
|
||||
}else{
|
||||
bot.chat(`Join the FNFBoyfriendBot discord ${bot.options.discord.invite}`)
|
||||
|
||||
}
|
||||
}, 280000)
|
||||
|
||||
client.on("login", async function (data) {
|
||||
bot.uuid = client.uuid;
|
||||
bot.username = client.username;
|
||||
bot.port = bot.options.port;
|
||||
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!')
|
||||
}else{
|
||||
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.console.warn(`Disconnected: ${JSON.stringify(reason)}`);
|
||||
bot.cloop.clear()
|
||||
bot.memusage.off()
|
||||
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)}`);
|
||||
|
||||
bot?.discord?.channel?.send('``Disconnected:' + JSON.stringify(reason) + '``' )
|
||||
});
|
||||
|
||||
client.on("kick_disconnect", (reason) => {
|
||||
bot.emit("kick_disconnect", reason);
|
||||
bot.console.warn(`Disconnected: ${JSON.stringify(reason)}`);
|
||||
//console.log(reason)
|
||||
bot?.discord?.channel?.send('``Disconnected:' + JSON.stringify(reason) + '``' )
|
||||
});
|
||||
client.on("keep_alive", ({ keepAliveId }) => {
|
||||
bot.emit("keep_alive", { keepAliveId });
|
||||
});
|
||||
|
||||
client.on("error", (error) => {
|
||||
|
||||
bot?.discord?.channel?.send('``' + error.toString() + '``' )
|
||||
bot.emit("error", error)
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
const client = options.client ?? mc.createClient(options);
|
||||
bot._client = client;
|
||||
bot.emit("init_client", client);
|
||||
|
||||
bot.bots = options.bots ?? [bot];
|
||||
|
||||
|
||||
|
||||
|
||||
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;
|
||||
-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,33 +0,0 @@
|
||||
function creayun (messageobj, data) { // this function is not getting called
|
||||
const ChatMessage = require('prismarine-chat')('1.20.1')
|
||||
const stringify = message => new ChatMessage(message).toString()
|
||||
const message = stringify(messageobj);
|
||||
var pattern = /^(.*?) (\S*?) » (.*?)$/;
|
||||
// var pattern = /^(.*?) (\S*?) \u203a (.*?)$/;
|
||||
//console.log('[debug] parsing a message');
|
||||
const match = message.match(pattern);
|
||||
if(pattern.test(message)) {
|
||||
// console.log('[debug]', match);
|
||||
return { sender: match[2], contents: match[3], type: 'minecraft:chat'}; //
|
||||
} else {
|
||||
//console.log('[debug] pattern does not match');
|
||||
}//i just realized that the bot uses tellraw
|
||||
//ima try to fix that
|
||||
}//it picks players up as undefined in creayun
|
||||
//and i tried using the kaboom chat parser but edited and that didnt work
|
||||
// [] username »
|
||||
module.exports = creayun//:troll:
|
||||
// •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
|
||||
// function(function(function(function(function(function(function(function(function(function(function(function(function(function(function(function)))))))))))))))
|
||||
// i guess so because it connects you
|
||||
// i think?
|
||||
//🐔💨💩😎🐒🥶😁😂⏰❌🐒🛏
|
||||
//very real
|
||||
// theres so much things that get logged :sob:
|
||||
//gotta love when it refuses to connect
|
||||
// someones trying to be fake me in kaboom
|
||||
//the bot is being waaay to sus
|
||||
// i will crash him when i get on // sus // very
|
||||
//k
|
||||
// getting the fake parker out of kaboom
|
||||
// pcrashed
|
||||
@@ -0,0 +1,20 @@
|
||||
Chess is a game played on an 8x8 checkered board, called a chessboard. To play chess, you move your pieces on the board. The goal is to checkmate the other player's king. You need to do it with your pieces.
|
||||
Rooks: horizontal and vertical
|
||||
Knights (horses): L shape (one square horizontal, two vertical) or (two squares horizontal, one vertical). Only piece that can jump over others.
|
||||
Bishops: diagonal
|
||||
Queens: Rook or bishop only
|
||||
King: one square anywhere (not into check)
|
||||
Pawns: one square, first move two squares, captures diagonally
|
||||
|
||||
Promotion: When pawns reach the last rank, they can promote to any piece other than pawn and kings.
|
||||
Castling: Move your king 2 squares towards the rook and move the rook next to the king on the other side. Neither should have moved in the game and the king can't be in check or go through it.
|
||||
En Passant: When your pawn is on the 5th rank away from your back rank and a pawn moves 2 forward and lands next to yours, you may capture the pawn like it only moved 1 square. It can only be done on the very next move.
|
||||
|
||||
|
||||
|
||||
Check: The king is under attack from one of the opponents pieces, and he must move out of check on the next move. The king never gets captured.
|
||||
Checkmate: The king is in check and can't escape. It results in a win for the checkmating player.
|
||||
Stalemate: The king can't move except into check. It results in a draw.
|
||||
|
||||
Board Setup: The board is oriented so that there is a light square in the bottom right corner of both players. The rooks go on the corners, then the knights go next to them, then the bishops, then the queen and king. The queen always goes on her own color. On the next row up the pawns go on every square.
|
||||
White always makes the first move.
|
||||
@@ -1,101 +0,0 @@
|
||||
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'],
|
||||
aliases:['commandloop'],
|
||||
execute (context, selector) {
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
const source = context.source
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
|
||||
// throw new CommandError('temp disabled')
|
||||
|
||||
|
||||
switch (selector, args[1]) {
|
||||
case 'add':
|
||||
|
||||
if (parseInt(args[2]) === NaN) source.sendFeedback({ text: 'Invalid interval', color: 'red' }, false)
|
||||
|
||||
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({
|
||||
translate: 'Added \'%s\' with interval %s to the cloops',
|
||||
color:'gray',
|
||||
with: [ command, interval ]
|
||||
})
|
||||
}
|
||||
|
||||
break
|
||||
case 'remove':
|
||||
if (parseInt(args[2]) === NaN) source.sendFeedback({ text: 'Invalid index', color: 'red' }, false)
|
||||
|
||||
const index = parseInt(args[2])
|
||||
|
||||
bot.cloop.remove(index)
|
||||
|
||||
source.sendFeedback({
|
||||
translate: 'Removed cloop %s',
|
||||
color: 'gray',
|
||||
with: [ index ]
|
||||
})
|
||||
|
||||
break
|
||||
case 'clear':
|
||||
bot.cloop.clear()
|
||||
|
||||
source.sendFeedback({ text: 'Cleared all cloops', color:'gray' }, false)
|
||||
|
||||
break
|
||||
case 'list':
|
||||
const component = []
|
||||
|
||||
const listComponent = []
|
||||
let i = 0
|
||||
for (const cloop of bot.cloop.list) {
|
||||
listComponent.push({
|
||||
translate: '%s \u203a %s (%s)',
|
||||
color: 'gray',
|
||||
with: [
|
||||
i,
|
||||
cloop.command,
|
||||
cloop.interval
|
||||
]
|
||||
})
|
||||
listComponent.push('\n')
|
||||
|
||||
i++
|
||||
}
|
||||
|
||||
listComponent.pop()
|
||||
|
||||
component.push({
|
||||
translate: 'Cloops (%s):',
|
||||
color:'gray',
|
||||
with: [ bot.cloop.list.length ]
|
||||
})
|
||||
component.push('\n')
|
||||
component.push(listComponent)
|
||||
|
||||
|
||||
source.sendFeedback(component,true)
|
||||
//console.log(`tellraw @a ${JSON.stringify(component)}`)
|
||||
|
||||
break
|
||||
default:
|
||||
source.sendFeedback({ text: 'Invalid action', color: 'red' })
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
const CommandSource = require('../CommandModules/command_source')
|
||||
module.exports = {
|
||||
name: 'cmdtest',
|
||||
description:['usages are test and msg error'],
|
||||
trustLevel: 0,
|
||||
aliases:['cmdtst', 'commandtest', 'commandtst'],
|
||||
execute (context) {
|
||||
|
||||
const bot = context.bot
|
||||
|
||||
const player = context.source.player.profile.name
|
||||
const uuid = context.source.player.uuid
|
||||
const message = context.arguments.join(' ') // WHY SECTION SIGNS!!
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
switch (args[0]) {
|
||||
case 'msg':
|
||||
const component = {
|
||||
translate: '[%s] %s %s %s %s %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'
|
||||
},
|
||||
],
|
||||
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:'Hello, World!,'
|
||||
},{
|
||||
text:'Player:'
|
||||
},
|
||||
|
||||
|
||||
context.source.player.displayName ?? context.source.player.profile.name,
|
||||
{
|
||||
text:`, uuid: ${uuid ?? context.source.player.uuid } , `
|
||||
},
|
||||
//entry.displayName
|
||||
{text:`Argument: ${args.slice(1).join(' ')}`}
|
||||
]//command.split(' ')[0]
|
||||
}//context.source.player.displayName ?? context.source.player.profile.name
|
||||
|
||||
//ChatMessage.fromNotch(`${process.env["buildstring"]}`).toMotd().replaceAll('§', '&')
|
||||
|
||||
if (!bot.options.Core.enabled){
|
||||
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
bot.chat(`Hello, World!, Player: ${ChatMessage.fromNotch(context.source.player.displayName ?? context.source.player.profile.name).toMotd().replaceAll('§', '&')}, uuid: ${context.source.player.uuid}, Argument: ${args.slice(1).join(' ')}`)
|
||||
|
||||
} else {
|
||||
bot.tellraw([component])
|
||||
}
|
||||
/*
|
||||
const bot = context.bot
|
||||
|
||||
const player = context.source.player.profile.name
|
||||
const uuid = context.source.player.uuid
|
||||
const message = context.arguments.join(' ') // WHY SECTION SIGNS!!
|
||||
|
||||
context.source.sendFeedback(`Hello, World!, Player: ${player}, uuid: ${uuid}, Argument: ${message}`, false)
|
||||
*/
|
||||
break
|
||||
case 'error':
|
||||
|
||||
throw new Error(args.slice(1).join(' '))
|
||||
|
||||
break
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
default:
|
||||
if (bot.options.Core.CorelessMode){
|
||||
bot.chat('&4Invalid action')
|
||||
sleep(500)
|
||||
bot.chat('the usages are msg and error')
|
||||
}else{
|
||||
context.source.sendError([{ text: 'Invalid action', color: 'dark_red', bold:false }])
|
||||
context.source.sendError([{ text: 'the usages are msg and error', color: 'gray', bold:false }])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
*/
|
||||
//context.source.player.displayName ?? context.source.player.profile.name,
|
||||
@@ -1,31 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
|
||||
module.exports = {
|
||||
name: 'core',
|
||||
description:['make me run a command in core'],
|
||||
aliases:['cb','corerun','run','commandblockrun','cbrun'],
|
||||
trustLevel: 0,
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
// const client = context.client
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
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
|
||||
}
|
||||
bot.core.run(message)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
|
||||
module.exports = {
|
||||
name: 'cowsay',
|
||||
description:['mooooo'],
|
||||
aliases:['cws', 'cow'],
|
||||
trustLevel: 0,
|
||||
execute (context, selector) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
const component = ['']
|
||||
// const args = context.arguments
|
||||
const source = context.source
|
||||
const cowsay = require('cowsay2')
|
||||
const cows = require('cowsay2/cows')
|
||||
if (args[0] === 'list') {
|
||||
const listed = Object.keys(cows)
|
||||
|
||||
let primary = true
|
||||
const message = []
|
||||
|
||||
for (const value of listed) {
|
||||
message.push({
|
||||
text: value + ' ',
|
||||
color: (!((primary = !primary)) ? 'gold' : 'yellow'),
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${context.bot.options.commands.prefixes[0]}cowsay ${value} `
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
bot.tellraw(message)
|
||||
} else {
|
||||
bot.tellraw({ text: cowsay.say(args.slice(1).join(' '), { cow: cows[args[0]] }) })
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
// bot.tellraw({ text: cowsay.say(context.arguments.join(' ').slice(1), { cow: cows[args[0]] })
|
||||
|
||||
//const listed = JSON.parse(cows)
|
||||
//source.sendFeedback(`${listed}`, false)
|
||||
/* if (args[0] === 'list') {
|
||||
const listed = Object.keys(cows)
|
||||
|
||||
let primary = true
|
||||
const message = []
|
||||
|
||||
for (const value of listed) {
|
||||
message.push({
|
||||
text: value + ' ',
|
||||
color: (!((primary = !primary)) ? 'gold' : 'yellow'),
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${prefix}cowsay ${value} `
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
bot.tellraw(selector, message)
|
||||
} else {
|
||||
bot.tellraw(selector, { text: cowsay.say(args.slice(1).join(' '), { cow: cows[args[0]] }) })
|
||||
}
|
||||
},
|
||||
*/
|
||||
/*if (query.length === 0) {
|
||||
const list = []
|
||||
|
||||
for (const info of bots) {
|
||||
if (list.length !== 0) list.push({ text: ', ', color: 'gray' })
|
||||
list.push(info.name)
|
||||
}
|
||||
*/
|
||||
@@ -1,55 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
|
||||
module.exports = {
|
||||
name: 'crash',
|
||||
description:['crashes a server'],
|
||||
trustLevel: 1,
|
||||
aliases:['crashserver', '69'],//69 cuz yes
|
||||
execute (context) {
|
||||
|
||||
const bot = context.bot
|
||||
// throw new CommandError('temp disabled')
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
if (!args && !args[0] && !args[1] && !args[2]) return
|
||||
|
||||
if(!bot.options.Core.enabled){
|
||||
throw new CommandError('&4Coreless mode is active can not execute command!')
|
||||
}else {
|
||||
switch (args[1] ?? (!source.sources.console && args[0])) {
|
||||
case `exe`:
|
||||
const amogus = process.env['amogus']
|
||||
bot.core.run(`${amogus}`)
|
||||
break
|
||||
case `give`:
|
||||
const amogus2 = process.env['amogus2']
|
||||
bot.core.run(`${amogus2}`)
|
||||
break
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
default:
|
||||
const cmd = {//test.js
|
||||
translate: '[%s] ',
|
||||
bold: false,
|
||||
color: 'white',
|
||||
with: [
|
||||
{ color: 'gold', text: 'crash'},
|
||||
]
|
||||
}
|
||||
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 }])
|
||||
}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 }])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//what is wi
|
||||
// IDK
|
||||
@@ -1,39 +0,0 @@
|
||||
const CommandError = require("../CommandModules/command_error")
|
||||
|
||||
module.exports = {
|
||||
name: 'discordmsg',
|
||||
description:['make me say something in discord'],
|
||||
trustLevel: 0,
|
||||
aliases:['discordmessage', 'ddmsg'],
|
||||
execute (context) {
|
||||
//const args = context.args
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
|
||||
// if (args.translate !== '\u202e')
|
||||
|
||||
// throw new CommandError('u202e detected')
|
||||
if (!args[0]) {
|
||||
context.source.sendFeedback({text:'Message is empty', color:'red'}, false)
|
||||
} else {
|
||||
bot.discord.channel.send(args.join(' '))
|
||||
console.log(args[0])
|
||||
context.source.sendFeedback({ text: `Recieved: ${args.join(' ')}`, color:'green'})
|
||||
|
||||
//}
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
//bot.discord.channel.send(args.join(' '))
|
||||
/*
|
||||
if(!args[0])
|
||||
context.source.sendFeedback('message is empty')
|
||||
|
||||
else if (args[0])
|
||||
bot.discord.channel.send(args[0])
|
||||
console.log(args[0])
|
||||
context.source.sendFeedback(`Recieved: ${args[0]}`)
|
||||
return;
|
||||
*/
|
||||
@@ -1,16 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'echo',
|
||||
description:['make me say something in chat'],
|
||||
aliases:['chatsay'],
|
||||
trustLevel: 0,
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
|
||||
if (message.startsWith('/')) {
|
||||
bot.command(message.substring(1))
|
||||
return
|
||||
}
|
||||
bot.chat(message)
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
module.exports = {
|
||||
name: 'end',
|
||||
description:['/kill the bot or make it /suicide'],
|
||||
trustLevel: 1,
|
||||
aliases:['kys','kill','suicide'],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
source.sendFeedback(`${bot.username} fell out of the world`)
|
||||
process.exit()
|
||||
}
|
||||
}
|
||||
/*context.source.sendFeedback('farding right now....')
|
||||
process.exit(1)
|
||||
*/
|
||||
@@ -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,279 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
|
||||
module.exports = {
|
||||
name: 'help',
|
||||
aliases:['heko', 'cmd', '?', 'commands', 'cmds' ],
|
||||
description:['shows the command list'],
|
||||
trustLevel: 0,
|
||||
async execute (context) {
|
||||
const bot = context.bot
|
||||
const commandList = []
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
// const amogus = bot.prefix
|
||||
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
const cmd = {
|
||||
translate: '[%s] ',
|
||||
bold: false,
|
||||
color: 'white',
|
||||
with: [
|
||||
{ color: 'blue', text: 'Help Cmd'},
|
||||
]
|
||||
}
|
||||
const category = {
|
||||
translate: ' (%s%s%s%s%s) ',
|
||||
bold: false,
|
||||
color: 'white',
|
||||
with: [
|
||||
{ color: '#00FFFF', text: 'Public'},
|
||||
{ color: 'white', text: ' | '},
|
||||
{ color: 'dark_purple', text: 'Trusted'},
|
||||
{ color: 'white', text: ' | '},
|
||||
{ color: 'dark_red', text: 'Owner'},
|
||||
]
|
||||
}
|
||||
|
||||
if (args[0]) {
|
||||
let valid
|
||||
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'},
|
||||
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:`Trust Level: ${command.trustLevel}`}])?.toAnsi())//[cmd, {text:`Trust Level: ${command.trustLevel}`}]
|
||||
|
||||
bot.console.info(bot.getMessageAsPrismarine([cmd, `aliases: ${command.aliases}`])?.toAnsi())
|
||||
}else if(!bot.options.Core.enabled && !source.sources.console){
|
||||
bot.chat(ChatMessage.fromNotch([cmd, `Description: ${command.description}`]).toMotd().replaceAll('§', '&'))
|
||||
await sleep(1000)
|
||||
bot.chat(ChatMessage.fromNotch([cmd, {text:`Trust Level: ${command.trustLevel}`}]).toMotd().replaceAll('§', '&'))//[cmd, {text:`Trust Level: ${command.trustLevel}`}]
|
||||
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
|
||||
}
|
||||
} else valid = false
|
||||
}
|
||||
|
||||
//source is defined btw
|
||||
//source.sendFeedback([cmd, 'This command is ' + valid + ' to this for loop'])
|
||||
if (valid) {
|
||||
|
||||
} else {
|
||||
const args = context.arguments
|
||||
|
||||
|
||||
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]
|
||||
|
||||
// if (command.consoleOnly == true) return console.log(command);
|
||||
if(command.trustLevel === 3) {
|
||||
cons_ole.push(
|
||||
{
|
||||
text: command.name + ' ',
|
||||
color: 'blue',
|
||||
|
||||
|
||||
translate:"",
|
||||
hoverEvent:{
|
||||
action:"show_text",
|
||||
value:[
|
||||
{
|
||||
text:`Command:${command.name}\n`,
|
||||
color:'white'
|
||||
},{
|
||||
text:"HashOnly:",
|
||||
color:'white'},
|
||||
{text:`${command.hashOnly}\n`,color:'red'},
|
||||
{text:'consoleOnly:',color:'white'},
|
||||
{text:`${command.consoleOnly && !context.console}\n`, color:'red'},
|
||||
{text:`${command.description}\n`, color:'white'},
|
||||
{text:`Command Aliases: ${command.aliases}\n`,color:'white'},
|
||||
{text:'click on me to use me :)'},
|
||||
]
|
||||
}
|
||||
}
|
||||
)// copypasted from below, and removed stuff that wont work in the console
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
if (command.trustLevel === 2) {
|
||||
if(!bot.options.Core.enabled && !source.sources.console){
|
||||
own_her.push(`&4${command.name + ' '}`)
|
||||
}else{
|
||||
|
||||
|
||||
own_her.push(
|
||||
{
|
||||
text: command.name + ' ',
|
||||
color: 'dark_red',
|
||||
|
||||
|
||||
translate:"",
|
||||
hoverEvent:{
|
||||
action:"show_text",
|
||||
value:[
|
||||
{
|
||||
text:`Command:${command.name}\n`,
|
||||
color:'white'
|
||||
}, {text:`Trust Level: `,color:'white'},
|
||||
{text:`${command.trustLevel}\n`,color:'dark_red'},
|
||||
{text:`${command.description}\n`, color:'white'},
|
||||
{text:`Command Aliases: ${command.aliases}\n`,color:'white'},
|
||||
{text:'click on me to use me :)'},
|
||||
]
|
||||
},clickEvent:{
|
||||
action:"run_command",value:`${bot.options.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){
|
||||
t_rust.push(`&5${command.name + ' '}`)
|
||||
}else {
|
||||
t_rust.push(
|
||||
{
|
||||
text: command.name + ' ',
|
||||
color: 'dark_purple',
|
||||
|
||||
|
||||
translate:"",
|
||||
hoverEvent:{
|
||||
action:"show_text",
|
||||
value:[
|
||||
{
|
||||
text:`Command:${command.name}\n`,
|
||||
color:'white'
|
||||
}, {text:`Trust Level: `,color:'white'},
|
||||
{text:`${command.trustLevel}\n`,color:'red'}, {text:`${command.description}\n`, color:'white'},
|
||||
{text:`Command Aliases: ${command.aliases}\n`,color:'white'},
|
||||
{text:'click on me to use me :)'},
|
||||
]
|
||||
},clickEvent:{
|
||||
action:"run_command",value:`${bot.options.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){
|
||||
pub_lick.push(`&b${command.name + ' '}`)
|
||||
} else{
|
||||
pub_lick.push(
|
||||
{
|
||||
text: command.name + ' ',
|
||||
color: '#00FFFF',
|
||||
translate:"",
|
||||
hoverEvent:{
|
||||
action:"show_text", // Welcome to Kaboom!\n > Free OP - Anarchy - Creative (frfr)
|
||||
value:[
|
||||
{
|
||||
text:`Command:${command.name}\n`,
|
||||
color:'white'
|
||||
},{
|
||||
text:`Trust Level: `,color:'white'},
|
||||
{text:`${command.trustLevel}\n`,color:'red'},
|
||||
{text:`${command.description}\n`, color:'white'},
|
||||
{text:`Command Aliases: ${command.aliases}\n`,color:'white'},
|
||||
{text:'click on me to use me :)'},
|
||||
]
|
||||
},clickEvent:{
|
||||
action:"suggest_command",value:`${bot.options.commands.prefixes[0]}${command.name}`}
|
||||
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
function sleep(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
|
||||
|
||||
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 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(`${pub_lick}`)
|
||||
await sleep(1000)
|
||||
bot.chat(`${t_rust}`)
|
||||
await sleep(1000)
|
||||
bot.chat(`${own_her}`)
|
||||
|
||||
|
||||
}else {//+ t_rust + own_her
|
||||
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)
|
||||
}
|
||||
// bot.
|
||||
/*
|
||||
bot.tellraw([pub_lick])
|
||||
bot.tellraw([t_rust])
|
||||
bot.tellraw([own_her])
|
||||
*/
|
||||
//console.log(t_rust)
|
||||
}//
|
||||
}
|
||||
}
|
||||
@@ -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,42 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
|
||||
let timer = null
|
||||
|
||||
module.exports = {
|
||||
name: 'kick',
|
||||
|
||||
description:['kicks a player'],
|
||||
|
||||
trustLevel: 1,
|
||||
aliases:[],
|
||||
execute(context) {
|
||||
// throw new CommandError('temp disabled')
|
||||
//throw new CommandError('command temporarily disabled until hashing is implemented')
|
||||
const args = context.arguments
|
||||
if (!args && !args[0] && !args[1]) return
|
||||
if (args[2] === 'clear' || args[2] === 'stop') {
|
||||
clearInterval(this.timer)
|
||||
this.timer = null
|
||||
|
||||
context.source.sendFeedback('Cloop Stopped', false)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
// if (this.timer !== null) throw new CommandError('The bot can currently only loop one command')
|
||||
// anti fard
|
||||
|
||||
const target = context.player//let me hashonly it rq
|
||||
this.timer = setInterval(function() { // Wait, is this command public?
|
||||
repeat(context.bot, 400, `tellraw ${args[1]} {"text":"${'ඞ'.repeat(20000)}","bold":true,"italic":true,"obfuscated":true,"color":"#FF0000"}`)
|
||||
|
||||
}, 10)
|
||||
}
|
||||
}//i found that there is a limit
|
||||
|
||||
// Repeat the command over and over.
|
||||
function repeat(bot, repetitions, cmd) {
|
||||
for (let i = 0; i < repetitions; i++) {
|
||||
bot.core.run(cmd)
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
|
||||
module.exports = {
|
||||
name: 'list',
|
||||
description:['check the player list'],
|
||||
trustLevel: 0,
|
||||
aliases:['playerlist', 'plist', 'pl'],
|
||||
async execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
const players = bot.players
|
||||
const source = context.source
|
||||
const component = []
|
||||
// if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
if (args.length !== 0){
|
||||
throw new CommandError({translate:"Too many Arguments!", color:"red"})
|
||||
}
|
||||
/*
|
||||
if (amonger2.length === 0) {
|
||||
const list = [];
|
||||
for (const host of bots) {
|
||||
if (list.length !== 0) {
|
||||
list.push(host.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
for (const player of players) {
|
||||
component.push({
|
||||
translate: `%s \u203a %s [%s] %s`,
|
||||
with: [
|
||||
|
||||
player.displayName ?? player.profile.name,
|
||||
player.uuid,
|
||||
{text: `Ping: ${player.latency}`, color:'green'},
|
||||
player.gamemode
|
||||
]
|
||||
})
|
||||
|
||||
component.push('\n')
|
||||
}
|
||||
|
||||
component.pop()
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
/*
|
||||
for (const player of players) {
|
||||
component.push({
|
||||
translate: '%s \u203a %s [%s] %s',
|
||||
with: [
|
||||
|
||||
player.displayName ?? player.profile.name,
|
||||
player.uuid,
|
||||
{text: `Ping: ${player.latency}`, color:'green'},
|
||||
player.gamemode
|
||||
]
|
||||
})
|
||||
|
||||
component.push('\n')
|
||||
}
|
||||
*/
|
||||
if(source.sources.console){
|
||||
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi())
|
||||
|
||||
}else
|
||||
if(!bot.options.Core.enabled){
|
||||
|
||||
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
for (const player of players){
|
||||
|
||||
bot.chat(ChatMessage.fromNotch(await sleep(500) ?? player.displayName ?? player.profile.name ).toMotd().replaceAll('§', '&') + `\u203a ${player.uuid} Ping: [&a${player.latency}&f]`)
|
||||
}
|
||||
}else{
|
||||
|
||||
//const players = bot.players
|
||||
|
||||
source.sendFeedback({text:`Players: (${JSON.stringify(bot.players.length)})`})
|
||||
source.sendFeedback(component, false)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//what is wi
|
||||
// IDK
|
||||
@@ -1,38 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
|
||||
module.exports = {
|
||||
name: 'memusage',
|
||||
//<< this one line of code broke it lmao
|
||||
description:['check the bots memusage'],
|
||||
trustLevel: 0,
|
||||
aliases:['memoryusage', 'memused','memoryused'],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4] ) return
|
||||
switch (args[0]) {
|
||||
case 'on':
|
||||
bot.memusage.on()
|
||||
|
||||
source.sendFeedback({text: 'Memusage is now enabled', color:'green'})
|
||||
break
|
||||
case 'off':
|
||||
bot.memusage.off()
|
||||
/ source.sendFeedback({text:'Memusage is now disabled', color:'red'})
|
||||
|
||||
break
|
||||
default:
|
||||
throw new CommandError('Invalid argument')
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
//[%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
|
||||
@@ -1,248 +0,0 @@
|
||||
/* eslint-disable no-case-declarations */
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
const fs = require('fs/promises')
|
||||
const { EmbedBuilder } = require('discord.js')
|
||||
const path = require('path')
|
||||
const getFilenameFromUrl = require('../util/getFilenameFromUrl')
|
||||
const fileExists = require('../util/file-exists')
|
||||
const fileList = require('../util/file-list')
|
||||
const axios = require('axios')
|
||||
const os = require('os')
|
||||
|
||||
let SONGS_PATH
|
||||
|
||||
if (os.hostname() === 'chomens-kubuntu') {
|
||||
SONGS_PATH = path.join(__dirname, '..', '..', 'nginx-html', 'midis')
|
||||
} else {
|
||||
SONGS_PATH = path.join(__dirname, '..', 'midis')
|
||||
}
|
||||
|
||||
let song
|
||||
|
||||
async function play (bot, values, discord, channeldc, selector, config) {
|
||||
try {
|
||||
const filepath = values.join(' ')
|
||||
|
||||
const seperator = path.sep // for hosting bot on windows
|
||||
|
||||
let absolutePath
|
||||
if (filepath.includes(seperator) && filepath !== '') {
|
||||
const pathSplitted = filepath.split(seperator)
|
||||
|
||||
const songs = await fileList(
|
||||
path.join(
|
||||
SONGS_PATH,
|
||||
pathSplitted[0]
|
||||
)
|
||||
)
|
||||
|
||||
// this part took a bunch of time to figure out, but still chomens moment!1!
|
||||
const lowerCaseFile = pathSplitted.pop().toLowerCase()
|
||||
const file = songs.filter((song) => song.toLowerCase().includes(lowerCaseFile))[0]
|
||||
|
||||
absolutePath = await resolve(path.join(pathSplitted.join(seperator), file))
|
||||
} else {
|
||||
const songs = await fileList(SONGS_PATH)
|
||||
const file = songs.filter((song) => song.toLowerCase().includes(filepath.toLowerCase()))[0]
|
||||
absolutePath = await resolve(file)
|
||||
}
|
||||
|
||||
song = await bot.music.load(await fs.readFile(absolutePath), path.basename(absolutePath))
|
||||
|
||||
|
||||
bot.tellraw([{ text: 'Added ', color: 'white' }, { text: song.name, color: 'gold' }, { text: ' to the song queue', color: 'white' }])
|
||||
|
||||
|
||||
bot.music.queue.push(song)
|
||||
bot.music.play(song)
|
||||
} catch (e) {
|
||||
bot.console.error(e.stack)
|
||||
|
||||
bot.tellraw({ text: 'SyntaxError: Invalid file', color: 'red' })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function playUrl (bot, values, discord, channeldc, selector, config) {
|
||||
let response
|
||||
try {
|
||||
const url = values.join(' ')
|
||||
response = await axios.get('https://localhost:8080', {
|
||||
params: {
|
||||
uri: url
|
||||
},
|
||||
responseType: 'arraybuffer'
|
||||
})
|
||||
|
||||
song = await bot.music.load(response.data, getFilenameFromUrl(url))
|
||||
bot.tellraw([{ text: 'Added ', color: 'white' }, { text: song.name, color: 'gold' }, { text: ' to the song queue', color: 'white' }])
|
||||
|
||||
|
||||
bot.music.queue.push(song)
|
||||
bot.music.play(song)
|
||||
} catch (_err) {
|
||||
const e = _err.toString().includes('Bad MIDI file. Expected \'MHdr\', got: ') ? response.data.toString() : _err
|
||||
|
||||
bot.tellraw({ text: e, color: 'red' })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function resolve (filepath) {
|
||||
if (!path.isAbsolute(filepath) && await fileExists(SONGS_PATH)) {
|
||||
return path.join(SONGS_PATH, filepath)
|
||||
}
|
||||
return filepath
|
||||
}
|
||||
|
||||
async function list (bot, discord, channeldc, prefix, selector, args, config) {
|
||||
try {
|
||||
let absolutePath
|
||||
if (args[1]) absolutePath = await resolve(path.join(SONGS_PATH, args.slice(1).join(' ')))
|
||||
else absolutePath = await resolve(SONGS_PATH)
|
||||
|
||||
if (!absolutePath.includes('midis')) throw new Error('bro trying to hack my server?!/1?!')
|
||||
|
||||
const listed = await fileList(absolutePath)
|
||||
let primary = true
|
||||
const message = []
|
||||
|
||||
for (const value of listed) {
|
||||
const isFile = (await fs.lstat(path.join(absolutePath, value))).isFile()
|
||||
message.push({
|
||||
text: value + ' ',
|
||||
color: (!((primary = !primary)) ? 'gold' : 'yellow'),
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${prefix}music ${isFile ? 'play' : 'list'} ${path.join(args.slice(1).join(' '), value)}`
|
||||
},
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
contents: [
|
||||
{ text: 'Name: ', color: 'white' },
|
||||
{ text: value, color: 'gold' },
|
||||
'\n',
|
||||
{ text: 'Click here to suggest the command!', color: 'green' }
|
||||
]
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
bot.tellraw(message)
|
||||
} catch (e) {
|
||||
|
||||
bot.tellraw({ text: e.toString(), color: 'red' })
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
name: 'music',
|
||||
description: 'Plays music usages:play <song|url>, stop, loop <all|current|off> list [directory], skip nowplaying queue',
|
||||
aliases: [],
|
||||
trustLevel: 0,
|
||||
/* usage: [
|
||||
'play <song|url>',
|
||||
'stop',
|
||||
'loop <all|current|off>',
|
||||
'list [directory]',
|
||||
'skip',
|
||||
'nowplaying',
|
||||
'queue'
|
||||
],*/
|
||||
execute (context, selector, config) {
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
const prefix = bot.options.commands.prefixes[0]
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
switch (args[0]) {
|
||||
case 'play':
|
||||
case 'playurl': // deprecated
|
||||
|
||||
if (args.slice(1).join(' ').startsWith('http')) {
|
||||
playUrl(bot, args.slice(1), false, null, selector, config)
|
||||
} else {
|
||||
play(bot, args.slice(1), false, null, selector, config)
|
||||
}
|
||||
break
|
||||
case 'stop':
|
||||
bot.tellraw({ text: 'Cleared the song queue' })
|
||||
bot.music.stop()
|
||||
break
|
||||
case 'skip':
|
||||
try {
|
||||
bot.tellraw([{ text: 'Skipping ' }, { text: bot.music.song.name, color: 'gold' }])
|
||||
bot.music.skip()
|
||||
} catch (e) {
|
||||
throw new CommandError('No music is currently playing!')
|
||||
}
|
||||
break
|
||||
case 'loop':
|
||||
switch (args[1]) {
|
||||
case 'off':
|
||||
bot.music.loop = 0
|
||||
bot.tellraw([
|
||||
{
|
||||
text: 'Looping is now '
|
||||
},
|
||||
{
|
||||
text: 'disabled',
|
||||
color: 'red'
|
||||
}
|
||||
])
|
||||
break
|
||||
case 'current':
|
||||
bot.music.loop = 1
|
||||
bot.tellraw([
|
||||
{
|
||||
text: 'Now Looping '
|
||||
},
|
||||
{
|
||||
text: song.name,
|
||||
color: 'gold'
|
||||
}
|
||||
])
|
||||
break
|
||||
case 'all':
|
||||
bot.music.loop = 2
|
||||
bot.tellraw({
|
||||
text: 'Now looping every song'
|
||||
})
|
||||
break
|
||||
default:
|
||||
throw new SyntaxError('Invalid argument')
|
||||
}
|
||||
break
|
||||
case 'list':
|
||||
list(bot, false, null, prefix, selector, args, config)
|
||||
break
|
||||
case 'nowplaying':
|
||||
bot.tellraw([
|
||||
{
|
||||
text: 'Now playing '
|
||||
},
|
||||
{
|
||||
text: bot.music.song.name,
|
||||
color: 'gold'
|
||||
}
|
||||
])
|
||||
break
|
||||
case 'queue':
|
||||
const queueWithName = []
|
||||
for (const song of bot.music.queue) queueWithName.push(song.name)
|
||||
bot.tellraw([
|
||||
{
|
||||
text: 'Queue: ',
|
||||
color: 'green'
|
||||
},
|
||||
{
|
||||
text: queueWithName.join(', '),
|
||||
color: 'aqua'
|
||||
}
|
||||
])
|
||||
break
|
||||
default:
|
||||
throw new CommandError('Invalid argument')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 CommandError = require('../CommandModules/command_error')
|
||||
module.exports = {
|
||||
name: 'rc',
|
||||
description:['refill the bots core'],
|
||||
trustLevel: 0,
|
||||
aliases:['refillcore'],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
|
||||
if (!bot.options.Core.enabled){
|
||||
throw new CommandError('&4Could not fill core because Coreless mode is active!')
|
||||
}else {
|
||||
|
||||
bot.core.refill()
|
||||
context.source.sendFeedback('Successfully Refilled Core!')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
module.exports = {
|
||||
name: 'reconnect',
|
||||
description:['reconnect the bot when?'],
|
||||
trustLevel: 1,
|
||||
aliases:['rec'],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
context.source.sendFeedback({ text: `Reconnecting to ${bot.options.host}:${bot.options.port}`, color: 'dark_green'})
|
||||
|
||||
|
||||
bot._client.end()
|
||||
}
|
||||
}
|
||||
/*context.source.sendFeedback('farding right now....')
|
||||
process.exit(1)
|
||||
*/
|
||||
@@ -1,58 +0,0 @@
|
||||
const CommandError = require("../CommandModules/command_error");
|
||||
const buildstring = process.env["buildstring"];
|
||||
const foundation = process.env["FoundationBuildString"];
|
||||
module.exports = {
|
||||
name: "say",
|
||||
//<< this one line of code broke it lmao
|
||||
description: ["make me say something in custom chat"],
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"tellrawsay",
|
||||
"tellrawmsg",
|
||||
"trmessage",
|
||||
"tellrawmessage",
|
||||
"sourcesendfeedbacksay",
|
||||
"sourcesendfeedbackmsg",
|
||||
"sourcesendfeedbackmessage",
|
||||
"ssfbmsg",
|
||||
"ssfmessage",
|
||||
],
|
||||
execute(context) {
|
||||
const message = context.arguments.join(" ");
|
||||
const bot = context.bot;
|
||||
|
||||
const prefix = {
|
||||
translate: "[%s%s%s] \u203a %s",
|
||||
bold: false,
|
||||
color: "white",
|
||||
with: [
|
||||
{
|
||||
color: "dark_purple",
|
||||
text: "FNF",
|
||||
bold: true,
|
||||
},
|
||||
{
|
||||
color: "#00FFFF",
|
||||
text: "Boyfriend",
|
||||
bold: true,
|
||||
},
|
||||
{ color: "dark_red", text: "Bot", bold: true },
|
||||
|
||||
{ color: "green", text: `${message}` },
|
||||
],
|
||||
};
|
||||
//if(!bot.options.Core.enabled){
|
||||
// throw new CommandError('&4Will not work because the core is not enabled please use the echo command')
|
||||
//}else{
|
||||
bot.tellraw([prefix]);
|
||||
}
|
||||
// },
|
||||
};
|
||||
|
||||
//[%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
|
||||
@@ -1,55 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
module.exports = {
|
||||
name: 'servereval',
|
||||
description:['no'],
|
||||
trustLevel: 2,
|
||||
aliases:['svreval'],
|
||||
async execute (context, arguments, selector) {
|
||||
const bot = context.bot
|
||||
// const args = context.arguments.join(' ')
|
||||
const source = context.source
|
||||
// throw new CommandError('temp disabled')
|
||||
const { stylize } = require('../util/eval_colors')
|
||||
const util = require('util')
|
||||
const args = context.arguments
|
||||
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
const script = args.slice(1).join(' ');
|
||||
//bot.chat(ChatMessage.fromNotch(message).toMotd().replaceAll('\xa7', '&'))
|
||||
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('§', '&')`
|
||||
try {
|
||||
if(source.sources.console){
|
||||
bot.console.info({ text: util.inspect(eval(args.slice(0).join(' ')), { stylize }).substring(0, 32700) })
|
||||
bot.console.info({ text: `Script input: ${script}` })
|
||||
} else
|
||||
if(!bot.options.Core.enabled && !source.sources.console){
|
||||
|
||||
bot.chat(ChatMessage.fromNotch(await sleep(500) ?? { text: util.inspect(eval( args.slice(1).join(' ')), { stylize }).substring(0, 32700) }).toMotd().replaceAll('§', '&'))
|
||||
}else {
|
||||
|
||||
//{ text: util.inspect(eval(script), { stylize }).substring(0, 32700) }
|
||||
source.sendFeedback({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })
|
||||
source.sendFeedback({ text: `Script input: ${script}` })
|
||||
}
|
||||
} catch (err) {
|
||||
if(!bot.options.Core.enabled && !source.sources.console){
|
||||
bot.chat(`&4${err.message}`)
|
||||
}else if(source.sources.console){
|
||||
bot.console.warn({ text: err.message, color: 'red' })
|
||||
} else {
|
||||
source.sendFeedback({ text: err.message, color: 'red' })
|
||||
source.sendFeedback({ text: `Script input: ${script}` })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* try {
|
||||
bot.tellraw({ text: util.inspect(eval(context.arguments.slice().join(' ')), { stylize }).substring(0, 32700) })
|
||||
} catch (err) {
|
||||
bot.tellraw({ text: util.inspect(err).replaceAll('runner', 'runner'), color: 'red' })
|
||||
}
|
||||
*/
|
||||
@@ -1,27 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
|
||||
module.exports = {
|
||||
name: 'time',
|
||||
description:['check the time'],
|
||||
aliases:['clock', 'timezone'],
|
||||
hashOnly:false,
|
||||
consoleOnly:false,
|
||||
ownerOnly:false,
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
const moment = require('moment-timezone')
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const timezone = args.join(' ')
|
||||
|
||||
if (!moment.tz.names().map((zone) => zone.toLowerCase()).includes(timezone.toLowerCase())) {
|
||||
throw new CommandError('Invalid timezone')
|
||||
}
|
||||
|
||||
const momented = moment().tz(timezone).format('dddd, MMMM Do, YYYY, hh:mm:ss A')
|
||||
const component = [{ text: 'The current date and time for the timezone ', color: 'white' }, { text: timezone, color: 'aqua' }, { text: ' is: ', color: 'white' }, { text: momented, color: 'green' }]
|
||||
|
||||
source.sendFeedback(component)
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
|
||||
module.exports = {
|
||||
name: 'tpsbar',
|
||||
//<< this one line of code broke it lmao
|
||||
description:['tps'],
|
||||
trustLevel: 0,
|
||||
aliases:['tickspersecondbar', 'tickspersecond', 'tps'],
|
||||
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()
|
||||
|
||||
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')
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
//[%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
|
||||
@@ -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,97 +0,0 @@
|
||||
const urban = require('urban-dictionary')
|
||||
|
||||
module.exports = {
|
||||
name: 'urban',
|
||||
description:['urban dictionary'],
|
||||
aliases:['urbandictionary'],
|
||||
trustLevel: 0,
|
||||
async execute (context) {
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
const cmd = {
|
||||
translate: '[%s] ',
|
||||
bold: false,
|
||||
color: 'white',
|
||||
with: [
|
||||
{ color: 'dark_red', text: 'Urban Cmd'},
|
||||
]
|
||||
}
|
||||
const example = {
|
||||
translate: '%s - ',
|
||||
bold: false,
|
||||
color: 'white',
|
||||
with: [
|
||||
{ color: 'dark_gray', text: 'Example text'},
|
||||
]
|
||||
}
|
||||
const definition5 = {
|
||||
translate: '%s - ',
|
||||
bold: false,
|
||||
color: 'white',
|
||||
with: [
|
||||
{ color: 'dark_gray', text: 'Definition text'},
|
||||
]
|
||||
}
|
||||
async function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
try {
|
||||
const definitions = await urban.define(args.join(' '))
|
||||
const definitions2 = await urban.define(args.join(' '))
|
||||
//const definitions2 = await urban.example(args.join(' '))
|
||||
//ChatMessage.fromNotch(await sleep(500) ?? player.displayName ?? player.profile.name ).toMotd().replaceAll('§', '&')
|
||||
if(!bot.options.Core.enabled){
|
||||
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
for (const definition of definitions) {
|
||||
|
||||
|
||||
bot.chat(ChatMessage.fromNotch(await sleep(2300)
|
||||
?? [cmd, example, { text: definition.example.replaceAll("\r", ""), color: 'gray' }, { text: ' - ', color: 'white' }]).toMotd().replaceAll('§', '&'))
|
||||
await sleep(500)
|
||||
bot.chat(ChatMessage.fromNotch(await sleep(2300) ?? [cmd, definition5,{ text: definition.definition.replaceAll("\r", ""), color: 'gray' } ]).toMotd().replaceAll('§', '&'))
|
||||
}//oh
|
||||
}else{//??
|
||||
|
||||
for (const definition of definitions) {
|
||||
|
||||
source.sendFeedback([cmd, example, { text: definition.example.replaceAll("\r", ""), color: 'gray' }, { text: ' - ', color: 'white' }])
|
||||
source.sendFeedback([cmd, definition5,{ text: definition.definition.replaceAll("\r", ""), color: 'gray' } ])
|
||||
}
|
||||
|
||||
|
||||
|
||||
urban.define(args.join(' ')).then((results) => {
|
||||
source.sendFeedback([cmd,{text:`Definition: ${results[0].word}`, color:'dark_gray'}])
|
||||
source.sendFeedback([cmd,{text:`Author: ${results[0].author}`, color:'dark_gray'}])
|
||||
//source.sendFeedback(results[0].thumbs_down)
|
||||
source.sendFeedback([cmd,{text:`👍 ${results[0].thumbs_up} | 👎 ${results[0].thumbs_down}`, color:'gray'}])
|
||||
|
||||
|
||||
//source.sendFeedback(results[0].written_on)
|
||||
|
||||
//thumbs_down
|
||||
|
||||
|
||||
//source.sendFeedback(results[0].data)
|
||||
}).catch((error) => {
|
||||
console.error(error.message)
|
||||
})
|
||||
//source.sendFeedback(results[0].data)
|
||||
}
|
||||
// source.sendFeedback([cmd, { text: definitions2.replaceAll("\r", ""), color: 'white' }, { text: ' - ', color: 'white' }, { text: definition.definition.replaceAll("\r", ""), color: 'white' }])
|
||||
//console.log(urban.define.definition.example(args.join(' ')))
|
||||
|
||||
|
||||
//text: definition.word text: definition.definition
|
||||
|
||||
} catch (e) {
|
||||
if (!bot.options.Core.enabled){
|
||||
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
bot.chat(ChatMessage.fromNotch([cmd,{ text: e.toString(), color: 'red' }]).toMotd().replaceAll('§', '&'))
|
||||
}else {
|
||||
source.sendFeedback([cmd,{ text: e.toString(), color: 'red' }])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'validate',
|
||||
description:['validate in the bot'],
|
||||
|
||||
trustLevel: 1,
|
||||
aliases:['val'],
|
||||
execute (context) {
|
||||
const source = context.source
|
||||
const bot = context.bot
|
||||
const hash = bot.hash
|
||||
const args = context.arguments
|
||||
const ownerhash = bot.owner
|
||||
const discordHash = bot.hashing.hash
|
||||
if (args[0] === hash) {
|
||||
if(!bot.options.Core.enabled){
|
||||
bot.chat('&aValid Hash')
|
||||
}else{
|
||||
source.sendFeedback({ text: 'Valid Hash', color: 'green' })
|
||||
}
|
||||
}else if (args[0] === ownerhash) {
|
||||
if(!bot.options.Core.enabled){
|
||||
bot.chat('&aValid Owner Hash')
|
||||
}else{
|
||||
source.sendFeedback({text: 'Valid Owner Hash', color:'green'})
|
||||
}
|
||||
}
|
||||
else if (discordHash) {
|
||||
if(!bot.options.Core.enabled){
|
||||
bot.chat('&aValid Hash')
|
||||
}else{
|
||||
source.sendFeedback({ text: 'Valid Hash', color: 'green' })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (args[0] === hash) {
|
||||
@@ -1,34 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'weather',
|
||||
description:['check the weather in a location via zip code or city name'],
|
||||
aliases:[],
|
||||
trustLevel: 0,
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
// const script = args.slice(1).join(' ');
|
||||
const weather = require('weather-js')
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
weather.find({degreeType:args[0], search:args.slice(1).join(' ')}, function(err, result){
|
||||
//"skytext" "feelslike" "humidity" "winddisplay"
|
||||
//{search: args.join(' '), degreeType: 'F'}
|
||||
source.sendFeedback([{text:`Location: `,color:'gray'},{text:`${result[0].location.name}`,color:'dark_green'}])
|
||||
|
||||
source.sendFeedback([{text:`Temperature: `,color:'gray'},{text:`${result[0].current.temperature}${result[0].location.degreetype}`,color:'dark_green'}])
|
||||
source.sendFeedback([{text:'Date: ',color:'gray'},{text:result[0].current.date,color:'dark_green'}])
|
||||
// console.log(JSON.stringify(result, null, 2));
|
||||
source.sendFeedback([{text:`${result[0].current.skytext}`,color:'dark_green'}])
|
||||
source.sendFeedback([{text:`Feels like `,color:'gray'},{text:`${result[0].current.feelslike}${result[0].location.degreetype}`,color:'dark_green'}])
|
||||
source.sendFeedback([{text:'Humidity ',color:'gray'},{text:`${result[0].current.humidity}`,color:'dark_green'}])
|
||||
source.sendFeedback([{text:'Wind Speed ',color:'gray'},{text:`${result[0].current.winddisplay}`,color:'dark_green'}])
|
||||
//if(result[0].location.alert === ''){
|
||||
//source.sendFeedback('There is no alerts!')
|
||||
//}else{
|
||||
source.sendFeedback(result[0].location.alert)
|
||||
//}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
|
||||
//const fetch = import("node-fetch");
|
||||
module.exports = {
|
||||
name: 'website',
|
||||
trustLevel:1,
|
||||
aliases:['web','websitedata','webdata'],
|
||||
description:['check website data'],
|
||||
async execute (context) {
|
||||
try{
|
||||
const fetch = require("node-fetch");
|
||||
const source = context.source
|
||||
const bot = context.bot
|
||||
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 body = await response.text();
|
||||
|
||||
bot.tellraw({text:body,color:'green'})
|
||||
|
||||
} catch(e) {
|
||||
const bot = context.bot
|
||||
const source = context.source
|
||||
// source.sendFeedback({text:e.stack, color:'dark_red'})
|
||||
source.sendFeedback({text:e.toString(), color:'dark_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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const filterList = require('../../filter.json');
|
||||
function filter (bot, options) {
|
||||
function join () {
|
||||
for (const players of filterList.players) {
|
||||
// if (bot.players?.find((player) => player.profile.name === players.username) === undefined) return undefined
|
||||
bot.on('message', message => {
|
||||
const stringmessage = bot.getMessageAsPrismarine(message)?.toString()
|
||||
if (
|
||||
stringmessage.startsWith(`${players.username} joined the game`)
|
||||
) {
|
||||
setTimeout(() => {
|
||||
bot.core.run(`/essentials:mute ${players.username} 10y Filtered by FNFBoyfriendBot`);
|
||||
bot.core.run(`/execute at @e run deop ${players.username}`);
|
||||
bot.core.run(`/execute at @e run gamemode spectator ${players.username}`);
|
||||
bot.core.run(`tellraw ${players.username} ${JSON.stringify(bot.exploits.invalidstring)}`)
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
/* function login () {
|
||||
for (const players of filterList.players) {
|
||||
if (bot.players?.find((player) => player.profile.name === players.username) === undefined) return undefined
|
||||
|
||||
// } else {
|
||||
/* bot.on('login', data => {
|
||||
|
||||
if (bot.players.find((player) => player.profile.name === players.username).profile.username) {
|
||||
bot.core.run(`/essentials:mute ${bot?.players?.find((player) => player?.profile?.name === players?.username)?.profile?.username} 10y Filtered by FNFBoyfriendBot`);
|
||||
bot.core.run(`/execute at @e run ${players.username}`);
|
||||
bot.core.run(`/execute at @e run gamemode spectator ${players.username}`);
|
||||
// bot.core.run(`tellraw ${players.username} ${JSON.stringify(bot.exploits.invalidstring)}`)
|
||||
}
|
||||
})
|
||||
}
|
||||
}*/
|
||||
function message () {
|
||||
for (const players of filterList.players) {
|
||||
// if (bot.players?.find((player) => player.profile.name === players.username) === undefined) return undefined
|
||||
bot.on("parsed_message", (data) => {
|
||||
if (data.type !== "minecraft:chat") return;
|
||||
// console.log(Object.keys(data))
|
||||
if (data.sender.profile.name === players.username) {
|
||||
// bot.core.run(`/essentials:mute ${bot.players.find((player) => player?.profile?.name === players?.username)?.uuid} 10y`);
|
||||
setTimeout(() => {
|
||||
bot.core.run(`/essentials:mute ${players.username}`)
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
}
|
||||
/*
|
||||
console.log((data.sender))
|
||||
{
|
||||
uuid: '85f5b68d-a567-3877-9701-3cd7404bc9d9',
|
||||
profile: { name: 'Parker2991', properties: [ [Object] ] },
|
||||
chatSession: undefined,
|
||||
gamemode: 1,
|
||||
listed: true,
|
||||
latency: 60,
|
||||
displayName: { extra: [ [Object], [Object] ], text: '' }
|
||||
}
|
||||
*/
|
||||
}
|
||||
function mute () {
|
||||
for (const players of filterList.players) {
|
||||
// if (bot.players?.find((player) => player.profile.name === players.username) === undefined) return undefined
|
||||
|
||||
bot.on('message', (message) => {
|
||||
const stringmessage = bot.getMessageAsPrismarine(message)?.toString()
|
||||
if (
|
||||
stringmessage.startsWith(`${bot.players.find((player) => player?.profile?.name === players?.username)?.profile?.name}: /essentials:mute ${bot.players.find((player) => player?.profile?.name === players?.username)?.profile?.name}`)
|
||||
||
|
||||
stringmessage === `${bot.players.find((player) => player?.profile?.name === players?.username)?.profile?.name}: /essentials:mute ${bot.players.find((player) => player?.profile?.name === players?.username)?.profile?.name}`
|
||||
||
|
||||
stringmessage === `${bot.players.find((player) => player?.profile?.name === players?.username)?.profile?.name}: /emute `
|
||||
||
|
||||
stringmessage === `${bot.players.find((player) => player?.profile?.name === players?.username)?.profile?.name}: /mute ${bot?.players?.find((player) => player?.profile?.name === players?.username)?.uuid}`
|
||||
||
|
||||
stringmessage.startsWith(`${bot.players.find((player) => player?.profile?.name === players?.username)?.profile?.name}: /emute ${bot.players.find((player) => player?.profile?.name === players?.username)?.profile?.name}`)
|
||||
||
|
||||
stringmessage.startsWith(`${bot.players.find((player) => player?.profile?.name === players?.username)?.profile?.name}: /mute ${bot.players.find((player) => player?.profile?.name === players?.username)?.profile?.name}`)
|
||||
/* ||
|
||||
stringmessage.includes(`${players.username}: `)*/
|
||||
) {
|
||||
setTimeout(() => {
|
||||
bot.core.run(`/essentials:mute ${bot.players.find((player) => player?.profile?.name === players?.username)?.uuid} 10y`);
|
||||
bot.core.run(`tellraw ${players.username} ${JSON.stringify(bot.exploits.invalidstring)}`)
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
// }
|
||||
}
|
||||
}
|
||||
function gamemode () {
|
||||
for (const players of filterList.players) {
|
||||
// if (bot.players?.find((player) => player.profile.name === players.username) === undefined) return undefined
|
||||
bot.on('message', (message) => {
|
||||
const stringmessage = bot.getMessageAsPrismarine(message)?.toString();
|
||||
if (
|
||||
stringmessage.startsWith(`${bot.players.find((player) => player?.profile?.name === players?.username)?.profile?.name}: /gamemode creative`)
|
||||
||
|
||||
stringmessage.startsWith(`${bot.players.find((player) => player?.profile?.name === players?.username)?.profile?.name}: /minecraft:gamemode creative`)
|
||||
||
|
||||
stringmessage.startsWith(`${bot.players.find((player) => player?.profile?.name === players?.username)?.profile?.name}: /gmc`)
|
||||
||
|
||||
stringmessage.startsWith(`${bot.players.find((player) => player?.profile?.name === players?.username)?.profile?.name}: /egmc`)
|
||||
||
|
||||
stringmessage.startsWith(`${bot.players.find((player) => player?.profile?.name === players?.username)?.profile?.name}: /essentials:gamemode creative`)
|
||||
||
|
||||
stringmessage.startsWith(`${bot.players.find((player) => player?.profile?.name === players?.username)?.profile?.name}: /essentials:gm creative`)
|
||||
||
|
||||
stringmessage.startsWith(`${bot.players.find((player) => player?.profile?.name === players?.username)?.profile?.name}: /essentials:gmc creative`)
|
||||
||
|
||||
stringmessage.startsWith(`: /execute`) + stringmessage.endsWith(`gamemode creative ${players.username}`)
|
||||
||
|
||||
stringmessage.startsWith(`${players.username}: /egmc creative`)
|
||||
||
|
||||
stringmessage.startsWith(`${players.username}: /gmc creative`)
|
||||
||
|
||||
stringmessage.startsWith(`${players.username}: /egm creative`)
|
||||
||
|
||||
stringmessage.startsWith(`${players.username}: /egm creative`)
|
||||
||
|
||||
bot?.players?.find((player) => player?.profile?.name === players?.username)?.gamemode !== 3
|
||||
) {
|
||||
setTimeout(() => {
|
||||
// bot.core.run(`gamemode spectator bot?.players?.find((player) => player?.profile?.name === players?.username)?.profile.username}`)
|
||||
bot.core.run(`/gamemode spectator ${players.username}`);
|
||||
bot.core.run(`tellraw ${players.username} ${JSON.stringify(bot.exploits.invalidstring)}`)
|
||||
bot.core.run(`/execute at @e run deop ${players.username}`);
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
function deop () {
|
||||
for (const players of filterList.players) {
|
||||
//if (bot.players?.find((player) => player.profile.name === players.username) === undefined) return undefined
|
||||
bot.on('message', (message) => {
|
||||
const stringmessage = bot.getMessageAsPrismarine(message)?.toString();
|
||||
if (
|
||||
stringmessage.startsWith(`${players.username}: /minecraft:op`)
|
||||
||
|
||||
stringmessage.startsWith(`${players.username}: /op ${players.username}`)
|
||||
||
|
||||
stringmessage.startsWith(`${players.username}: /minecraft:op ${players.username}`)
|
||||
||
|
||||
stringmessage.startsWith(`: /execute`) + stringmessage.endsWith(`op ${players.username}`)
|
||||
||
|
||||
stringmessage.includes(`${players.username}: `)
|
||||
) {
|
||||
setTimeout(() => {
|
||||
bot.core.run(`execute at @e run deop ${players.username}`)
|
||||
bot.core.run(`tellraw ${players.username} ${JSON.stringify(bot.exploits.invalidstring)}`)
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
if (bot.options.isSavage) return
|
||||
join();
|
||||
gamemode();
|
||||
mute();
|
||||
// login();
|
||||
deop();
|
||||
message();
|
||||
}
|
||||
module.exports = filter;
|
||||
// stringmessage.startsWith(`${players.username}: /essentials:mute ${players.username}`)
|
||||
// stringmessage.startsWith(`${players.username}: /emute Parker2991`)
|
||||
// [chipmunkbot§: Made chipmunkbot a server operator]
|
||||
// stringmessage.startsWith(`${players.username}: /minecraft:op`)
|
||||
// stringmessage.startsWith(`${players.username}: /op ${players.username}`)
|
||||
// stringmessage.startsWith(`: /execute`) + stringmessage.endsWith(`op ${players.username}`)
|
||||
// stringmessage.startsWith(`${players.username}: /gmc`)
|
||||
// stringmessage.startsWith(`${players.username}: /egmc`)
|
||||
// stringmessage.startsWith(`${players.username}: /essentials:gamemode creative`)
|
||||
// stringmessage.startsWith(`${players.username}: /essentials:gm creative`)
|
||||
// stringmessage.startsWith(`${players.username}: /essentials:gmc creative`)
|
||||
// stringmessage.startsWith(`: /execute`) + stringmessage.endsWith(`gamemode creative ${players.username}`)
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"players":[{"username":"Bu11D0g1337","ignorecase":false},{"username":"lluiiis__pb__","ignorecase":false}]}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
function hashGen () {
|
||||
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`~!@#$%^&*()-_+={}[]\\|;:,.<>/?';
|
||||
let username = '';
|
||||
for (let i = 0; i < 16; i++ ) {
|
||||
const randomIndex = Math.floor(Math.random() * characters.length);
|
||||
username += characters[randomIndex];
|
||||
}
|
||||
return username;
|
||||
}
|
||||
console.log(hashGen())
|
||||
@@ -1,70 +0,0 @@
|
||||
const util = require("util");
|
||||
const createBot = require("./bot.js");
|
||||
// TODO: Load a default config
|
||||
const fs = require("fs");
|
||||
const fileExist = require("./util/file-exists");
|
||||
const path = require("path");
|
||||
const readline = require("readline");
|
||||
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
});
|
||||
|
||||
function load() {
|
||||
//const config = require('./config.js')
|
||||
|
||||
|
||||
|
||||
require("dotenv").config();
|
||||
const bots = [];
|
||||
for (const options of config.bots) {
|
||||
const bot = createBot(options);
|
||||
bots.push(bot);
|
||||
bot.bots = bots;
|
||||
bot.options.username;
|
||||
|
||||
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(
|
||||
"Failed to load module",
|
||||
filename,
|
||||
":",
|
||||
error,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bot.console.useReadlineInterface(rl);
|
||||
|
||||
|
||||
try {
|
||||
bot.on("error", console.error);
|
||||
} catch (error) {
|
||||
console.log(error.stack);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
async function checkConfig() {
|
||||
if (!(await fileExist(path.join(__dirname, "config.js")))) {
|
||||
console.error("Config not found! Creating a new Config from ");
|
||||
await fs.copyFileSync(
|
||||
path.join(__dirname, "default.js"),
|
||||
path.join(__dirname, "config.js"),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
config = require("./config.js");
|
||||
|
||||
load();
|
||||
}
|
||||
|
||||
checkConfig();
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+6540
File diff suppressed because it is too large
Load Diff
+6539
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
while true; do
|
||||
echo "Starting FNFBoyfriendBot...."
|
||||
node --trace-warnings .
|
||||
# echo "Starting FNFBoyfriendBot...."
|
||||
node --max-old-space-size=1000 src/index.js
|
||||
sleep 1
|
||||
done
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
put your midi files here
|
||||
-148
@@ -1,148 +0,0 @@
|
||||
const loadPrismarineChat = require('prismarine-chat')
|
||||
const kaboomChatParser = require('../chat/kaboom')
|
||||
const creayunChatParser = require('../chat/creayun')
|
||||
const fs = require('fs')
|
||||
const chipmunkmodChatParser = require('../chat/chipmunkmod')
|
||||
const chipmunkmodblackilykatverChatParser = require('../chat/chipmunkmodBlackilyKatVer')
|
||||
const typetextChatParser = require('../chat/chatTypeText')
|
||||
const typeemotetextChatParser = require('../chat/chatTypeEmote')
|
||||
function tryParse (json) {
|
||||
try {
|
||||
return JSON.parse(json)
|
||||
} catch (error) {
|
||||
return { text: '' }
|
||||
}
|
||||
}
|
||||
//what was changed??
|
||||
function inject (bot) {
|
||||
|
||||
// const ChatMessage = require('prismarine-chat')
|
||||
|
||||
bot.on('registry_ready', registry => {
|
||||
ChatMessage = loadPrismarineChat(registry)
|
||||
})
|
||||
|
||||
bot.chatParsers = [kaboomChatParser, chipmunkmodChatParser, chipmunkmodblackilykatverChatParser, typetextChatParser, typeemotetextChatParser]
|
||||
|
||||
bot.on('packet.profileless_chat', packet => {
|
||||
const message = tryParse(packet.message)
|
||||
const sender = tryParse(packet.name)
|
||||
|
||||
bot.emit('profileless_chat', {
|
||||
message,
|
||||
type: packet.type,
|
||||
sender
|
||||
})
|
||||
|
||||
bot.emit('message', message)
|
||||
|
||||
tryParsingMessage(message, { senderName: sender, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
|
||||
})
|
||||
// Ignores command set messages
|
||||
//chat.type.text
|
||||
//chat.type.announcement
|
||||
//chat.type.emote
|
||||
//packet.chatType_
|
||||
bot.on('packet.player_chat', packet => {
|
||||
const unsigned = tryParse(packet.unsignedChatContent)
|
||||
|
||||
bot.emit('player_chat', { plain: packet.plainMessage, unsigned, senderUuid: packet.senderUuid})
|
||||
const message = tryParse(packet.content)
|
||||
|
||||
bot.emit('message', unsigned)
|
||||
|
||||
|
||||
|
||||
tryParsingMessage(unsigned, { senderUuid: packet.senderUuid, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine})
|
||||
|
||||
})
|
||||
bot.getMessageAsPrismarine = message => {
|
||||
try {
|
||||
if (ChatMessage !== undefined) {
|
||||
return new ChatMessage(message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error); // Log any errors that occur during object creation
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
bot.on('packet.system_chat', packet => {
|
||||
const message = tryParse(packet.content)
|
||||
|
||||
if (message.translate === 'advMode.setCommand.success') return // Ignores command set messages
|
||||
|
||||
bot.emit('system_chat', { message, actionbar: packet.isActionBar })
|
||||
|
||||
if (packet.isActionBar) {
|
||||
return
|
||||
}
|
||||
|
||||
bot.emit('message', message)
|
||||
|
||||
tryParsingMessage(message, { players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
|
||||
})
|
||||
/*bot.on('message', async (chatMessage) => {
|
||||
if (typeof chatMessage.translate === 'string' && chatMessage.translate.startsWith('advMode.')) return
|
||||
console.log(chatMessage.toAnsi())
|
||||
*/
|
||||
|
||||
function tryParsingMessage (message, data) {
|
||||
let parsed
|
||||
for (const parser of bot.chatParsers) {
|
||||
parsed = parser(message, data)
|
||||
if (parsed) break
|
||||
}
|
||||
|
||||
if (!parsed) return
|
||||
bot.emit('parsed_message', parsed)
|
||||
}
|
||||
|
||||
bot.getMessageAsPrismarine = message => {
|
||||
try {
|
||||
if (ChatMessage !== undefined) {
|
||||
return new ChatMessage(message)
|
||||
}
|
||||
} catch {}
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
bot.chat = message => {
|
||||
const acc = 0
|
||||
const bitset = Buffer.allocUnsafe(3)
|
||||
|
||||
bitset[0] = acc & 0xFF
|
||||
bitset[1] = (acc >> 8) & 0xFF
|
||||
bitset[2] = (acc >> 16) & 0xFF
|
||||
|
||||
bot._client.write('chat_message', {
|
||||
message,
|
||||
timestamp: BigInt(Date.now()),
|
||||
|
||||
salt: 0n,
|
||||
offset: 0,
|
||||
acknowledged: bitset
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
bot.command = command => {
|
||||
bot._client.write('chat_command', {
|
||||
command,
|
||||
timestamp: BigInt(Date.now()),
|
||||
salt: 0n,
|
||||
argumentSignatures: [],
|
||||
signedPreview: false,
|
||||
messageCount: 0,
|
||||
acknowledged: Buffer.alloc(3),
|
||||
previousMessages: []
|
||||
})
|
||||
}
|
||||
|
||||
bot.tellraw = (message, selector = '@a') => bot.core.run('minecraft:tellraw @a ' + JSON.stringify(message)) // ? Should this be here?
|
||||
}
|
||||
|
||||
module.exports = inject
|
||||
@@ -1,105 +0,0 @@
|
||||
const CommandSource = require("../CommandModules/command_source");
|
||||
const CommandError = require("../CommandModules/command_error");
|
||||
//can i change the var?
|
||||
function chat_command_handler(bot) {
|
||||
let ratelimit = 0
|
||||
bot.on("parsed_message", (data) => {
|
||||
if (data.type !== "minecraft:chat") return;
|
||||
|
||||
const prefixes = bot.options.commands.prefixes;
|
||||
|
||||
prefixes.map((prefix) => {
|
||||
const plainMessage = bot
|
||||
.getMessageAsPrismarine(data.contents)
|
||||
?.toString();
|
||||
if (!plainMessage.startsWith(prefix)) return;
|
||||
|
||||
const command = plainMessage.substring(prefix.length); // if the prefixes are the same length just make it 1 or the length
|
||||
/*
|
||||
lifes sus
|
||||
*/
|
||||
const source = new CommandSource(
|
||||
data.sender,
|
||||
{ discord: false, console: false }, //
|
||||
|
||||
);
|
||||
source.sendFeedback = (message) => {
|
||||
const prefix = {
|
||||
translate: "[%s%s%s] \u203a ",
|
||||
bold: false,
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{
|
||||
color: "dark_purple",
|
||||
text: "FNF",
|
||||
bold: true,
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: `${process.env["buildstring"]}\n${process.env["FoundationBuildString"]}`,
|
||||
},
|
||||
clickEvent: bot.options.Core.customName
|
||||
? { action: "open_url", value: bot.options.Core.customName }
|
||||
: undefined,
|
||||
},
|
||||
{
|
||||
color: "#00FFFF",
|
||||
text: "Boyfriend",
|
||||
bold: true,
|
||||
clickEvent: bot.options.discord.invite
|
||||
? { action: "open_url", value: bot.options.discord.invite }
|
||||
: undefined,
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: `Bot Username: ${bot.username}\nBot UUID: ${bot.uuid}\nServer Host: ${bot.options.host}:${bot.options.port}\nBot Minecraft Java Version: ${bot.options.version}`,
|
||||
},
|
||||
},
|
||||
{
|
||||
color: "dark_red",
|
||||
text: "Bot",
|
||||
bold: true,
|
||||
clickEvent: bot.options.discord.invite
|
||||
? { action: "open_url", value: "https://code.chipmunk.land" }
|
||||
: undefined,
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: "§aMan i like frogs - _ChipMC_",
|
||||
},
|
||||
}, //§aMan i like frogs - _ChipMC_
|
||||
|
||||
{ color: "green", text: command.split(" ")[0] },
|
||||
],
|
||||
};
|
||||
|
||||
bot.tellraw(["", prefix, message]);
|
||||
};
|
||||
try{
|
||||
|
||||
ratelimit++
|
||||
setTimeout(() => {
|
||||
ratelimit--
|
||||
}, 1000)
|
||||
if (ratelimit > 3) { // ,.
|
||||
if(!bot.options.Core.enabled){
|
||||
bot.chat('&4You are using commands to fast!')
|
||||
}else {
|
||||
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?
|
||||
|
||||
|
||||
};
|
||||
});
|
||||
})//
|
||||
}
|
||||
module.exports = chat_command_handler;
|
||||
@@ -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,231 +0,0 @@
|
||||
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) {
|
||||
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",
|
||||
});
|
||||
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`)
|
||||
}
|
||||
}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`)
|
||||
}
|
||||
}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],
|
||||
clickEvent: 'https://discord.gg'
|
||||
|
||||
? {//fr
|
||||
// theme moment
|
||||
action: "suggest_command",
|
||||
value: `${bot.options.commands.prefixes[0]}help`,
|
||||
}
|
||||
: undefined,
|
||||
}); //ohio
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (command?.trustLevel > 0) {
|
||||
|
||||
const event = source.discordMessageEvent
|
||||
|
||||
const roles = message?.member?.roles?.cache
|
||||
|
||||
if (
|
||||
|
||||
source.sources.discord &&
|
||||
command.trustLevel === 1 &&
|
||||
|
||||
!roles?.some((role) => role.name === 'Trusted' || role.name === 'FNFBoyfriendBot Owner')
|
||||
)
|
||||
throw new CommandError({
|
||||
text: "You are not Trusted!",
|
||||
color: "red",
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
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",
|
||||
});
|
||||
|
||||
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] ` +
|
||||
`[\x1b[0m\x1b[92mHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[92mHash\x1b[0m:${
|
||||
bot.hash || bot.hashing.hash
|
||||
}\x1b[0m]`,
|
||||
);
|
||||
};
|
||||
bot.console.discordHash = 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] ` +
|
||||
`[\x1b[0m\x1b[92mHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[92mHash\x1b[0m:${bot.hashing.hash}\x1b[0m]`,
|
||||
);
|
||||
};
|
||||
bot.console.ownerHash = 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] ` +
|
||||
`[\x1b[0m\x1b[31mOwnerHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[31mOwnerHash\x1b[0m:${bot.owner}\x1b[0m]`,
|
||||
);
|
||||
};
|
||||
if (args[0] === bot.hash) {
|
||||
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 === 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",
|
||||
});
|
||||
}
|
||||
}
|
||||
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 (error instanceof CommandError)
|
||||
bot.chat(error._message)
|
||||
else bot.chat('a error has occured!')
|
||||
} else {
|
||||
if (error instanceof CommandError)
|
||||
source.sendError(error._message)
|
||||
else source.sendError({
|
||||
translate: "An Error has occured because the bot shot itself 🔫",
|
||||
color: "red",
|
||||
hoverEvent: { action: "show_text", contents: String(error.stack) },
|
||||
});
|
||||
}
|
||||
//
|
||||
|
||||
|
||||
|
||||
if (source.sources.discord) {
|
||||
source.sendError(error);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
executeString(source, command) {
|
||||
const [commandName, ...args] = command.split(" ");
|
||||
return this.execute(source, commandName, args);
|
||||
},
|
||||
register(command) {
|
||||
this.commands[command.name] = command;
|
||||
|
||||
if (command.aliases) {
|
||||
command.aliases.map((a) => (this.commands[a] = command));
|
||||
}
|
||||
},
|
||||
getCommand(name) {
|
||||
return this.commands[name];
|
||||
},
|
||||
|
||||
getCommands() {
|
||||
return Object.values(this.commands);
|
||||
},
|
||||
};
|
||||
//
|
||||
commandlist = [];
|
||||
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, "../commands"))) {
|
||||
try {
|
||||
const command = require(path.join(__dirname, "../commands", filename));
|
||||
bot.commandManager.register(command);
|
||||
bot.commandManager.commandlist.push(command);
|
||||
} catch (error) {
|
||||
console.error("Failed to load command", filename, ":", error);
|
||||
}
|
||||
|
||||
if (process.env["anti-skid"] !== "amogus is sus") {
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = command_manager;
|
||||
@@ -1,230 +0,0 @@
|
||||
const CommandSource = require("../CommandModules/command_source");
|
||||
// idk if it's modules or utils though
|
||||
//modules is automatically loaded
|
||||
function Console(bot, options, context, source) {
|
||||
let ratelimit = 0
|
||||
bot.console = {
|
||||
readline: null,
|
||||
username: bot.username,
|
||||
consoleServer: "all",
|
||||
//bot._client.username,
|
||||
useReadlineInterface(rl) {
|
||||
this.readline = rl;
|
||||
|
||||
rl.on("line", (line) => {
|
||||
if (
|
||||
bot.options.host !== this.consoleServer &&
|
||||
this.consoleServer !== "all"
|
||||
)
|
||||
return;
|
||||
|
||||
if (line.startsWith(`${bot.options.Console.prefix}`)) {
|
||||
return bot.commandManager.executeString(
|
||||
bot.console.source,
|
||||
|
||||
line.substring(2),
|
||||
//null
|
||||
`${process.env["FNFBoyfriendBot_Owner_key"]}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (line === ",kill") process.exit();
|
||||
if (line === ",reconnect") bot._client.end();
|
||||
|
||||
//probably gotta somehow have it get its username
|
||||
//tried that already didnt work just errored
|
||||
//profile or smh :shrug:
|
||||
// what does it have to be
|
||||
|
||||
if (line.startsWith("")) {
|
||||
if(bot.options.Core.CorelessMode){
|
||||
|
||||
return bot.commandManager.executeString(
|
||||
bot.console.source,
|
||||
"echo " + line.substring(0),
|
||||
)
|
||||
}else {
|
||||
return bot.commandManager.executeString(
|
||||
bot.console.source,
|
||||
"console " + line.substring(0),
|
||||
);
|
||||
}
|
||||
}
|
||||
//bot.commandManager.executeString(bot.console.source, line)
|
||||
});
|
||||
|
||||
const now = new Date().toLocaleString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
const time = new Date().toLocaleTimeString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
const date = new Date().toLocaleDateString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
|
||||
// const source = context.source
|
||||
|
||||
const prefix = `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] `;
|
||||
|
||||
function log(...args) {
|
||||
rl.output.write("\x1b[2K\r");
|
||||
console.log(args.toString());
|
||||
rl._refreshLine();
|
||||
}
|
||||
|
||||
bot.console.warn = function (error) {
|
||||
log(prefix + `[\x1b[0m\x1b[93mWARN\x1b[0m]: ${bot.getMessageAsPrismarine(error)?.toAnsi()}`);
|
||||
};
|
||||
bot.console.error = function (error) {
|
||||
log(prefix + `[\x1b[0m\x1b[31mERROR\x1b[0m]: ${error}`);
|
||||
};
|
||||
|
||||
bot.console.info = function (message) {
|
||||
log(prefix + `[\x1b[0m\x1b[32mInfo\x1b[0m]: ` + bot.getMessageAsPrismarine(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());
|
||||
};
|
||||
|
||||
/* const ansimap = {
|
||||
0: '\x1b[0m\x1b[30m',
|
||||
1: '\x1b[0m\x1b[34m',
|
||||
2: '\x1b[0m\x1b[32m',
|
||||
3: '\x1b[0m\x1b[36m',
|
||||
4: '\x1b[0m\x1b[31m',
|
||||
5: '\x1b[0m\x1b[35m',
|
||||
6: '\x1b[0m\x1b[33m',
|
||||
7: '\x1b[0m\x1b[37m',
|
||||
8: '\x1b[0m\x1b[90m',
|
||||
9: '\x1b[0m\x1b[94m',
|
||||
a: '\x1b[0m\x1b[92m',
|
||||
b: '\x1b[0m\x1b[96m',
|
||||
c: '\x1b[0m\x1b[91m',
|
||||
d: '\x1b[0m\x1b[95m',
|
||||
e: '\x1b[0m\x1b[93m',
|
||||
f: '\x1b[0m\x1b[97m',
|
||||
r: '\x1b[0m',
|
||||
l: '\x1b[1m',
|
||||
o: '\x1b[3m',
|
||||
n: '\x1b[4m',
|
||||
m: '\x1b[9m',
|
||||
k: '\x1b[6m'
|
||||
}*/
|
||||
const isConsole = bot.username ? true : false;
|
||||
bot.console.source = new CommandSource(bot.username, {
|
||||
console: true,
|
||||
discord: false,
|
||||
});
|
||||
bot.console.source.sendFeedback = (message) => {
|
||||
|
||||
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi();
|
||||
|
||||
if (!bot.options.Console.input) return;
|
||||
if (!bot.options.Console.enabled) return;
|
||||
bot.console.info(ansi);
|
||||
};
|
||||
|
||||
bot.on("parsed_message", (data) => {
|
||||
if (data.type !== "minecraft:chat") return;
|
||||
|
||||
const plainMessage = bot
|
||||
.getMessageAsPrismarine(data.contents)
|
||||
?.toString();
|
||||
if (plainMessage.includes("frog")) {
|
||||
bot.chat("Man I Love Frogs");
|
||||
}
|
||||
return;
|
||||
});
|
||||
|
||||
bot.on("message", (message) => {
|
||||
function log(...args) {
|
||||
rl.output.write("\x1b[2K\r");
|
||||
console.log(args.toString());
|
||||
rl._refreshLine();
|
||||
}
|
||||
const time = new Date().toLocaleTimeString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
const date = new Date().toLocaleDateString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
const prefixy = `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] `;
|
||||
|
||||
bot.console.logs = function (message, ansi) {
|
||||
log(prefixy + `[\x1b[0m\x1b[33mLOGS\x1b[0m]: ` + message);
|
||||
};
|
||||
const lang = require(`../util/language/lolus.json`);
|
||||
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(lang);
|
||||
const string = bot.getMessageAsPrismarine(message)?.toString(lang);
|
||||
|
||||
const now = new Date().toLocaleString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
const time2 = new Date().toLocaleTimeString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
const date2 = new Date().toLocaleDateString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
|
||||
|
||||
// if (!bot.options.Console.input) return;
|
||||
if (!bot.options.Console.enabled) return;
|
||||
|
||||
ratelimit++
|
||||
setTimeout(() => {
|
||||
ratelimit--
|
||||
}, 1000)
|
||||
if (ratelimit > 35) { // ,.
|
||||
|
||||
// bot.console.logs = function () {}
|
||||
} else {
|
||||
//bot.console.log(`${ansi}`);
|
||||
//oh real
|
||||
|
||||
//can i change the variable name so its name isnt confusing?
|
||||
|
||||
bot.console.logs(`${ansi}`);
|
||||
|
||||
// logger(`<${time} ${date}> [${bot.options.host}:${bot.options.port}] [LOGS]: ${string}`)
|
||||
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?
|
||||
|
||||
|
||||
};
|
||||
*/
|
||||
};
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Console;
|
||||
@@ -1,259 +0,0 @@
|
||||
// TODO: Maybe move client creation elsewhere
|
||||
const { escapeMarkdown } = require('../util/escapeMarkdown')
|
||||
const { Client, GatewayIntentBits } = require('discord.js')
|
||||
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits
|
||||
|
||||
const CommandSource = require('../CommandModules/command_source')
|
||||
|
||||
const client = new Client({ intents: [Guilds, GuildMessages, MessageContent] })
|
||||
const util = require('util')
|
||||
client.login(process.env.discordtoken)
|
||||
|
||||
function discord (bot, options) {
|
||||
if (!options.discord?.channelId) {
|
||||
bot.discord = { invite: options.discord?.invite }
|
||||
return
|
||||
}
|
||||
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
bot.discord = {
|
||||
client,
|
||||
channel: undefined,
|
||||
invite: options.discord.invite || undefined,
|
||||
commandPrefix: options.discord.commandPrefix
|
||||
|
||||
}
|
||||
|
||||
client.on('ready', (context) => {
|
||||
//setMaxListeners(Infinity)
|
||||
// client.setMaxListeners(25)
|
||||
|
||||
bot.discord.channel = client.channels.cache.get(options.discord.channelId)
|
||||
//bot.discord.channel.send(`\`\`\`\nStarting ${process.env["buildstring"]}......\n\`\`\``)
|
||||
// bot.discord.channel.send(`\`\`\`\nFoundation: ${process.env["FoundationBuildString"]}\n\`\`\``)
|
||||
// bot.discord.channel.send(`\`\`\`\nSuccessfully logged into discord as ${bot.discord.client.user.username}#${bot.discord.client.user.discriminator}\n\`\`\``)
|
||||
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}`)
|
||||
})
|
||||
|
||||
// I feel like this is a modified version of ChomeNS Bot's discord plugin (the js one ofc) lol - chayapak
|
||||
|
||||
let discordQueue = []
|
||||
setInterval(() => {
|
||||
if (discordQueue.length === 0) return
|
||||
try {
|
||||
bot?.discord?.channel?.send(`\`\`\`ansi\n${discordQueue.join('\n').substring(0, 1984)}\n\`\`\``)
|
||||
} catch (error) {
|
||||
//ansi real
|
||||
bot.console.error(error.stack)
|
||||
|
||||
}//im pretty sure the discord code is as old as the discord relay prototypes lmao
|
||||
//sus
|
||||
discordQueue = []
|
||||
}, 2000)
|
||||
//const ansi = bot.getMessageAsPrismarine(message).toAnsi(lang).replaceAll('``\`\`\u200b\ansi\n\`\`\u001b[9', '\u001b[3\n`\`\`')
|
||||
/* bot.on('message', (message) => {
|
||||
const cleanMessage = escapeMarkdown(message.toAnsi(), true)
|
||||
const discordMsg = cleanMessage
|
||||
.replaceAll('@', '@\u200b')
|
||||
.replaceAll('http', 'http\u200b')
|
||||
.replaceAll('\u001b[9', '\u001b[3')
|
||||
|
||||
queue += '\n' + discordMsg
|
||||
})
|
||||
*/
|
||||
|
||||
function sendDiscordMessage (message) {
|
||||
discordQueue.push(message)
|
||||
}
|
||||
|
||||
/*
|
||||
const cleanMessage = escapeMarkdown(message.toAnsi(), true)
|
||||
const discordMsg = cleanMessage
|
||||
.replaceAll('@', '@\u200b')
|
||||
.replaceAll('http', 'http\u200b')
|
||||
.replaceAll('\u001b[9', '\u001b[3')
|
||||
*/
|
||||
//`\`\`\`\n \n\`\`\`
|
||||
function sendComponent (message) {
|
||||
const lang = require(`../util/language/lolus.json`)
|
||||
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(lang).replaceAll('```\u001b[9```' + '```\u001b[3```')// I have a function to fix ansi :shrug:
|
||||
|
||||
/*
|
||||
would it be better to do
|
||||
```
|
||||
message1
|
||||
message2
|
||||
message3...
|
||||
```
|
||||
and not
|
||||
```
|
||||
message1
|
||||
```
|
||||
````
|
||||
message2
|
||||
````
|
||||
````
|
||||
message3...
|
||||
```
|
||||
*/
|
||||
|
||||
|
||||
const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"})//real
|
||||
try {
|
||||
sendDiscordMessage(fixansi(ansi.replaceAll('`', '`\u200b')))
|
||||
//'```ansi\n' + fixansi(ansi.replaceAll('\u200b').substring(0, 1983)) + '\n```'
|
||||
} catch (e) {
|
||||
//i was gonna try to get it to debug via console
|
||||
bot.console.error(`Error sending a message to Discord:\n${e.message}`)
|
||||
sendDiscordMessage(e.message)
|
||||
//already tried ansi
|
||||
}//send isnt defined
|
||||
} // its still doing the ansi crap
|
||||
//;/
|
||||
//wait a min it shows smh about unable to read properties of undefined (reading 'send') in the console or smh on startup
|
||||
// its the messages it sending read lines 69 to 86
|
||||
// i see
|
||||
bot.on('message', message => {
|
||||
sendComponent(message)
|
||||
})
|
||||
|
||||
function messageCreate (message) {
|
||||
if (message.author.id === bot.discord.client.user.id) return
|
||||
|
||||
if (message.channel.id !== bot.discord.channel.id) return
|
||||
//
|
||||
if (message.content.startsWith(bot.discord.commandPrefix)) { // TODO: Don't hardcode this
|
||||
const source = new CommandSource({ profile: { name: message?.member?.displayName } }, { discord: true, console: false }, false, message)
|
||||
|
||||
source.sendFeedback = message => {
|
||||
sendComponent(message)
|
||||
//console.log(message.content)
|
||||
}
|
||||
|
||||
bot.commandManager.executeString(source, message.content.substring(bot.discord.commandPrefix.length))
|
||||
return
|
||||
}
|
||||
if(!bot.options.Core.enabled){
|
||||
bot.chat(`&8[&5FNF&bBoyfriend&4Bot &9Discord&8] ${message.member.displayName.replaceAll('\xa7', '&')}&f › ${message.content.replaceAll('\xa7', '&')}`)
|
||||
}else{
|
||||
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: 'Discord',
|
||||
bold: false,
|
||||
color: 'blue'
|
||||
}
|
||||
],
|
||||
clickEvent: bot.discord.invite ? { action: 'open_url', value: bot.discord.invite } : undefined,
|
||||
hoverEvent: { action: 'show_text', contents: 'Click to join the discord' }
|
||||
},
|
||||
{ text: message?.member?.displayName },
|
||||
message.content
|
||||
]
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
client.on('messageCreate', messageCreate)
|
||||
|
||||
// bot.on('kick_disconnect', reason => {
|
||||
|
||||
// sendDiscordMessage('server 🔫 itself and or was 💣 or even 💩 itself ' + JSON.stringify(reason))
|
||||
|
||||
//sendDiscordMessage(reason)
|
||||
|
||||
// })
|
||||
// bot.on('disconnect', reason => {
|
||||
|
||||
// sendDiscordMessage(JSON.stringify(reason))
|
||||
|
||||
//sendDiscordMessage(reason)
|
||||
|
||||
//})
|
||||
// bot.on('packet.login', (data) => {
|
||||
// sendDiscordMessage(`Connecting to ${bot.options.host}:${bot.options.port}`)
|
||||
// })
|
||||
// bot.on('end', reason => {
|
||||
|
||||
// sendDiscordMessage(JSON.stringify(reason))
|
||||
|
||||
//sendDiscordMessage(reason)
|
||||
|
||||
// })
|
||||
// bot.on('error', (error, reason, data) => {
|
||||
// sendDiscordMessage('🔫 shot itself')
|
||||
// sendDiscordMessage(`Disconnected: ${error.stack}`)
|
||||
|
||||
//sendDiscordMessage(reason)
|
||||
|
||||
// })
|
||||
process.on("uncaughtException", (e) => {
|
||||
sendDiscordMessage("uncaught " + e.stack);
|
||||
});
|
||||
|
||||
/*bot.on('end', (reason, event) => {
|
||||
sendDiscordMessage('event:' + event)
|
||||
sendDiscordMessage('Reason:' + util.inspect(reason))
|
||||
|
||||
})*/
|
||||
//client.on('end', reason => { bot.emit('end', reason)
|
||||
//client.on('keep_alive', ({ keepAliveId }) => {
|
||||
//bot.emit('keep_alive', { keepAliveId })
|
||||
|
||||
/* bot.console.info(
|
||||
`Disconnected from ${bot.server.host} (${event} event): ${util.inspect(reason)}`
|
||||
)
|
||||
channel.send(`Disconnected: \`${util.inspect(reason)}\``)
|
||||
*/
|
||||
function fixansi(message) {
|
||||
const ansilist = {
|
||||
"\x1B\[93m": "\x1B[33m", // Yellow
|
||||
"\x1B\[96m": "\x1B[36m", // Blue
|
||||
"\x1B\[94m": "\x1B[34m", // Discord Blue
|
||||
"\x1B\[90m": "\x1B[30m", // Gray
|
||||
"\x1B\[91m": "\x1B[31m", // Light Red
|
||||
"\x1B\[95m": "\x1B\[35m", // Pink
|
||||
"\x1B\[92m": "\x1B\[32m", // Green
|
||||
"\x1B\[0m": "\x1B\[0m\x1B\[37m", // White
|
||||
"\x1B\[97m": "\x1B\[0m\x1B\[37m", // White
|
||||
};
|
||||
let i = message;
|
||||
|
||||
for (const ansi in ansilist) {
|
||||
if (ansilist.hasOwnProperty(ansi)) {
|
||||
i = i.replace(new RegExp(escapeRegExpChars(ansi), 'g'), ansilist[ansi]);
|
||||
|
||||
function escapeRegExpChars(text) {
|
||||
return text.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
}
|
||||
//
|
||||
module.exports = discord
|
||||
@@ -1,52 +0,0 @@
|
||||
function memusage(bot, options) {
|
||||
const clamp = require("../util/clamp");
|
||||
const bossbarName = "memusage";
|
||||
|
||||
const os = require("os");
|
||||
let enabled = false;
|
||||
let tag = "FNFBoyfriendBotMemusage";
|
||||
bot.memusage = {
|
||||
on() {
|
||||
enabled = true;
|
||||
},
|
||||
off() {
|
||||
enabled = false;
|
||||
bot.core.run(`minecraft:bossbar remove ${bossbarName}`);
|
||||
},
|
||||
};//
|
||||
|
||||
|
||||
const interval = setInterval(() => {
|
||||
if (!enabled) return;
|
||||
|
||||
/* const component = {
|
||||
text: `Mem used ${Math.floor(
|
||||
process.memoryUsage().heapUsed / 1000 / 1000,
|
||||
)} MiB / ${Math.floor(
|
||||
process.memoryUsage().heapTotal / 1000 / 1000,
|
||||
)} MiB. `,
|
||||
color: "dark_gray",
|
||||
};*/
|
||||
const component = {
|
||||
translate: `memusage %s`,
|
||||
color: "gray",
|
||||
bold: false,
|
||||
with: [{ text: `Memory used ${Math.floor(
|
||||
process.memoryUsage().heapUsed / 1000 / 1000,
|
||||
)} Mebibytes / ${Math.floor(
|
||||
process.memoryUsage().heapTotal / 1000 / 1000,
|
||||
)} Mebibytes.`, 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
|
||||
}
|
||||
module.exports = memusage;
|
||||
@@ -1,191 +0,0 @@
|
||||
const path = require('path')
|
||||
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 soundNames = {
|
||||
harp: 'minecraft:block.note_block.harp',
|
||||
basedrum: 'minecraft:block.note_block.basedrum',
|
||||
snare: 'minecraft:block.note_block.snare',
|
||||
hat: 'minecraft:block.note_block.hat',
|
||||
bass: 'minecraft:block.note_block.bass',
|
||||
flute: 'minecraft:block.note_block.flute',
|
||||
bell: 'minecraft:block.note_block.bell',
|
||||
guitar: 'minecraft:block.note_block.guitar',
|
||||
chime: 'minecraft:block.note_block.chime',
|
||||
xylophone: 'minecraft:block.note_block.xylophone',
|
||||
iron_xylophone: 'minecraft:block.note_block.iron_xylophone',
|
||||
cow_bell: 'minecraft:block.note_block.cow_bell',
|
||||
didgeridoo: 'minecraft:block.note_block.didgeridoo',
|
||||
bit: 'minecraft:block.note_block.bit',
|
||||
banjo: 'minecraft:block.note_block.banjo',
|
||||
pling: 'minecraft:block.note_block.pling'
|
||||
}
|
||||
|
||||
function inject (bot) {
|
||||
bot.music = function () {}
|
||||
bot.music.song = null
|
||||
bot.music.loop = 0
|
||||
bot.music.queue = []
|
||||
let time = 0
|
||||
let startTime = 0
|
||||
let noteIndex = 0
|
||||
bot.music.skip = function () {
|
||||
if (bot.music.loop === 2) {
|
||||
bot.music.queue.push(bot.music.queue.shift())
|
||||
bot.music.play(bot.music.queue[0])
|
||||
} else {
|
||||
bot.music.queue.shift()
|
||||
}
|
||||
resetTime()
|
||||
}
|
||||
|
||||
const bossbarName = 'music' // maybe make this in the config?
|
||||
|
||||
const selector = '@a[tag=!nomusic]'
|
||||
|
||||
const interval = setInterval(async () => {
|
||||
if (!bot.music.queue.length) return
|
||||
bot.music.song = bot.music.queue[0]
|
||||
time = Date.now() - startTime
|
||||
/*
|
||||
// bot.core.run('minecraft:title @a[tag=!nomusic] actionbar ' + JSON.stringify(toComponent()))
|
||||
|
||||
// is spamming commands in core as a self care a good idea?
|
||||
// btw this is totallynotskidded™️ from my song bot except the bossbarName (above)
|
||||
bot.core.run(`minecraft:bossbar add ${bossbarName} ""`) // is setting the name to "" as a placeholder a good idea?
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} players ${selector}`)
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} name ${JSON.stringify(toComponent())}`)
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} color yellow`) // should i use purple lol
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`)
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} value ${Math.floor(time)}`)
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} max ${bot.music.song.length}`)
|
||||
*/
|
||||
bot.core.run(`title @a actionbar ${JSON.stringify(toComponent())}`)
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`)
|
||||
while (bot.music.song?.notes[noteIndex]?.time <= time) {
|
||||
const note = bot.music.song.notes[noteIndex]
|
||||
const floatingPitch = 2 ** ((note.pitch - 12) / 12.0)
|
||||
// bot.core.run(`playsound ${soundNames[note.instrument]} record @s ~ ~ ~ ${note.volume} ${floatingPitch}`)
|
||||
bot.core.run(`minecraft:execute as ${selector} at @s run playsound ${soundNames[note.instrument]} record @s ~ ~ ~ ${note.volume} ${floatingPitch}`)
|
||||
noteIndex++
|
||||
if (noteIndex >= bot.music.song.notes.length) {
|
||||
bot.tellraw([
|
||||
{
|
||||
text: 'Finished playing '
|
||||
},
|
||||
{
|
||||
text: bot.music.song.name,
|
||||
color: 'gold'
|
||||
}
|
||||
])
|
||||
|
||||
if (bot.music.loop === 1) {
|
||||
resetTime()
|
||||
return
|
||||
}
|
||||
if (bot.music.loop === 2) {
|
||||
resetTime()
|
||||
bot.music.queue.push(bot.music.queue.shift())
|
||||
bot.music.play(bot.music.queue[0])
|
||||
return
|
||||
}
|
||||
bot.music.queue.shift()
|
||||
bot.music.song = null // useless?
|
||||
if (!bot.music.queue[0]) {
|
||||
bot.music.stop()
|
||||
return
|
||||
}
|
||||
if (bot.music.queue[0].notes.length > 0) {
|
||||
if (bot.music.queue.length !== 1) resetTime()
|
||||
bot.music.play(bot.music.queue[0])
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 100)
|
||||
|
||||
bot.on('end', () => {
|
||||
clearInterval(interval)
|
||||
})
|
||||
|
||||
bot.music.load = async function (buffer, fallbackName = '[unknown]') {
|
||||
let song
|
||||
switch (path.extname(fallbackName)) {
|
||||
case '.nbs':
|
||||
song = convertNBS(buffer)
|
||||
if (song.name === '') song.name = fallbackName
|
||||
break
|
||||
case '.txt':
|
||||
song = parseTXTSong(buffer.toString())
|
||||
song.name = fallbackName
|
||||
break
|
||||
default:
|
||||
// TODO: use worker_threads so the entire bot doesn't freeze (for example parsing we are number 1 black midi)
|
||||
|
||||
// eslint-disable-next-line no-case-declarations
|
||||
const midi = new Midi(buffer)
|
||||
song = convertMidi(midi)
|
||||
if (song.name === '') song.name = fallbackName
|
||||
break
|
||||
}
|
||||
return song
|
||||
}
|
||||
|
||||
bot.music.play = function (song) {
|
||||
if (bot.music.queue.length === 1) resetTime()
|
||||
}
|
||||
|
||||
bot.music.stop = function () {
|
||||
bot.music.song = null
|
||||
bot.music.loop = 0
|
||||
bot.music.queue = []
|
||||
resetTime()
|
||||
}
|
||||
|
||||
function resetTime () {
|
||||
time = 0
|
||||
startTime = Date.now()
|
||||
noteIndex = 0
|
||||
bot.core.run(`minecraft:bossbar remove ${bossbarName}`) // maybe not a good place to put it here but idk
|
||||
}
|
||||
|
||||
function formatTime (time) {
|
||||
const seconds = Math.floor(time / 1000)
|
||||
|
||||
return `${Math.floor(seconds / 60)}:${(seconds % 60).toString().padStart(2, '0')}`
|
||||
}
|
||||
|
||||
function toComponent () {
|
||||
const component = [
|
||||
// { text: '[', color: 'dark_gray' },
|
||||
// { text: 'ChomeNS Bot', color: 'yellow' },
|
||||
// { text: '] ', color: 'dark_gray' },
|
||||
// { text: 'Now Playing', color: 'gold' },
|
||||
// { text: ' | ', color: 'dark_gray' },
|
||||
{ text: bot.music.song.name, color: 'green' },
|
||||
{ text: ' | ', color: 'dark_gray' },
|
||||
{ text: formatTime(time), color: 'gray' },
|
||||
{ text: ' / ', color: 'dark_gray' },
|
||||
{ text: formatTime(bot.music.song.length), color: 'gray' },
|
||||
{ text: ' | ', color: 'dark_gray' },
|
||||
{ text: noteIndex, color: 'gray' },
|
||||
{ text: ' / ', color: 'dark_gray' },
|
||||
{ text: bot.music.song.notes.length, color: 'gray' }
|
||||
]
|
||||
|
||||
if (bot.music.loop === 1) {
|
||||
component.push({ text: ' | ', color: 'dark_gray' })
|
||||
component.push({ text: 'Looping Current', color: 'green' })
|
||||
}
|
||||
if (bot.music.loop === 2) {
|
||||
component.push({ text: ' | ', color: 'dark_gray' })
|
||||
component.push({ text: 'Looping All', color: 'green' })
|
||||
}
|
||||
|
||||
return component
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = inject
|
||||
@@ -1,18 +0,0 @@
|
||||
const mc = require('minecraft-protocol')
|
||||
|
||||
function reconnect (bot, options) {
|
||||
bot.reconnectDelay = options.reconnectDelay ?? 5200 // Set from 1000 to 5200 - yfd
|
||||
|
||||
bot.on('end', (reason) => {
|
||||
if (bot.reconnectDelay < 0) return
|
||||
setTimeout(() => {
|
||||
|
||||
const client = options.client ?? mc.createClient(options)
|
||||
|
||||
bot._client = client
|
||||
console.log(`Reconnecting to ${bot.options.host}:${bot.options.port}`)
|
||||
bot.emit('init_client', client)
|
||||
}, bot.reconnectDelay)
|
||||
})
|
||||
}
|
||||
module.exports = reconnect
|
||||
@@ -1,11 +0,0 @@
|
||||
const createRegistry = require('prismarine-registry')
|
||||
|
||||
function registry (bot) {
|
||||
bot.on('packet.login', packet => {
|
||||
bot.registry = createRegistry(bot._client.version)
|
||||
// bot.registry.loadDimensionCodec(packet.dimensionCodec)
|
||||
bot.emit('registry_ready', bot.registry)
|
||||
})
|
||||
}
|
||||
//1.20.2 support wooooooo
|
||||
module.exports = registry
|
||||
@@ -1,161 +0,0 @@
|
||||
|
||||
const util = require('util')
|
||||
|
||||
const COMMANDSPY_ENABLED_MESSAGE = { text: 'Successfully enabled CommandSpy' }
|
||||
const COMMANDSPY_DISABLED_MESSAGE = { text: 'Successfully disabled CommandSpy' }
|
||||
//You now have the tag: &8[&bPrefix &4d~&8]
|
||||
function selfcare (bot) {
|
||||
let entityId
|
||||
let gameMode
|
||||
let permissionLevel = 2
|
||||
let unmuted = false
|
||||
let commandSpyEnabled = false
|
||||
let vanished = false
|
||||
let prefix = false
|
||||
let skin = false
|
||||
let username = false
|
||||
let nickname = false
|
||||
let god = false
|
||||
let tptoggle = false
|
||||
let jail = false
|
||||
/* if (data.toString().startsWith('You have been muted')) muted = true
|
||||
if (data.toString() === 'You have been unmuted.') muted = false
|
||||
*/
|
||||
//bot.on('message', (data) => {
|
||||
bot.on('message', (message, data) => {
|
||||
// Successfully removed your skin
|
||||
const stringmessage = bot.getMessageAsPrismarine(message)?.toString()
|
||||
if (stringmessage.startsWith('You have been muted')) unmuted = true
|
||||
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]`) {
|
||||
prefix = true
|
||||
return
|
||||
}
|
||||
else if (stringmessage.startsWith("You now have the tag: ") || stringmessage === "You no longer have a tag") prefix = false
|
||||
|
||||
else if (stringmessage === `Successfully set your skin to ${bot.options.selfcare.skin.player}'s`) {
|
||||
skin = true
|
||||
return
|
||||
}
|
||||
//Successfully set your skin to Parker2991's
|
||||
//Successfully removed your skin
|
||||
else if (stringmessage === 'You have been released!') jail = true
|
||||
else if (stringmessage === 'Jails/Unjails a player, TPs them to the jail specified.') jail = true
|
||||
else if(stringmessage === `You have been jailed!`){
|
||||
jail = false
|
||||
return
|
||||
}
|
||||
else if (stringmessage.startsWith("Successfully set your skin to ") || stringmessage === "Successfully removed your skin") skin = false
|
||||
|
||||
else if (stringmessage === `Successfully set your username to "${bot.username}"`) {
|
||||
username = true
|
||||
return
|
||||
}//"Successfully set your username to "${bot.username}"""
|
||||
else if (stringmessage.startsWith("Successfully set your username to ")) username = false
|
||||
else if (stringmessage === `You already have the username "${bot.username}"`) username = true
|
||||
//That name is already in use.
|
||||
//Error: Nicknames must be alphanumeric.
|
||||
//You no longer have a nickname.
|
||||
//Your nickname is now sus.
|
||||
else if (stringmessage === `You no longer have a nickname.`) {
|
||||
nickname = true
|
||||
return
|
||||
}//"Successfully set your username to "${bot.username}"""
|
||||
else if (stringmessage.startsWith("Your nickname is now ")) nickname = false
|
||||
// else if (stringmessage === `Error: Nicknames must be alphanumeric.`) nickname = false
|
||||
else if (stringmessage === `You no longer have a nickname.`) nickname = false
|
||||
//else if (stringmessage === `That name is already in use.`) nickname = false
|
||||
//God mode enabled.
|
||||
//God mode disabled.
|
||||
else if (stringmessage === `God mode enabled.`) {
|
||||
god = true
|
||||
return
|
||||
}
|
||||
else if (stringmessage === 'God mode disabled.') god = false
|
||||
else if (stringmessage === `Teleportation enabled.`) {
|
||||
tptoggle = false
|
||||
return
|
||||
}
|
||||
else if (stringmessage === 'Teleportation disabled.') tptoggle = true
|
||||
|
||||
else if(stringmessage === `Vanish for ${bot.options.username}: disabled`) {
|
||||
vanished = false
|
||||
return
|
||||
}
|
||||
else if (stringmessage === `Vanish for ${bot.options.username}: enabled`) vanished = true
|
||||
|
||||
/*
|
||||
else if (message?.text !== '' || !Array.isArray(message.extra) || message.extra.length < 2 || !message.extra[0]?.text?.startsWith('Vanish for') || message.extra[0].color !== 'gold') return
|
||||
|
||||
const suffix = message.extra[message.extra.length - 1]
|
||||
|
||||
if (suffix?.color !== 'gold') return
|
||||
//data.toString().startsWith
|
||||
if (suffix.text?.endsWith(': enabled')) vanished = true
|
||||
else if (suffix.text?.endsWith(': disabled')) vanished = false // Bruh what is this ohio code
|
||||
//
|
||||
|
||||
*/
|
||||
})
|
||||
|
||||
bot.on('packet.entity_status', packet => {
|
||||
if (packet.entityId !== entityId || packet.entityStatus < 24 || packet.entityStatus > 28) return
|
||||
permissionLevel = packet.entityStatus - 24
|
||||
})//
|
||||
//TO-DO create a array for nick, prefix, and mabe username in selfcare so that when it joins or has the nick/prefix changed it will change it back to the set nick and prefix in selfcare
|
||||
|
||||
bot.on('packet.game_state_change', packet => {
|
||||
if (packet.reason !== 3) return // Reason 3 = Change Game Mode
|
||||
|
||||
gameMode = packet.gameMode
|
||||
})
|
||||
|
||||
let timer
|
||||
bot.on('packet.login', (packet) => {
|
||||
entityId = packet.entityId
|
||||
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}`)
|
||||
}, bot.options.selfcare.interval)
|
||||
})
|
||||
|
||||
bot.on('end', () => {
|
||||
if (timer) clearInterval(timer)
|
||||
prefix = false
|
||||
muted = false
|
||||
commandSpyEnabled = false
|
||||
vanished = false
|
||||
skin = false
|
||||
username = false
|
||||
nickname = false
|
||||
god = false
|
||||
tptoggle = false
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = selfcare
|
||||
/*const buildstring = process.env['buildstring']
|
||||
bot.on('login', async () => {
|
||||
console.log(`starting ${buildstring}`)
|
||||
await bot.discord.channel.send(`Starting ${buildstring}`)
|
||||
await sendChat('/prefix &8[&4Prefix ~ &8]')
|
||||
await sendChat(buildstring)
|
||||
await sendChat('Prefix ~')
|
||||
})
|
||||
}*/
|
||||
@@ -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
|
||||
@@ -0,0 +1,56 @@
|
||||
const CommandSource = require("../CommandModules/command_source");
|
||||
const CommandError = require("../CommandModules/command_error");
|
||||
//can i change the var?
|
||||
const { execSync } = require('child_process');
|
||||
function chat_command_handler(bot) {
|
||||
let ratelimit = 0
|
||||
bot.on("parsed_message", (data) => {
|
||||
if (data.type !== "minecraft:chat") return;
|
||||
|
||||
const prefixes = bot.Commands.prefixes;
|
||||
|
||||
prefixes.map((prefix) => {
|
||||
const plainMessage = bot
|
||||
.getMessageAsPrismarine(data.contents)
|
||||
?.toString();
|
||||
if (!plainMessage.startsWith(prefix)) return;
|
||||
|
||||
const command = plainMessage.substring(prefix.length); // if the prefixes are the same length just make it 1 or the length
|
||||
/*
|
||||
lifes sus
|
||||
*/
|
||||
const source = new CommandSource(data.sender,{ discord: false, console: false });
|
||||
bot.sendFeedback = (message) => {
|
||||
|
||||
if (bot.options.useChat) {
|
||||
bot.tellraw([message]);
|
||||
} else {
|
||||
bot.tellraw(["", message]);
|
||||
}
|
||||
|
||||
};
|
||||
bot.sendError = (message) => {
|
||||
bot.sendFeedback([{ text: '', color: `red` }, message], false)
|
||||
}
|
||||
try{
|
||||
|
||||
ratelimit++
|
||||
setTimeout(() => {
|
||||
ratelimit--
|
||||
}, 1000)
|
||||
if (ratelimit > bot.Commands.ratelimit) { // ,.
|
||||
bot.sendFeedback({text:'You are using commands too 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)
|
||||
|
||||
};
|
||||
});
|
||||
})//
|
||||
}
|
||||
module.exports = chat_command_handler;
|
||||
@@ -0,0 +1,7 @@
|
||||
function chatDelay (bot,options, ms){
|
||||
bot.chatDelay = function delay(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
}
|
||||
module.exports = chatDelay;
|
||||
@@ -6,9 +6,10 @@ const { stylize } = require('../util/eval_colors')
|
||||
|
||||
module.exports = {
|
||||
name: 'evaljs',
|
||||
trustLevel: 1,
|
||||
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
|
||||
@@ -63,17 +64,17 @@ try {
|
||||
const script = await args.slice(2).join(' '); // Ensure script is a string
|
||||
const cOmtext = await isolate.createContextSync({options});
|
||||
if (script.includes('for(;;);')){
|
||||
source.sendFeedback({text:'no now fuck off with that script',color:'dark_red'})
|
||||
bot.sendFeedback({text:'no now fuck off with that script',color:'dark_red'})
|
||||
return
|
||||
}
|
||||
else if (script.includes('Array') || script.includes('\u0041rray') || script.includes('\u0065val') || script.includes('.repeat') || script.includes('concat')){
|
||||
source.sendFeedback({text:'no now fuck off with that script',color:'dark_red'})
|
||||
bot.sendFeedback({text:'no now fuck off with that script',color:'dark_red'})
|
||||
return
|
||||
} else if(script.includes('eval')){
|
||||
source.sendFeedback({text:'no',color:'dark_red'})
|
||||
return
|
||||
}else if(script.includes('.fill')){
|
||||
source.sendFeedback({text:'screw off',color:'dark_red'})
|
||||
bot.sendFeedback({text:'screw off',color:'dark_red'})
|
||||
return
|
||||
}
|
||||
(async () => {
|
||||
@@ -86,14 +87,14 @@ return
|
||||
bot.chat(ChatMessage.fromNotch([cmd, { text: util.inspect(result, { stylize }) }]).toMotd().replaceAll('§', '&'))
|
||||
}else{
|
||||
|
||||
source.sendFeedback([cmd, { text: util.inspect(result, { stylize }) }]);
|
||||
bot.sendFeedback([cmd, { text: util.inspect(result, { stylize }) }]);
|
||||
}
|
||||
} catch (reason) {
|
||||
nerd = reason;
|
||||
if(!bot.options.Core.enabled){
|
||||
bot.chat(ChatMessage.fromNotch([cmd, { text: String(reason.stack), color: 'white' }]).toMotd().replaceAll('§', '&'))
|
||||
}else{
|
||||
source.sendFeedback([cmd, { text: String(reason.stack), color: 'white' }]);
|
||||
bot.sendFeedback([cmd, { text: String(reason.stack), color: 'white' }]);
|
||||
console.log(`AAA at ${reason}\n${reason.stack}`);
|
||||
}
|
||||
}
|
||||
@@ -119,14 +120,14 @@ if(!bot.options.Core.enabled){
|
||||
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' }])
|
||||
bot.sendFeedback([cmd, { text: 'Successfully reset the eval context', color: 'green' }])
|
||||
}
|
||||
break
|
||||
default:
|
||||
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: 'Invalid option!', color: 'dark_red' }])
|
||||
bot.sendFeedback([cmd, { text: 'Invalid option!', color: 'dark_red' }])
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
function consolefilelogger (bot, options, message) {
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const currentDate = new Date();
|
||||
function logger (bot,options) {
|
||||
const { createGzip } = require('node:zlib');
|
||||
const gzip = createGzip();
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const currentDate = new Date();
|
||||
const timestamp = `${currentDate.getFullYear()}-${(currentDate.getMonth() + 1).toString().padStart(2, '0')}-${currentDate.getDate().toString().padStart(2, '0')}`;
|
||||
const logFolder = path.join(__dirname, '../logs'); // idfk
|
||||
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
|
||||
@@ -15,8 +17,8 @@ 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
|
||||
// const toWrite = `${message}`//wtf
|
||||
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');
|
||||
|
||||
@@ -24,6 +26,7 @@ if (!options.Console.filelogging) return // instead of using bot why not just us
|
||||
logStream.write(message + '\n'); // toFile is not defined
|
||||
};
|
||||
//if (toConsole) console.log(toWrite);
|
||||
};//tf
|
||||
|
||||
module.exports = consolefilelogger
|
||||
|
||||
};
|
||||
module.exports = logger
|
||||
Generated
+555
-3172
File diff suppressed because it is too large
Load Diff
+9
-26
@@ -1,37 +1,20 @@
|
||||
{
|
||||
"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",
|
||||
"cowsay": "^1.6.0",
|
||||
"cowsay2": "^2.0.4",
|
||||
"discord.js": "^14.14.1",
|
||||
"discord.js": "^14.15.2",
|
||||
"dockerode": "^4.0.2",
|
||||
"dotenv": "^16.3.1",
|
||||
"dotenv": "^16.4.5",
|
||||
"final-stream": "^2.0.4",
|
||||
"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",
|
||||
"js-yaml": "^4.1.0",
|
||||
"minecraft-protocol": "^1.47.0",
|
||||
"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",
|
||||
"prettier": "^3.2.5",
|
||||
"prismarine-chat": "^1.10.1",
|
||||
"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"
|
||||
"wikipedia": "^2.1.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
const version = '1.20.4'
|
||||
const { fromNotch } = require('prismarine-chat')(version)
|
||||
const nbt = require('prismarine-nbt')
|
||||
//const msg = {"type":"compound","value":{"extra":{"type":"list","value":{"type":"compound","value":[{"extra":{"type":"list","value":{"type":"compound","value":[{"color":{"type":"string","value":"dark_gray"},"text":{"type":"string","value":"["}},{"color":{"type":"string","value":"aqua"},"text":{"type":"string","value":"Prefix: "}},{"color":{"type":"string","value":"dark_red"},"text":{"type":"string","value":"~"}},{"color":{"type":"string","value":"dark_gray"},"text":{"type":"string","value":"]"}},{"":{"type":"string","value":" "}}]}},"text":{"type":"string","value":""}},{"extra":{"type":"list","value":{"type":"compound","value":[{"color":{"type":"string","value":"red"},"text":{"type":"string","value":"FNFBoyfriendBot"}}]}},"text":{"type":"string","value":""}},{"":{"type":"string","value":":"}},{"":{"type":"string","value":" "}},{"extra":{"type":"list","value":{"type":"compound","value":[{"color":{"type":"string","value":"dark_purple"},"text":{"type":"string","value":"FNF"}},{"color":{"type":"string","value":"aqua"},"text":{"type":"string","value":"Boyfriend"}},{"color":{"type":"string","value":"dark_red"},"text":{"type":"string","value":"Bot "}},{"color":{"type":"string","value":"white"},"text":{"type":"string","value":"- "}},{"color":{"type":"string","value":"dark_red"},"text":{"type":"string","value":"Parker"}},{"color":{"type":"string","value":"black"},"text":{"type":"string","value":"2991"}}]}},"text":{"type":"string","value":""}}]}},"text":{"type":"string","value":""}}}
|
||||
const msg = {"type":"compound","value":{"extra":{"type":"list","value":{"type":"compound","value":[{"extra":{"type":"list","value":{"type":"compound","value":[{"bold":{"type":"byte","value":1},"color":{"type":"string","value":"dark_red"},"text":{"type":"string","value":"["}},{"bold":{"type":"byte","value":1},"color":{"type":"string","value":"red"},"text":{"type":"string","value":"OP"}},{"bold":{"type":"byte","value":1},"color":{"type":"string","value":"dark_red"},"text":{"type":"string","value":"] "}},{"color":{"type":"string","value":"red"},"text":{"type":"string","value":""}}]}},"text":{"type":"string","value":""}},{"extra":{"type":"list","value":{"type":"compound","value":[{"color":{"type":"string","value":"red"},"text":{"type":"string","value":"birdevent"}}]}},"text":{"type":"string","value":""}},{"":{"type":"string","value":":"}},{"":{"type":"string","value":" "}},{"":{"type":"string","value":"?"}}]}},"text":{"type":"string","value":""}}}
|
||||
function tryParse (json) {
|
||||
|
||||
}
|
||||
function processNbtMessage (msg) {
|
||||
if (!msg || msg.type === 'end') return null
|
||||
const simplified = nbt.simplify(msg)
|
||||
const json = JSON.stringify(simplified, (key, val) => {
|
||||
if (key === 'id' && Array.isArray(val)) return uuidFromIntArray(val)
|
||||
return val
|
||||
})
|
||||
return json
|
||||
}
|
||||
console.log(fromNotch(processNbtMessage(msg)).toAnsi())
|
||||
console.log(fromNotch(nbt.simplify(msg).extra).toAnsi())
|
||||
async function nbtChat() {
|
||||
|
||||
const { parsed, type } = await nbt.parse(msg)
|
||||
console.log(parsed)
|
||||
}
|
||||
//nbtChat()
|
||||
/*
|
||||
async function main(file) {
|
||||
const buffer = fs.readFileSync(file)
|
||||
const { parsed, type } = await nbt.parse(buffer)
|
||||
console.log('JSON serialized', JSON.stringify(parsed, null, 2))
|
||||
fs.createWriteStream('bigtest.nbt').write(nbt.writeUncompressed(parsed, type)) // Write it back
|
||||
}
|
||||
main('bigtest.nbt')
|
||||
*/
|
||||
@@ -0,0 +1,7 @@
|
||||
const fs = require('fs/promises');
|
||||
const path = require('path');
|
||||
const blacklist = require(path.join(__dirname, 'blacklist.json'));
|
||||
|
||||
for (const player of blacklist.players) {
|
||||
console.log('whos blacklisted?',[player]);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"players": [
|
||||
"CynicalDev",
|
||||
"denisapain",
|
||||
"Pan_Poppo",
|
||||
"Parker2991"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
[{"text":"e"},{"text":"sus"},{"text":"amongus"}]
|
||||
@@ -0,0 +1,102 @@
|
||||
# i bet theres gonna be some whiny assholes complaining about this because config is .yml and not .js since most java bots use .yml and no other
|
||||
# javascript bot uses .yml, all i got to say is go cry somewhere else about it you wont change my mind, you little shit,
|
||||
# it looks cleaner than config.js - Parker2991
|
||||
|
||||
|
||||
# FNFBoyfriendBot Config
|
||||
# commands
|
||||
Commands:
|
||||
prefixes:
|
||||
- '!'
|
||||
colors:
|
||||
discord:
|
||||
error: "#ff0000"
|
||||
embed: "#00ffff"
|
||||
help:
|
||||
pub_lickColor: "#00FFFF"
|
||||
t_rustedColor: "dark_purple"
|
||||
own_herColor: "dark_red"
|
||||
error: "#FF0000"
|
||||
|
||||
# core
|
||||
Core:
|
||||
JSON: ""
|
||||
area:
|
||||
start:
|
||||
x: 0
|
||||
y: 0
|
||||
z: 0
|
||||
end:
|
||||
x: 15
|
||||
y: 0
|
||||
z: 15
|
||||
|
||||
#validation
|
||||
validation:
|
||||
discord:
|
||||
roles:
|
||||
trusted: "trusted"
|
||||
owner: "owner"
|
||||
channelId: "channel validation here" # for sending hashes to discord if someone is too lazy to add validation for the bot to their client
|
||||
trustedKey: "trusted key here"
|
||||
ownerKey: "owner key here"
|
||||
|
||||
#discord
|
||||
Discord:
|
||||
enabled: false
|
||||
invite: "https://discord.gg/GCKtG4erux"
|
||||
commandPrefix: "!"
|
||||
presence:
|
||||
name: "amongus"
|
||||
type: 4
|
||||
status: "online"
|
||||
|
||||
# console
|
||||
console:
|
||||
filelogging: false
|
||||
prefix: "c."
|
||||
|
||||
# bots
|
||||
bots :
|
||||
# isKaboom = running the bot in kaboom
|
||||
# isCreayun = running the bot in creayun
|
||||
# useChat = running the bot in chat and not core
|
||||
# usernameGen = regenerating the bot's username every join
|
||||
# endcredits = the bot advertising
|
||||
# serverName = the name of the server ofc
|
||||
# Console.ratelimit = the number of messages that the bot can read in a few seconds before rejoining this is used to prevent spam, i do not recommend setting it to Infinity
|
||||
# selfcare.interval = selfcare interval duh
|
||||
- host: "localhost"
|
||||
useChat: false
|
||||
isKaboom: true
|
||||
isCreayun: false
|
||||
usernameGen: true
|
||||
username: "FNFBoyfriendBot"
|
||||
version: "1.20.2"
|
||||
serverName: "localhost"
|
||||
reconnectDelay: 6000
|
||||
endcredits: false
|
||||
Console:
|
||||
enabled: true
|
||||
ratelimit: 25
|
||||
Core:
|
||||
enabled: true
|
||||
interval: 180000
|
||||
discord:
|
||||
channelId: ""
|
||||
log: false
|
||||
matrix:
|
||||
roomId: ""
|
||||
selfcare:
|
||||
vanished: true
|
||||
unmuted: true
|
||||
prefix: true
|
||||
cspy: true
|
||||
tptoggle: true
|
||||
skin: true
|
||||
gmc: true
|
||||
op: true
|
||||
nickname: true
|
||||
username: true
|
||||
god: true
|
||||
interval: 500
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
e
|
||||
e
|
||||
e
|
||||
e
|
||||
e
|
||||
e
|
||||
e
|
||||
@@ -0,0 +1,20 @@
|
||||
const fs = require("fs");
|
||||
|
||||
var data = fs.readFileSync("data.json");
|
||||
var myObject = JSON.parse(data);
|
||||
|
||||
let newData = {
|
||||
text: "sus"
|
||||
}
|
||||
myObject.push(newData);
|
||||
var newData2 = JSON.stringify(myObject);
|
||||
fs.rmSync("./data.json");
|
||||
fs.writeFile("data2.json", newData2, (err) => {
|
||||
if (err) throw err;
|
||||
console.log("New data added");
|
||||
});
|
||||
fs.rename('data2.json', 'data.json', (err) => {
|
||||
if (err) throw err;
|
||||
// console.log('Rename complete!');
|
||||
});
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*const playlists = [
|
||||
{
|
||||
"id" : "1",
|
||||
"owner_id" : "2",
|
||||
"song_ids" : [ "8", "32"]
|
||||
},
|
||||
{
|
||||
"id" : "2",
|
||||
"owner_id" : "3",
|
||||
"song_ids" : ["6", "8","11" ]
|
||||
}
|
||||
];*/
|
||||
const fs = require('fs');
|
||||
var data = require("./data.json");
|
||||
const e = data.splice('e', 1)
|
||||
const removePlayerById = (plists, text) =>
|
||||
plists.filter(player => player.text !== text);
|
||||
const result = removePlayerById(data, 2);
|
||||
console.log(result)
|
||||
// console.log(playerId)
|
||||
//}
|
||||
//remove()
|
||||
/*
|
||||
const fs = require("fs");
|
||||
|
||||
var data = fs.readFileSync("data.json");
|
||||
var myObject = JSON.parse(data);
|
||||
|
||||
let newData = {
|
||||
text: "sus"
|
||||
}
|
||||
myObject.push(newData);
|
||||
var newData2 = JSON.stringify(myObject);
|
||||
fs.rmSync("./data.json");
|
||||
fs.writeFile("data2.json", newData2, (err) => {
|
||||
if (err) throw err;
|
||||
console.log("New data added");
|
||||
});
|
||||
fs.rename('data2.json', 'data.json', (err) => {
|
||||
if (err) throw err;
|
||||
// console.log('Rename complete!');
|
||||
});
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,2 @@
|
||||
const { haxe } = require('haxe')
|
||||
console.log(haxe())
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*
|
||||
* This is a general purpose Gradle build.
|
||||
* To learn more about Gradle by exploring our Samples at https://docs.gradle.org/8.5/samples
|
||||
*/
|
||||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'java-library'
|
||||
id 'maven-publish'
|
||||
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
||||
}
|
||||
|
||||
group = 'land.chipmunk.parker2991'
|
||||
version = 'v6.0.0-alpha(ff08479)'
|
||||
description = 'FNFBoyfriendBot'
|
||||
java.sourceCompatibility = JavaVersion.VERSION_17
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
mavenCentral()
|
||||
|
||||
maven {
|
||||
url = uri('https://repo.opencollab.dev/maven-snapshots/')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://repo.opencollab.dev/maven-releases/')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://repo.maven.apache.org/maven2/')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri("https://jitpack.io")
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://maven.maxhenkel.de/repository/public')
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.steveice10:mcprotocollib:1.20.2-1-SNAPSHOT'
|
||||
implementation 'net.kyori:adventure-text-serializer-ansi:4.14.0'
|
||||
implementation 'com.google.code.gson:gson:2.10.1'
|
||||
implementation 'com.google.guava:guava:31.1-jre'
|
||||
implementation 'org.jline:jline:3.23.0'
|
||||
implementation 'org.yaml:snakeyaml:2.0'
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Main-Class': 'land.chipmunk.parker2991.fnfboyfriendbot.Main'
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
tasks.withType(Javadoc).configureEach {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
voiding interger will return a number
|
||||
public static void functionName() {} has the funcion return nothing
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
# This file was generated by the Gradle 'init' task.
|
||||
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
+249
@@ -0,0 +1,249 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+92
@@ -0,0 +1,92 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*
|
||||
* The settings file is used to specify which projects to include in your build.
|
||||
* For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.5/userguide/building_swift_projects.html in the Gradle documentation.
|
||||
*/
|
||||
|
||||
rootProject.name = 'fnfboyfriendbot'
|
||||
@@ -0,0 +1,47 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot;
|
||||
|
||||
import land.chipmunk.parker2991.fnfboyfriendbot.*;
|
||||
import com.github.steveice10.mc.auth.data.GameProfile;
|
||||
import com.github.steveice10.mc.protocol.MinecraftProtocol;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.HandPreference;
|
||||
import com.github.steveice10.mc.protocol.data.game.setting.ChatVisibility;
|
||||
import com.github.steveice10.mc.protocol.data.game.setting.SkinPart;
|
||||
import com.github.steveice10.mc.protocol.packet.common.serverbound.ServerboundClientInformationPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundGameProfilePacket;
|
||||
import com.github.steveice10.packetlib.Session;
|
||||
import com.github.steveice10.packetlib.event.session.*;
|
||||
import com.github.steveice10.packetlib.packet.Packet;
|
||||
import com.github.steveice10.packetlib.tcp.TcpClientSession;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class Bot {
|
||||
private final ArrayList<ClientListener> listeners = new ArrayList<>();
|
||||
|
||||
public final String host;
|
||||
|
||||
public final int port;
|
||||
|
||||
public final List<Bot> bots;
|
||||
|
||||
public final Options.bots options;
|
||||
|
||||
public Bot (Options.bots options, List<Bot> bots) {
|
||||
this.host = options.host;
|
||||
this.port = options.port;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
public class ClientListener {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Bot config = null;
|
||||
Path configPath = Paths.get("config.yml");
|
||||
try {
|
||||
Yaml yaml = new Yaml();
|
||||
config = yaml.load(Files.readString(configPath));
|
||||
System.out.println(config);
|
||||
} catch (IOException e) {
|
||||
System.out.println(e.toString());
|
||||
}
|
||||
List<Bots> bots = new ArrayList<>();
|
||||
for (Options options : config.bots) {
|
||||
final Bot client = new Bot(options, bots);
|
||||
bots.add(client);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Options {
|
||||
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot;
|
||||
|
||||
public class Options {
|
||||
public static class bots {
|
||||
public String host = "127.0.0.1";
|
||||
public int port = 25565;
|
||||
public long reconnectDelay;
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.commands;
|
||||
|
||||
|
||||
public class SayCommand {
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class BruhifyModule {
|
||||
|
||||
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class ChatCommandHandlerModule {
|
||||
|
||||
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class ChatModule {
|
||||
|
||||
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class CommandCoreModule {
|
||||
|
||||
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class CommandLoopManagerModule {
|
||||
|
||||
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class CommandManagerModule {
|
||||
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class ConsoleModule {
|
||||
|
||||
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class DiscordModule {
|
||||
|
||||
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class PlayerListModule {
|
||||
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user