Compare commits
No commits in common. "main" and "v1.0-beta" have entirely different histories.
101 changed files with 569 additions and 15131 deletions
9
.gitignore
vendored
9
.gitignore
vendored
|
@ -1,10 +1 @@
|
|||
node_modules
|
||||
config.yml
|
||||
.git
|
||||
src/modules/exploits.js
|
||||
logs/*
|
||||
src/data/filter.json
|
||||
data/filter.json
|
||||
prototyping-crap
|
||||
src/data/trustedPlayers.js
|
||||
data/trustedPlayers.js
|
||||
|
|
569
index.js
Normal file
569
index.js
Normal file
|
@ -0,0 +1,569 @@
|
|||
const mineflayer = require('mineflayer')
|
||||
let symbol = require('illegal-symbols')
|
||||
var server = 'sus.shhnowisnottheti.me'
|
||||
//NMxigAU6dR1KfgaQkKz87L
|
||||
const readline = require('readline')
|
||||
|
||||
|
||||
let rl = readline.createInterface({ input: process.stdin, output: process.stdout })
|
||||
|
||||
const randomstring = require('randomstring');
|
||||
const bot = mineflayer.createBot({
|
||||
host: server,
|
||||
port: 25565,
|
||||
username: randomstring.generate(8),
|
||||
version: 1.16,
|
||||
})
|
||||
|
||||
var sleep = t => new Promise(a => setTimeout(a, t)),
|
||||
sendChat = async function(m) { bot.chat(m.slice(0, 256)); await sleep(300); }
|
||||
|
||||
function between(min, max) {
|
||||
return Math.floor(
|
||||
Math.random() * (max - min) + min
|
||||
)
|
||||
}
|
||||
|
||||
//variables
|
||||
var prefix = '&8[&b&lBOYFRIEND&8]&a[&lBeta] &8[&4&lParker2991&8]';
|
||||
var consoleprefix = 'bcraw &8 &l &m[&4 &mParker2991&8] &8 &m[&b &mBOYFRIEND&8] &8 &m[&b &mCONSOLE&8] ';
|
||||
|
||||
function randomchar() {
|
||||
const crypto = require("crypto");
|
||||
var hash = crypto.createHash("md5");
|
||||
var randomBytes = crypto.randomBytes(16);
|
||||
hash.update(randomBytes);
|
||||
var hashi = hash.digest(Math.round(Math.random()) ? "hex" : "Base64");
|
||||
|
||||
return hashi.substring(0, 16);
|
||||
}
|
||||
|
||||
function runInCore(cmd) {
|
||||
bot._client.write('update_command_block', { location: { x: between(Math.floor(bot.entity.position.x) + 1, Math.floor(bot.entity.position.x) - 15), y: between(0, 3), z: between(Math.floor(bot.entity.position.z) + 1, Math.floor(bot.entity.position.z) - 15) }, command: cmd, mode: 1, flags: 0b100 });
|
||||
}
|
||||
bot.on('login', async () => { // time in ms
|
||||
console.log(`logged in as ${bot.username}`)
|
||||
|
||||
//change the coords if bot has problems
|
||||
//await sendChat('/tp '+require('randomstring').generate({length:5,charset:'1234567890'})+' 5 '+require('randomstring').generate({length:6,charset:'1234567890'}))
|
||||
|
||||
await sendChat('/tptoggle')
|
||||
await sendChat('/online')
|
||||
await sendChat('/vanish')
|
||||
await sendChat('/v on')
|
||||
await sendChat('/console ')
|
||||
await sendChat('/username &8[&a&lBetaBot&8]')
|
||||
await sendChat('/c')
|
||||
await sendChat('/tptoggle parker2991')
|
||||
await sendChat('/tp Parker2991')
|
||||
await sendChat('/tptoggle parker2991')
|
||||
await sendChat('/Username ')
|
||||
await sendChat('/night')
|
||||
await sendChat('/gamerule doMobSpawning false')
|
||||
|
||||
await sendChat('/de')
|
||||
await sendChat('/online')
|
||||
await sendChat('/cspy on')
|
||||
await sendChat('/prefix &4[BOT/CONSOLE]')
|
||||
await sendChat('/sudo Parker2991 prefix &b &l &m[Boyfriend]')
|
||||
|
||||
await sendChat(`/fill ${Math.floor(bot.entity.position.x)} 0 ${Math.floor(bot.entity.position.z)} ${Math.floor(bot.entity.position.x) - 15} 50 ${Math.floor(bot.entity.position.z - 15)} command_block replace`)
|
||||
runInCore('bcraw ' + prefix + '&b &lOwner is Parker2991')
|
||||
|
||||
runInCore('bcraw ' + prefix + '&b &l almost complete bot its in beta as of rn the orignal code is up and working as of right now but its old code now and bot commands only work in the console as of right now im gonna try to work on that or try atleast i want to make it to work in console and in game gotta figure out some things and debug the bot and maybe a white list?')
|
||||
runInCore('bcraw ' + prefix + 'command list is not know as this time im still trying to figure out all the code for the bot')
|
||||
runInCore('bcraw ' + prefix + 'like always daily meme because why not')
|
||||
runInCore('bcraw ' + prefix + 'no meme today sorry =(')
|
||||
})
|
||||
|
||||
|
||||
const cmd = require('mineflayer-cmd').plugin
|
||||
|
||||
cmd.allowConsoleInput = false // Optional config argument
|
||||
bot.loadPlugin(cmd)
|
||||
//kill command function
|
||||
//test command
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'nuke':
|
||||
setInterval(function() { runInCore('essentials:ekill *'), 1 })
|
||||
setInterval(function() { runInCore('nuke'), 1 })
|
||||
setInterval(function() { runInCore('eco give * 1000'), 1 })
|
||||
setInterval(function() { runInCore('day'), 1 })
|
||||
setInterval(function() { runInCore('night'), 1 })
|
||||
setInterval(function() { runInCore('clear @a'), 1 })
|
||||
setInterval(function() { runInCore('summon fireball 115 62 -5'), 1 })
|
||||
break
|
||||
}
|
||||
})
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'fakekick':
|
||||
runInCore('msg ' + args + ' @e @e @e @e @e @e @e @e @e')
|
||||
runInCore('bcraw &8&l[&b&m&lBoyfriendbot]&8 ' + args + ' has been kicked!')
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'gmc':
|
||||
runInCore('sudo + botusername gmc')
|
||||
runInCore('bcraw DOWN IN OHIO!')
|
||||
break
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'op':
|
||||
runInCore('sudo + botusername op + botusername')
|
||||
break
|
||||
}
|
||||
})
|
||||
switch (command) {
|
||||
|
||||
case 'kaboom':
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('bcraw have fun =)')
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
})
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
|
||||
|
||||
switch (command) {
|
||||
|
||||
case 'BOOM':
|
||||
runInCore('sudo * /fast')
|
||||
runInCore('sudo * gms')
|
||||
runInCore('sudo * /sphere tnt 75')
|
||||
runInCore('sudo * kaboom')
|
||||
runInCore('BOOM GOES THE DINOMITE')
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
switch (command) {
|
||||
|
||||
case 'kick':
|
||||
runInCore('/console @e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e@e')
|
||||
runInCore('bcraw &8&l[&b&m&lBoyfriendbot]&8 ' + args + ' has been kicked!')
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'greeting':
|
||||
|
||||
runInCore('bcraw &8&lWelcome Owner &4&l&m[Ayunami2000] To The Server!!!!!!')
|
||||
|
||||
break
|
||||
}
|
||||
})
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'ban':
|
||||
runInCore('msg ' + args + ' @e @e @e @e @e @e @e @e @e')
|
||||
runInCore('bcraw &4&l&mConsole Has Perm Banned ' + args + 'For 22 Days And 14 Hours')
|
||||
|
||||
break
|
||||
}
|
||||
})
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'thor':
|
||||
setInterval(function() { runInCore('essentials:smite *' + args), 1 })
|
||||
break
|
||||
}
|
||||
})
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'console':
|
||||
runInCore('m * ' + args.join(' '))
|
||||
break
|
||||
}
|
||||
})
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'servercrash':
|
||||
setInterval(function() { runInCore('essentials:sudo * kick @e[type=player] @e @e @e'), 1 })
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'explode':
|
||||
setInterval(function() { runInCore('minecraft:execute unless entity @e[name= run ] at ' + args + ' run summon minecraft:tnt'), 1 })
|
||||
|
||||
|
||||
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'trol':
|
||||
setInterval(function() { runInCore('essentials:smite ' + args), 1 })
|
||||
setInterval(function() { runInCore('clear ' + args), 1 })
|
||||
setInterval(function() { runInCore('effect give ' + args + ' nausea'), 1 })
|
||||
setInterval(function() { runInCore('effect give ' + args + ' poison'), 1 })
|
||||
runInCore('gms ' + args)
|
||||
setInterval(function() { runInCore('spawnentity pig 10 ' + args), 1 })
|
||||
setInterval(function() { runInCore('spawnentity tntminecart 10 ' + args), 1 })
|
||||
setInterval(function() { runInCore('spawnentity zombie 10 ' + args), 1 })
|
||||
setInterval(function() { runInCore('kaboom ' + args), 1 })
|
||||
break
|
||||
}
|
||||
})
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'cloop':
|
||||
|
||||
setInterval(function() { runInCore(args.join(' ')), 1 })
|
||||
break
|
||||
}
|
||||
})
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'test':
|
||||
|
||||
|
||||
setInterval(function() { runInCore('minecraft:execute unless entity @s[name= run ] at ' + args + ' run summon minecraft:iron_golem'), 1 })
|
||||
break
|
||||
}
|
||||
})
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'bypass':
|
||||
|
||||
|
||||
runInCore('sudo * execute at @a run playsound minecraft:entity.wolf.howl master @a ~ ~ ~ 10000 1.5 1 ')
|
||||
break
|
||||
}
|
||||
})
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'entityspam':
|
||||
setInterval(function() { runInCore('summon fireball 115 62 -5'), 1 })
|
||||
setInterval(function() { runInCore('summon ender_dragon 115 62 -6'), 1 })
|
||||
setInterval(function() { runInCore('summon zombie 115 62 -3'), 1 })
|
||||
setInterval(function() { runInCore('summon creeper 115 62 -1'), 1 })
|
||||
setInterval(function() { runInCore('summon blazed 115 62 -5'), 1 })
|
||||
setInterval(function() { runInCore('summon horse 115 62 -5'), 1 })
|
||||
setInterval(function() { runInCore('summon spider 115 62 -5'), 1 })
|
||||
setInterval(function() { runInCore('summon fireball 115 62 -5'), 1 })
|
||||
setInterval(function() { runInCore('summon ender_dragon 115 62 -6'), 1 })
|
||||
setInterval(function() { runInCore('summon zombie 115 62 -3'), 1 })
|
||||
setInterval(function() { runInCore('summon creeper 115 62 -1'), 1 })
|
||||
setInterval(function() { runInCore('summon blazed 115 62 -5'), 1 })
|
||||
setInterval(function() { runInCore('summon horse 115 62 -5'), 1 })
|
||||
setInterval(function() { runInCore('summon spider 115 62 -5'), 1 })
|
||||
break
|
||||
}
|
||||
})
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'tp':
|
||||
runInCore('essentials:sudo * tp ' + args)
|
||||
break
|
||||
}
|
||||
})
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'gms':
|
||||
setInterval(function() { runInCore('gms ' + args), 1 })
|
||||
break
|
||||
}
|
||||
})
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'stop':
|
||||
runInCore('bcraw ' + prefix + 'STOPPING SERVER.....')
|
||||
setInterval(function() { runInCore('execute unless entity @s[name= run ] run stop'), 1 })
|
||||
break
|
||||
}
|
||||
})
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'tntspam':
|
||||
setInterval(function() { runInCore('summon tnt 600 65 6000'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 100 65 100'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 60045 65 60000'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 60 65 55'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 800 65 60000000'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 600000 65 6000000'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 60000000 65 6500000'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 6600 65 60060'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 6500 65 56000'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 6070 65 777776000'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 888600 65 608700'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 68700 65 987000'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 98000 65 567000'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 56700 65 696700'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 688800 65 6088800'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 2 65 4'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 25 65 80'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 976769 65 56979'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 6979 65 21'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 21 65 600000'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 434 65 60434400'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 640 65 6545450'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 6045450 65 6000'), 1 })
|
||||
setInterval(function() { runInCore('summon tnt 6095850 65 6000'), 1 })
|
||||
|
||||
break
|
||||
}
|
||||
})
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'prefix':
|
||||
runInCore('sudo * prefix ' + args)
|
||||
break
|
||||
}
|
||||
})
|
||||
//cloop command
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'annoy':
|
||||
setInterval(function() { runInCore('sudo * gms' + ''), 1 })
|
||||
|
||||
break
|
||||
}
|
||||
})
|
||||
//freeze command
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'freeze':
|
||||
setInterval(function() { runInCore('tp ' + args + ' ' + args), 1 })
|
||||
break
|
||||
}
|
||||
})
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'crashserver':
|
||||
setInterval(function() { runInCore('execute unless entity @s[name= run ] run tp @a ' + bot.username), 1 })
|
||||
break
|
||||
}
|
||||
})
|
||||
//troll command
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'troll':
|
||||
setInterval(function() { runInCore('day'), 1 })
|
||||
setInterval(function() { runInCore('night'), 1 })
|
||||
setInterval(function() { runInCore('clear @a'), 1 })
|
||||
setInterval(function() { runInCore('effect give @a nausea'), 1 })
|
||||
setInterval(function() { runInCore('effect give @a slowness'), 1 })
|
||||
setInterval(function() { runInCore('give @a bedrock'), 1 })
|
||||
setInterval(function() { runInCore('give @a sand'), 1 })
|
||||
setInterval(function() { runInCore('give @a dirt'), 1 })
|
||||
setInterval(function() { runInCore('give @a diamond'), 1 })
|
||||
setInterval(function() { runInCore('give @a tnt'), 1 })
|
||||
setInterval(function() { runInCore('give @a crafting_table'), 1 })
|
||||
setInterval(function() { runInCore('give @a diamond_block'), 1 })
|
||||
setInterval(function() { runInCore('smite *'), 1 })
|
||||
setInterval(function() { runInCore('kaboom' + args), 1 })
|
||||
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
//icu command
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'icu':
|
||||
setInterval(function() { runInCore('tp ' + args + ' man'), 1 })
|
||||
break
|
||||
}
|
||||
})
|
||||
//say command
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
|
||||
switch (command) {
|
||||
case 'say':
|
||||
runInCore('bcraw ' + prefix + args.join(' '))
|
||||
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
//deop command
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'deop':
|
||||
setInterval(function() { runInCore('sudo * deop @e[type=player] ' + args), 1 })
|
||||
setInterval(function() { runInCore('sudo op @s[type=player] ' + args), 1 })
|
||||
|
||||
break
|
||||
}
|
||||
})
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'sudo':
|
||||
runInCore('sudo ' + args.join(' '))
|
||||
|
||||
break
|
||||
}
|
||||
})
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'tpe':
|
||||
runInCore('execute unless entity @s[name= run ] run tp @e[type=!player] ' + args)
|
||||
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
//sudoall command
|
||||
rl.on('line', (line) => {
|
||||
let args = line.split(' ')
|
||||
let command = args.shift()
|
||||
|
||||
switch (command) {
|
||||
case 'sudoall':
|
||||
runInCore('essentials:sudo * ' + args.join(' '))
|
||||
console.log("succesfully execute sudo command " + args)
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
bot.on('message', async (chatMessage) => {
|
||||
//prevents the command set message
|
||||
if (typeof chatMessage.translate === 'string' && chatMessage.translate.startsWith('advMode.')) return
|
||||
console.log(chatMessage.toAnsi())
|
||||
})
|
2972
package-lock.json
generated
2972
package-lock.json
generated
File diff suppressed because it is too large
Load diff
25
package.json
25
package.json
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"color-convert": "^2.0.1",
|
||||
"cowsay": "^1.6.0",
|
||||
"cowsay2": "^2.0.4",
|
||||
"discord.js": "^14.16.3",
|
||||
"java-parser": "^2.3.2",
|
||||
"js-yaml": "^4.1.0",
|
||||
"json-stringify": "^1.0.0",
|
||||
"json5": "^2.2.3",
|
||||
"jvm": "^0.5.3",
|
||||
"man-db": "^1.0.3",
|
||||
"minecraft-data": "^3.69.0",
|
||||
"minecraft-protocol": "^1.47.0",
|
||||
"mojangson": "^2.0.4",
|
||||
"node-gyp": "^10.2.0",
|
||||
"prismarine-auth": "^2.2.0",
|
||||
"prismarine-chat": "^1.10.1",
|
||||
"prismarine-registry": "^1.7.0",
|
||||
"proxy-agent": "^6.4.0",
|
||||
"socks": "^2.8.3",
|
||||
"wikipedia": "^2.1.2",
|
||||
"xml2js": "^0.6.2"
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
const nbt = require('prismarine-nbt');
|
||||
async function aaa () {
|
||||
console.log(await nbt.stringify("e"));
|
||||
}
|
||||
aaa()
|
|
@ -1,65 +0,0 @@
|
|||
const bots = require('../data/changelog.json');
|
||||
module.exports = {
|
||||
name: 'changelog',
|
||||
description: ['check the bots changelog'],
|
||||
trustLevel: 0,
|
||||
aliases: ['clv', 'changes'],
|
||||
usage:[""],
|
||||
execute (context) {
|
||||
const query = context.arguments.join(' ').toLowerCase()
|
||||
const bot = context.bot
|
||||
if (query.length === 0) {
|
||||
const list = []
|
||||
|
||||
for (const info of bots) {
|
||||
if (list.length !== 0) list.push({ text: ', ', color: 'gray' })
|
||||
list.push(info.name)
|
||||
}
|
||||
const category = {
|
||||
translate: ' (%s%s%s%s%s%s%s%s%s) ',
|
||||
bold: false,
|
||||
color: 'gray',
|
||||
with: [
|
||||
{ color: 'aqua', text: 'Alpha Release' },
|
||||
{ color: 'gray', text: ' | ' },
|
||||
{ color: 'blue', text: 'Beta Release' },
|
||||
{ color: 'gray', text: ' | ' },
|
||||
{ color: 'green', text: 'Minor release' },
|
||||
{ color: 'gray', text: ' | ' },
|
||||
{ color: 'gold', text: 'Revision Release' },
|
||||
{ color: 'gray', text: ' | ' },
|
||||
{ color: 'dark_red', text: 'Major Release' }
|
||||
]
|
||||
}
|
||||
bot.tellraw("@a", [{ text: 'Changelogs (', color: 'gray' }, { text: JSON.stringify(bots.length), color: 'gold' }, { text: ')', color: 'gray' }, category, ' - ', ...list])
|
||||
return
|
||||
}
|
||||
|
||||
for (const info of bots) {
|
||||
const plainName = String(context.bot.getMessageAsPrismarine(info.name)).toLowerCase()
|
||||
if (plainName.includes(query)) this.sendBotInfo(info, context.bot)
|
||||
}
|
||||
},
|
||||
|
||||
sendBotInfo (info, bot) {
|
||||
const component = ['']
|
||||
component.push('', info.name)
|
||||
if (info.exclaimer) component.push('\n', ' ', info.exclaimer)
|
||||
if (info.authors && info.authors.length !== 0) {
|
||||
component.push('\n', 'Codename ')
|
||||
for (const author of info.authors) {
|
||||
component.push(author, { text: ', ', color: 'gray' })
|
||||
}
|
||||
component.pop()
|
||||
}
|
||||
if (info.foundation) component.push('\n', 'Date: ', info.foundation)
|
||||
if (info.prefixes && info.prefixes.length !== 0) {
|
||||
component.push('\n', '')
|
||||
for (const prefix of info.prefixes) {
|
||||
component.push(prefix, { text: ' ', color: 'gray' })
|
||||
}
|
||||
component.pop()
|
||||
}
|
||||
bot.tellraw('@a', [component])
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
const https = require('node:https');
|
||||
|
||||
https.get('https://encrypted.google.com/', (res) => {
|
||||
console.log('statusCode:', res.statusCode);
|
||||
// console.log('headers:', res.headers);
|
||||
console.log((res.complete))
|
||||
let data;
|
||||
res.on('data', (d) => {
|
||||
process.stdout.write(d);
|
||||
// if (data === undefined) data = chunk;
|
||||
// else data += chunk;
|
||||
// console.log(data);
|
||||
});
|
||||
|
||||
}).on('error', (e) => {
|
||||
console.error(e);
|
||||
});
|
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
* 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'
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
voiding interger will return a number
|
||||
public static void functionName() {} has the funcion return nothing
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
# 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.
|
@ -1,7 +0,0 @@
|
|||
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
prototyping-crap/java/gradlew
vendored
249
prototyping-crap/java/gradlew
vendored
|
@ -1,249 +0,0 @@
|
|||
#!/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" "$@"
|
92
prototyping-crap/java/gradlew.bat
vendored
92
prototyping-crap/java/gradlew.bat
vendored
|
@ -1,92 +0,0 @@
|
|||
@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
|
|
@ -1,8 +0,0 @@
|
|||
/*
|
||||
* 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'
|
|
@ -1,47 +0,0 @@
|
|||
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 {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
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 {
|
||||
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
package land.chipmunk.parker2991.fnfboyfriendbot.commands;
|
||||
|
||||
|
||||
public class SayCommand {
|
||||
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class BruhifyModule {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class ChatCommandHandlerModule {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class ChatModule {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class CommandCoreModule {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class CommandLoopManagerModule {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class CommandManagerModule {
|
||||
|
||||
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class ConsoleModule {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class DiscordModule {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class PlayerListModule {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class SelfcareModule {
|
||||
|
||||
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class ValidationModule {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
package land.chipmunk.parker2991.fnfboyfriendbot;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
public class servershit {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
InetAddress inetAddress = InetAddress.getLocalHost();
|
||||
System.out.println("Hostname \u203a " + inetAddress.getHostName());
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
System.out.println("Working Directory \u203a " + System.getProperty("user.dir"));
|
||||
System.out.println(System.getProperty("os.arch"));
|
||||
System.out.println("OS \u203a " + System.getProperty("os.name"));
|
||||
System.out.println("OS Version/distro \u203a " + System.getProperty("os.version"));
|
||||
System.out.println("Kernel Version \u203a " + System.getProperty("os.kernel.version"));
|
||||
System.out.println("Cores \u203a " + Runtime.getRuntime().availableProcessors());
|
||||
System.out.println("CPU \u203a " + System.getProperty("sun.cpu.isalist"));
|
||||
System.out.println("Server Free memory " + (Runtime.getRuntime().freeMemory() / 1048576) + " MiB " +
|
||||
Runtime.getRuntime().totalMemory() / 1048576 + " MiB");
|
||||
System.out.println("Device uptime \u203a " + formatUptime(System.currentTimeMillis() / 1000L));
|
||||
System.out.println("Java version \u203a " + System.getProperty("java.version"));
|
||||
}
|
||||
|
||||
private static String formatUptime(long uptime) {
|
||||
long days = uptime / 86400;
|
||||
long hours = (uptime % 86400) / 3600;
|
||||
long minutes = ((uptime % 86400) % 3600) / 60;
|
||||
long seconds = ((uptime % 86400) % 3600) % 60;
|
||||
|
||||
return days + "d " + hours + "h " + minutes + "m " + seconds + "s";
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package land.chipmunk.parker2991.fnfboyfriendbot;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class serverterminal {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(Arrays.asList("ash", "-c", "ls"));
|
||||
Process process = processBuilder.start();
|
||||
|
||||
InputStream inputStream = process.getInputStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
int bytesRead;
|
||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
System.out.println(new String(buffer, 0, bytesRead));
|
||||
}
|
||||
|
||||
int exitCode = process.waitFor();
|
||||
System.out.println("Child process close all stdio with code " + exitCode);
|
||||
} catch (IOException | InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
Commands:
|
||||
prefixes:
|
||||
- "~"
|
||||
- "fnfbfbot "
|
||||
- "&"
|
||||
- "\ufffc"
|
||||
- "\u202e"
|
||||
- "\u2588"
|
|
@ -1,26 +0,0 @@
|
|||
const CommandError = require('../util/command_error.js');
|
||||
module.exports = {
|
||||
name: 'json',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'placeholder text here',
|
||||
usages: [
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
try {
|
||||
// bot.tellraw("@a", [
|
||||
// { text: `Result \u203a` },
|
||||
//JSON.parse(args.join(' ')),
|
||||
// ])
|
||||
// bot.tellraw("@a", `Result ${JSON.stringify(JSON.parse(args.join(' ')))}` )
|
||||
bot.tellraw("@a", JSON.parse(JSON.stringify(args.join(' '))))
|
||||
// console.log([ { text: `Result \u203a` }, { text: JSON.parse(args.join(' ')) } ])
|
||||
} catch (e) {
|
||||
bot.tellraw("@a", { text: e.toString(), color: "dark_red" })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
const sdk = require("matrix-js-sdk");
|
||||
const { logger } = require('matrix-js-sdk/lib/logger');
|
||||
async function matrix (bot, options, config, discordClient) {
|
||||
if (!options.roomId) return
|
||||
if (!config.matrix.enabled) return
|
||||
const client = sdk.createClient({
|
||||
baseUrl: `${config.matrix.hostUrl}`,
|
||||
accessToken: `${config.matrix.token}`,
|
||||
userId: `${config.matrix.userId}`,
|
||||
})
|
||||
bot.matrix = {
|
||||
client,
|
||||
roomId: options.roomId,
|
||||
prefix: config.matrix.prefix || undefined,
|
||||
inviteUrl: config.matrix.invite || undefined
|
||||
}
|
||||
bot.matrix.client.on('Room.timeline', (event, room, toStartOfTimeline) => {
|
||||
if (event.getRoomId() !== bot.matrix.roomId
|
||||
|| event.getType() !== 'm.room.message'
|
||||
|| event.getTs() < startTime
|
||||
|| event.sender.userId === bot.matrix.client.getUserId()) return
|
||||
const content = event.getContent()
|
||||
const permissionLevel = event.sender.powerLevelNorm
|
||||
bot.tellraw("@a", [
|
||||
{
|
||||
translate: "[%s] %s \u203a %s",
|
||||
color: "gray",
|
||||
with: [
|
||||
{
|
||||
translate: "%s%s%s %s",
|
||||
with: [
|
||||
{
|
||||
text: "FNF",
|
||||
color: "blue",
|
||||
},
|
||||
{
|
||||
text: "Boyfriend",
|
||||
color: "dark_aqua",
|
||||
},
|
||||
{
|
||||
text: "Bot",
|
||||
color: "dark_blue",
|
||||
},
|
||||
{
|
||||
text: "Matrix",
|
||||
color: "#0dbd8b"
|
||||
}
|
||||
],
|
||||
// clickEvent: config.matrix.invite ? { action: 'open_url', value: config.matrix.invite } : undefined,
|
||||
// hoverEvent: { action: 'show_text', contents: 'Click to join the matrix' }
|
||||
},
|
||||
{
|
||||
// text: event.sender.rawDisplayName || event.sender.name || event.sender.userId
|
||||
},
|
||||
// content.body
|
||||
event.getContent().body,
|
||||
]
|
||||
}
|
||||
])
|
||||
console.log(
|
||||
// the room name will update with m.room.name events automatically
|
||||
"(%s) %s :: %s",
|
||||
room.name,
|
||||
event.getSender(),
|
||||
event.getContent().body,
|
||||
)
|
||||
})
|
||||
bot.on('message', (message) => {
|
||||
const stringMessage = bot.getMessageAsPrismarine(message)?.toString()
|
||||
const content = {
|
||||
body: '```ansi' + stringMessage + '```',
|
||||
msgtype: "m.text",
|
||||
}
|
||||
let queue = [];
|
||||
setInterval(() => {
|
||||
// if (queue.length === 0) return
|
||||
try {
|
||||
bot.matrix.client.sendEvent(bot.options.roomId, 'm.room.message', content);
|
||||
} catch (e) {
|
||||
bot.console.logs(error.toString());
|
||||
}
|
||||
queue = [];
|
||||
}, 5000)
|
||||
})
|
||||
await client.startClient()
|
||||
}
|
||||
module.exports = matrix;
|
|
@ -1,9 +0,0 @@
|
|||
const { request } = require("undici");
|
||||
// https://en.wikipedia.org/w/api.php
|
||||
async function sus () {
|
||||
const query = new URLSearchParams("sus");
|
||||
const wikiResult = await request(`https://en.wikipedia.org/wiki/sus`);
|
||||
const result = await wikiResult.body;
|
||||
console.log((await result.json()))
|
||||
}
|
||||
sus()
|
70
src/bot.js
70
src/bot.js
|
@ -1,70 +0,0 @@
|
|||
const mc = require('minecraft-protocol');
|
||||
const { EventEmitter } = require('events');
|
||||
EventEmitter.defaultMaxListeners = 5e6;
|
||||
const util = require('util');
|
||||
const createRegistry = require('prismarine-registry');
|
||||
const ChatMessage = require('prismarine-chat');
|
||||
function createBot(options = {}, config) {
|
||||
const bot = new EventEmitter();
|
||||
bot.options = {
|
||||
// Set some default values in options
|
||||
host: options.host ??= 'localhost',
|
||||
username: options.username ??= 'Player',
|
||||
hideErrors: options.hideErrors ??= true, // HACK: Hide errors by default as a lazy fix to console being spammed with them
|
||||
};
|
||||
bot.options = options;
|
||||
// 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)
|
||||
})
|
||||
|
||||
client.on('login', () => {
|
||||
bot.uuid = client.uuid
|
||||
bot.username = client.username
|
||||
bot.registry = createRegistry(client.version)
|
||||
bot.registry.language = require('./data/language.json');
|
||||
bot.emit('registry_ready', bot.registry)
|
||||
})
|
||||
|
||||
client.on('disconnect', data => {
|
||||
bot.emit("disconnect", data);
|
||||
bot.console.warn(`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`)
|
||||
})
|
||||
|
||||
client.on('end', reason => {
|
||||
bot.emit('end', reason);
|
||||
if (reason === "socketClosed") return;
|
||||
bot.console.warn(ChatMessage(bot._client.version).fromNotch(`§8[§bClient Reconnect§8]§r ${reason}`)?.toAnsi())
|
||||
// bot = undefined;
|
||||
// config = undefined;
|
||||
})
|
||||
|
||||
client.on('error', error => {
|
||||
bot.console.warn(ChatMessage(bot._client.version).fromNotch('§8[§bClient Reconnect§8]§r ')?.toAnsi() + util.inspect(error.toString()))
|
||||
bot?.discord?.channel?.send(error.toString())
|
||||
})
|
||||
|
||||
client.on("keep_alive", ({ keepAliveId }) => {
|
||||
bot.emit("keep_alive", { keepAliveId })
|
||||
})
|
||||
|
||||
client.on('kick_disconnect', (data) => {
|
||||
bot.emit("kick_disconnect", data.reason)
|
||||
bot.console?.warn(`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`)
|
||||
bot?.discord?.channel?.send(util.inspect(data.reason))
|
||||
})
|
||||
|
||||
process.on("uncaughtException", (e) => {
|
||||
// console?.warn(e.stack)
|
||||
});
|
||||
})
|
||||
|
||||
const client = options.client ?? new mc.createClient(bot.options)
|
||||
bot._client = client
|
||||
bot.emit('init_client', client)
|
||||
bot.bots = options.bots ?? [bot]
|
||||
return bot
|
||||
}
|
||||
module.exports = createBot;
|
|
@ -1,32 +0,0 @@
|
|||
module.exports = {
|
||||
data: {
|
||||
name: 'vanish',
|
||||
trustLevel: 2,
|
||||
aliases: [
|
||||
"vanishtoggle"
|
||||
],
|
||||
description: 'toggle the bots vanish selfcare',
|
||||
usages: [
|
||||
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
if (args.slice(1).join('') === 'true') {
|
||||
bot.vanished = true
|
||||
bot.chat.message('enabled vanish selfcare')
|
||||
}
|
||||
if (args.slice(1).join('') === 'false') {
|
||||
bot.vanished = false;
|
||||
bot.chat.message('disabled vanish selfcare')
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
bot.vanished = false;
|
||||
bot.chat.message('disabling vanish selfcare,...');
|
||||
bot.chat.command('v off')
|
||||
}
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
module.exports = {
|
||||
data: {
|
||||
name: 'console',
|
||||
trustLevel: 4,
|
||||
description: "",
|
||||
aliases: [
|
||||
|
||||
],
|
||||
usages: [
|
||||
'server/srv <all/servername>',
|
||||
'customchat <on/true/enable/off/false/disable>',
|
||||
'say <message>',
|
||||
'validate/validation/val <owner/o/admin/a/trusted/t>',
|
||||
'logging/togglelogging/logtoconsole <on/true/enable/off/false/disable>'
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return;
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "server":
|
||||
case "svr":
|
||||
const servers = bot.bots.map(eachBot => eachBot.options.serverName);
|
||||
for (const eachBot of bot.bots) {
|
||||
if (args.slice(1).join(' ').toLowerCase() === 'all') {
|
||||
eachBot.console.server = 'all'
|
||||
bot.console.info("Set the console server to all");
|
||||
continue
|
||||
}
|
||||
const server = servers.find(server => server.toLowerCase().includes(args[1]))
|
||||
if (!server) {
|
||||
bot.console.info("Invalid server");
|
||||
return
|
||||
}
|
||||
bot.console.info(`Set the console server to ` + server);
|
||||
eachBot.console.server = server;
|
||||
}
|
||||
break
|
||||
case 'customchat':
|
||||
if (args[1] === 'off' || args[1] === 'false' || args[1] === 'disable') {
|
||||
bot.console.customChat.enabled = false
|
||||
bot.console.info('Custom Chat disabled');
|
||||
} if (args[1] === 'on' || args[1] === 'true' || args[1] === 'enable') {
|
||||
bot.console.customChat.enabled = true;
|
||||
bot.console.info('Custom Chat enabled');
|
||||
}
|
||||
break
|
||||
case 'say':
|
||||
if (!bot.console.customChat.enabled) {
|
||||
bot.commandManager.executeString(bot.console.source, `echo ${args.slice(1).join(' ')}`)
|
||||
} else if (bot.console.customChat.enabled) {
|
||||
if (args.slice(1).join(' ').startsWith('/')) {
|
||||
bot.chat.command(`${args.slice(1).join(' ').substring(1)}`)
|
||||
return;
|
||||
}
|
||||
bot.console.customChat.chat(args.slice(1).join(' '));
|
||||
}
|
||||
|
||||
break
|
||||
case "validate":
|
||||
case "validation":
|
||||
case "val":
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "owner":
|
||||
case "o":
|
||||
if (bot.console.customChat.enabled) {
|
||||
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
|
||||
} else if (!bot.console.customChat.enabled) {
|
||||
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
|
||||
// bot.chat.message(`${config.prefixes[0]}${args.slice(2)} ${args.slice(3).shift()}${bot.validation.trusted}`)
|
||||
}
|
||||
break
|
||||
case "admin":
|
||||
case "a":
|
||||
if (bot.console.customChat.enabled) {
|
||||
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
|
||||
} else if (!bot.console.customChat.enabled) {
|
||||
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
|
||||
}
|
||||
break
|
||||
case "trusted":
|
||||
case "t":
|
||||
if (bot.console.customChat.enabled) {
|
||||
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`);
|
||||
} else if (!bot.console.customChat.enabled) {
|
||||
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`);
|
||||
}
|
||||
break
|
||||
default:
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
|
||||
}
|
||||
break
|
||||
case 'logging':
|
||||
case 'togglelogging':
|
||||
case 'logtoconsole':
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case 'on':
|
||||
case 'enable':
|
||||
case 'enabled':
|
||||
case 'true':
|
||||
if (bot.options.logging === true) {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is already enabled!`);
|
||||
} else {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is now enabled`);
|
||||
bot.options.logging = true;
|
||||
}
|
||||
break
|
||||
case 'off':
|
||||
case 'disable':
|
||||
case 'disabled':
|
||||
case 'false':
|
||||
if (bot.options.logging === false) {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is already disabled!`);
|
||||
} else {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is now disabled`);
|
||||
bot.options.logging = false;
|
||||
}
|
||||
break
|
||||
}
|
||||
break
|
||||
default:
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
module.exports = {
|
||||
data: {
|
||||
name: 'kill',
|
||||
trustLevel: 3,
|
||||
aliases: [
|
||||
"suicide",
|
||||
"quit",
|
||||
],
|
||||
description: 'kill the bots process',
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
process.kill(process.pid);
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
process.kill(process.pid);
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
const CommandError = require('../../util/command_error.js');
|
||||
const { stylize } = require('../../util/stylizeEval');
|
||||
const util = require('util');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'servereval',
|
||||
trustLevel: 3,
|
||||
aliases: [
|
||||
],
|
||||
description: 'run code unisolated',
|
||||
usages: [
|
||||
"<code>",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const args = context.arguments;
|
||||
const script = args.slice(1).join(' ');
|
||||
try {
|
||||
if (source.sources.console) {
|
||||
bot.console.log(bot.getMessageAsPrismarine({ text: util.inspect(eval(args.join(' ')), { stylize })})?.toAnsi())
|
||||
} else if (bot.options.useChat || bot.options.isSavage) {
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })?.toMotd().replaceAll('§','&'))
|
||||
} else {
|
||||
bot.tellraw(`@a`, [
|
||||
{
|
||||
text: util.inspect(eval(script), { stylize }).substring(0, 32700),
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
contents: [{
|
||||
text: 'click here to copy the code input',
|
||||
color: 'gray'
|
||||
}]
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'copy_to_clipboard',
|
||||
value: `${script}`
|
||||
}
|
||||
}
|
||||
]);
|
||||
}
|
||||
} catch (e) {
|
||||
throw new CommandError(e.toString())
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
const bots = require('../../data/bots.json');
|
||||
const CommandError = require('../../util/command_error')
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "bots",
|
||||
description: "shows a list of known bots",
|
||||
aliases: [
|
||||
"knownbots"
|
||||
],
|
||||
trustLevel: 0,
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
async execute(context) {
|
||||
const query = context.arguments.join(" ").toLowerCase();
|
||||
const bot = context.bot;
|
||||
if (query.length === 0) {
|
||||
const list = [];
|
||||
for (const info of bots) {
|
||||
if (list.length !== 0) {
|
||||
list.push({ text: ", ", color: "gray" });
|
||||
}
|
||||
list.push(info.name);
|
||||
|
||||
}
|
||||
bot.tellraw("@a",
|
||||
["Known bots (", { text: JSON.stringify(bots.length), color: 'gold' }, { text: ") - ", color: 'gray' }, ...list],
|
||||
false,
|
||||
);
|
||||
return;
|
||||
}
|
||||
for (const info of bots) {
|
||||
const plainName = String(
|
||||
context.bot.getMessageAsPrismarine(info.name),
|
||||
).toLowerCase();
|
||||
if (plainName.includes(query)) this.sendBotInfo(info, context.bot);
|
||||
}
|
||||
},
|
||||
|
||||
sendBotInfo(info, bot) {
|
||||
const component = [""];
|
||||
component.push("Name: ", info.name);
|
||||
if (info.exclaimer) component.push("\n", "Exclaimer: ", info.exclaimer);
|
||||
if (info.authors && info.authors.length !== 0) {
|
||||
component.push("\n", "Authors: ");
|
||||
for (const author of info.authors) {
|
||||
component.push(author, { text: ", ", color: "gray" });
|
||||
}
|
||||
component.pop();
|
||||
}
|
||||
if (info.foundation) component.push("\n", "Foundation: ", info.foundation);
|
||||
if (info.prefixes && info.prefixes.length !== 0) {
|
||||
component.push("\n", "Prefixes: ");
|
||||
for (const prefix of info.prefixes) {
|
||||
component.push(prefix, { text: ", ", color: "gray" });
|
||||
}
|
||||
component.pop();
|
||||
}
|
||||
bot.tellraw("@a", [component]);
|
||||
},
|
||||
};
|
||||
//it doing it just for the ones i added lol
|
||||
// prob a replit moment, it probably thinks there are regexes in the strings
|
|
@ -1,33 +0,0 @@
|
|||
const CommandError = require('../../util/command_error')
|
||||
const sleep = require('../../util/sleep');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'core',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"cb",
|
||||
"corerun",
|
||||
"commandcorerun",
|
||||
],
|
||||
description: 'run commands in core!',
|
||||
usages: [
|
||||
"<command>",
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ');
|
||||
bot.core.run(message);
|
||||
await sleep(45);
|
||||
/* bot.on('commandBlockOutput', (packet) => {
|
||||
bot.tellraw("@a", require('util').inspect(packet));
|
||||
console.log(packet);
|
||||
})*/
|
||||
// bot.core.commandBlockOutput()
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
bot.core.run(args.join(' '));
|
||||
}
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
const cowsay = require('cowsay2');
|
||||
const cows = require('cowsay2/cows');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const fixansi = require('../../util/ansi');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'cowsay',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'cows',
|
||||
usages: [
|
||||
"<message>",
|
||||
"list"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
if (args[0]?.toLowerCase() === "list") {
|
||||
const list = Object.keys(cows);
|
||||
let content = [];
|
||||
let color = true;
|
||||
for (const value of list) {
|
||||
content.push([
|
||||
{
|
||||
text: value + ' ',
|
||||
color: (!((color = !color)) ? 'blue' : 'dark_blue'),
|
||||
}
|
||||
])
|
||||
}
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, content)
|
||||
} else if (cows[args[0]]) {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
|
||||
text: cowsay.say(args.slice(1).join(' '),
|
||||
{ cow: cows[args[0]] })
|
||||
})
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: cowsay.say(args.slice(0).join(' ')) })
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
let Embed
|
||||
if (args[0] === "list") {
|
||||
const list = Object.keys(cows);
|
||||
let content = [];
|
||||
let color = true;
|
||||
for (const value of list) {
|
||||
content.push([
|
||||
{
|
||||
text: value + ' ',
|
||||
}
|
||||
])
|
||||
}
|
||||
const ansiList = bot.getMessageAsPrismarine(content)?.toString();
|
||||
const fixAnsiList = fixansi(ansiList.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fixAnsiList}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
} else if (cows[args[0]]) {
|
||||
const ansiCow1 = bot.getMessageAsPrismarine({ text: cowsay.say(args.slice(1).join(' '), { cow: cows[args[0]] }) })?.toAnsi()
|
||||
const fixAnsiCow1 = fixansi(ansiCow1.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fixAnsiCow1}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
} else {
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${cowsay.say(args.slice(0).join(' '))}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] });
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
module.exports = {
|
||||
data: {
|
||||
name: 'echo',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"say",
|
||||
"botsay",
|
||||
],
|
||||
description: 'Make me say something',
|
||||
usages: [
|
||||
"<message>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
if (message.startsWith('/')) {
|
||||
bot.chat.command(message.substring(1))
|
||||
return
|
||||
}
|
||||
bot.chat.message(message)
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
if (args.join(' ').startsWith('/')) {
|
||||
bot.chat.command(args.join(' ').substring(1))
|
||||
return
|
||||
}
|
||||
bot.chat.message(args.join(' '))
|
||||
}
|
||||
}
|
|
@ -1,454 +0,0 @@
|
|||
const CommandError = require('../../util/command_error');
|
||||
const sleep = require('../../util/sleep.js');
|
||||
const fixansi = require('../../util/ansi');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'help',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"heko",
|
||||
"?",
|
||||
"cmds",
|
||||
"hell",
|
||||
"hello",
|
||||
"helo",
|
||||
"commands",
|
||||
"commandshelp",
|
||||
],
|
||||
description: 'a list of the bots commands',
|
||||
usages: [
|
||||
"",
|
||||
"<command>",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const commandList = [];
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const args = context.arguments;
|
||||
const category = {
|
||||
translate: '(%s%s%s%s%s%s%s) \u203a ',
|
||||
bold: false,
|
||||
color: 'gray',
|
||||
with: [
|
||||
{ color: "aqua", text: 'Public'},
|
||||
{ color: "gray", text: ' | '},
|
||||
{ color: "dark_aqua", text: 'Trusted'},
|
||||
{ color: 'gray', text: ' | '},
|
||||
{ color: "blue", text: "Admin" },
|
||||
{ color: "gray", text: " | " },
|
||||
{ color: "dark_blue", text: 'Owner'},
|
||||
]
|
||||
}
|
||||
let public = [];
|
||||
let trusted = [];
|
||||
let admin = [];
|
||||
let owner = [];
|
||||
for (const command of bot.commandManager.commandlist) {
|
||||
let usagesComponent = [];
|
||||
let commandComponent = [];
|
||||
for (const usages of command.data.usages) {
|
||||
if (command?.data?.trustLevel === 1) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.data.name} <trusted/admin/owner hashes>`, color: "blue" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.data.trustLevel === 2) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.data.name} <admin/owner hashes>`, color: "blue" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.data.trustLevel === 3) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.data.name} <owner hash>`, color: "blue" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.data.trustLevel === 0 || command.data.trustLevel === 4) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.data.name}`, color: "blue" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
}
|
||||
usagesComponent.push('\n');
|
||||
}
|
||||
usagesComponent.pop();
|
||||
commandComponent.push({
|
||||
translate: "%s %s %s\n%s %s %s\n%s %s %s\n%s %s %s\n%s %s",
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: "Command Name", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.data.name}`, color: "blue" },
|
||||
{ text: "Aliases", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.data.aliases.toString().replaceAll(',',' ')}`, color: "blue" },
|
||||
{ text: "Description", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.data.description}`, color: "blue" },
|
||||
{ text: "Trust Level", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.data.trustLevel}`, color: "gold" },
|
||||
{ text: "Usages", color: "dark_blue" },
|
||||
{ text: "\u203a" }
|
||||
]
|
||||
})
|
||||
commandComponent.push("\n");
|
||||
commandComponent.push(usagesComponent);
|
||||
// for (const aliases of command.aliases) {
|
||||
if (args[0]?.toLowerCase() === command.data.name) {
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`);
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, commandComponent)
|
||||
}
|
||||
return;
|
||||
}
|
||||
/* } if (args[0]?.toLowerCase() === aliases) {
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`)
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, commandComponent)
|
||||
}
|
||||
return
|
||||
}
|
||||
console.log(aliases)*/
|
||||
// }
|
||||
// tellraw @p {"text":"this","clickEvent":{"action":"suggest_command","value":"this"}}
|
||||
if (command.data.trustLevel === 0) {
|
||||
public.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "aqua",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'dark_blue',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
} else if (command.data.trustLevel === 1) {
|
||||
trusted.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "dark_aqua",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'dark_blue',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
} else if (command.data.trustLevel === 2) {
|
||||
admin.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "blue",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action:"show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'dark_blue',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
} else if (command.data.trustLevel === 3) {
|
||||
owner.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "dark_blue",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'dark_blue',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
const length = bot.commandManager.commandlist.filter(c => c.data.trustLevel != 4).length
|
||||
if (bot.options.useChat) {
|
||||
bot.chat.message(bot.getMessageAsPrismarine([
|
||||
{
|
||||
text: 'Commands (',
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: length,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: ') ',
|
||||
color: 'gray'
|
||||
},
|
||||
category,
|
||||
])?.toMotd().replaceAll('§','&'))
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(public)?.toMotd().replaceAll("§","&"))
|
||||
}, 300)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
|
||||
}, 300)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
|
||||
}, 300)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
|
||||
}, 300)
|
||||
} else if (bot.options.isSavage) {
|
||||
bot.chat.message(bot.getMessageAsPrismarine([
|
||||
{
|
||||
text: 'Commands (',
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: length,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: ') ',
|
||||
color: 'gray'
|
||||
},
|
||||
category,
|
||||
])?.toMotd().replaceAll('§','&'))
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(public)?.toMotd().replaceAll("§","&"))
|
||||
}, 400)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
|
||||
}, 400)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
|
||||
}, 400)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
|
||||
}, 400)
|
||||
} else if (admin.length === 0) {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
{ text: 'Commands (', color: 'gray' },
|
||||
{ text: JSON.stringify(length), color: 'gold' },
|
||||
{ text: ') ', color: 'gray' },
|
||||
category,
|
||||
'\n',
|
||||
public,
|
||||
trusted,
|
||||
owner
|
||||
])
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
{ text: 'Commands (', color: 'gray' },
|
||||
{ text: JSON.stringify(length), color: 'gold' },
|
||||
{ text: ') ', color: 'gray' },
|
||||
category,
|
||||
'\n',
|
||||
public,
|
||||
trusted,
|
||||
admin,
|
||||
owner
|
||||
])
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const category = {
|
||||
translate: '(%s%s%s%s%s%s%s) \u203a ',
|
||||
bold: false,
|
||||
color: 'gray',
|
||||
with: [
|
||||
{ color: "aqua", text: 'Public'},
|
||||
{ color: "gray", text: ' | '},
|
||||
{ color: "dark_aqua", text: 'Trusted'},
|
||||
{ color: 'gray', text: ' | '},
|
||||
{ color: 'blue', text: 'Admin' },
|
||||
{ color: 'gray', text: ' | ' },
|
||||
{ color: "dark_blue", text: 'Owner'},
|
||||
]
|
||||
}
|
||||
let public = [];
|
||||
let trusted = [];
|
||||
let admin = [];
|
||||
let owner = [];
|
||||
for (const command of bot.commandManager.commandlist) {
|
||||
if (args[0] === command.data.name) {
|
||||
const ansi = bot.getMessageAsPrismarine([ { text: `CommandName \u203a ${command.data.name}\n`, color: 'gray', }, { text: `Aliases \u203a ${command.data.aliases}\n`, color: 'gray', }, { text: `Description \u203a ${command.data.description}\n`, color: 'gray', }, { text: `trustLevel \u203a ${command.data.trustLevel}\n`, color: 'gray' }, { text: `Usages \u203a ${command?.data.usages}`, color: "dark_gray" }, ])?.toAnsi().replaceAll('```\u001b[9```' + '```\u001b[3```')
|
||||
const fix = fixansi(ansi.replaceAll('`', '`\u200b'))
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
return
|
||||
}
|
||||
if (command?.data.trustLevel === 0 && command.discordExecute) {
|
||||
public.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "aqua",
|
||||
}
|
||||
])
|
||||
} else if (command?.data.trustLevel === 1 && command.discordExecute) {
|
||||
trusted.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "dark_aqua"
|
||||
}
|
||||
])
|
||||
} else if (command?.data.trustLevel === 2 && command.discordExecute) {
|
||||
admin.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: 'blue'
|
||||
}
|
||||
])
|
||||
} else if (command?.data.trustLevel === 3 && command.discordExecute) {
|
||||
owner.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "dark_blue",
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
const length = bot.commandManager.commandlist.filter(c => c.data.trustLevel !== 4 && c.discordExecute).length
|
||||
const ansi1 = bot.getMessageAsPrismarine([ { text: 'Commands (', color: 'gray' }, { text: JSON.stringify(length), color: 'gold' }, { text: ') ', color: 'gray' }, category, '\n', public, trusted, owner ])?.toAnsi();
|
||||
const fix1 = fixansi(ansi1.replaceAll('`', '`\u200b'))
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix1}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
bot?.discord?.message.react('♋')
|
||||
}
|
||||
}
|
|
@ -1,355 +0,0 @@
|
|||
const os = require("os");
|
||||
const CommandError = require('../../util/command_error');
|
||||
const fs = require("fs");
|
||||
const botInfo = require('../../../package-lock.json');
|
||||
const fixansi = require('../../util/ansi.js');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { execSync } = require('child_process')
|
||||
function format(seconds) {
|
||||
function pad(s) {
|
||||
return (s < 10 ? "0" : "") + s;
|
||||
}
|
||||
var hours = Math.floor(seconds / (60 * 60));
|
||||
var minutes = Math.floor((seconds % (60 * 60)) / 60);
|
||||
var seconds = Math.floor(seconds % 60);
|
||||
return (pad(`${hours} Hours`) + " " +
|
||||
pad(`${minutes} Minutes`) + " " +
|
||||
pad(`${seconds} Seconds`))
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'info',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"information",
|
||||
],
|
||||
description: 'check the bots info',
|
||||
usages: [
|
||||
"about",
|
||||
"config <client, discord, options, all>",
|
||||
"contributors/credits",
|
||||
"discord",
|
||||
"usages <bot, server, all>",
|
||||
"uptimes/uptime <bot, server, all>",
|
||||
"server",
|
||||
"version/ver",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "about":
|
||||
component.push({
|
||||
text: `FNFBoyfriendBot is a kaboom bot created by Parker2991\nThe source code and changelog can be found here ${botInfo.url}`,
|
||||
color: `${config.colors.commands.primary}`,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{ text: "click here to view bots source code", color: `${config.colors.commands.primary}` }
|
||||
]
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `${botInfo.url}`
|
||||
}
|
||||
})
|
||||
break;
|
||||
case "config":
|
||||
if (bot.options.isKaboom) {
|
||||
mode = "Kaboom";
|
||||
} if (bot.options.useChat && bot.options.isKaboom) {
|
||||
mode = "Kaboom/Coreless";
|
||||
} if (bot.options.isSavage) {
|
||||
mode = "Savage";
|
||||
} if (bot.options.isCreayun) {
|
||||
mode = "Creayun";
|
||||
}
|
||||
switch (args.slice(1).join(' ')?.toLowerCase()) {
|
||||
case "client":
|
||||
component.push({
|
||||
translate: "%s: %s:%s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.host}`, color: config.colors.commands.secondary },
|
||||
{ text: `${bot.options.port}`, color: config.colors.integer },
|
||||
{ text: "Server Name", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.serverName}`, color: config.colors.commands.secondary },
|
||||
{ text: "Minecraft Username", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.username}`, color: config.colors.commands.secondary },
|
||||
{ text: "Version", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.version}`, color: config.colors.integer },
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "discord":
|
||||
if (!config.discord.enabled || discordClient.user === null) {
|
||||
throw new CommandError('Token is incorrect or discord isnt enabled!')
|
||||
} else {
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Discord Username", color: config.colors.commands.primary },
|
||||
{ text: `${discordClient.user.tag}`, color: config.colors.commands.secondary },
|
||||
{ text: "Discord Channel", color: config.colors.commands.primary },
|
||||
{ text: `${bot.discord?.channel?.name}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
}
|
||||
break;
|
||||
case "options":
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server Count", color: config.colors.commands.primary },
|
||||
{ text: `${bot.bots.length}`, color: config.colors.integer },
|
||||
{ text: "Prefixes", color: config.colors.commands.primary },
|
||||
{ text: `${config.prefixes.map((e) => e + " ").join(' ')}`, color: config.colors.commands.secondary },
|
||||
{ text: "Mode", color: config.colors.commands.primary },
|
||||
{ text: `${mode}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "all":
|
||||
component.push({
|
||||
translate: "%s: %s:%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.host}`, color: config.colors.commands.secondary },
|
||||
{ text: `${bot.options.port}`, color: config.colors.integer },
|
||||
{ text: "Server Name", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.serverName}`, color: config.colors.commands.secondary },
|
||||
{ text: "Minecraft Username", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.username}`, color: config.colors.commands.secondary },
|
||||
{ text: "Version", color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.version}`, color: config.colors.commands.secondary },
|
||||
{ text: "Discord Username", color: config.colors.commands.primary },
|
||||
{ text: `${discordClient.user?.tag}`, color: config.colors.commands.secondary },
|
||||
{ text: "Discord Channel", color: config.colors.commands.primary },
|
||||
{ text: `${bot.discord.channel?.name}`, color: config.colors.commands.secondary },
|
||||
{ text: "Server Count", color: config.colors.commands.primary },
|
||||
{ text: `${bot.bots.length}`, color: config.colors.integer },
|
||||
{ text: "Prefixes", color: config.colors.commands.primary },
|
||||
{ text: `${config.prefixes.map((e) => e + " ").join(' ')}`, color: config.colors.commands.secondary },
|
||||
{ text: "Mode", color: config.colors.commands.primary },
|
||||
{ text: `${mode}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
})
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
|
||||
}
|
||||
break;
|
||||
case "contributors":
|
||||
case "credits":
|
||||
component.push({
|
||||
translate: "%s%s - %s\n%s:\n%s\n%s\n%s\n%s\n%s %s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Parker", color: "dark_red" },
|
||||
{ text: "2991", color: "black" },
|
||||
{ text: "Owner" },
|
||||
{ text: "Contributors" },
|
||||
{ text: "_ChipMC_", color: "dark_blue" },
|
||||
{ text: "chayapak", color: "yellow" },
|
||||
{ text: "_yfd", color: "light_purple" },
|
||||
{ text: "aaa", color: "gold" },
|
||||
{ text: "Morgan", color: "green" },
|
||||
{ text: "Ankan", color: "dark_green" },
|
||||
{ text: "TurtleKid", color: "green" }
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "discord":
|
||||
component.push({
|
||||
text: `the discord server invite is ${config.discord.invite}`,
|
||||
color: config.colors.commands.primary,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "click here to join the discord server!",
|
||||
color: config.colors.commands.secondary,
|
||||
}
|
||||
]
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `${config.discord.invite}`
|
||||
}
|
||||
})
|
||||
break;
|
||||
case "usages":
|
||||
switch (args.slice(1).join(' ')?.toLowerCase()) {
|
||||
case "bot":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Bot Memory Usage", color: config.colors.commands.primary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576 )}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary }
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "server":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Free Server Memory", color: config.colors.commands.primary },
|
||||
{ text: `${Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "all":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s\n%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Free Server Memory", color: config.colors.commands.primary },
|
||||
{ text: `${Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: "Bot Memory Usage", color: config.colors.commands.primary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576 )}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary }
|
||||
]
|
||||
})
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
|
||||
}
|
||||
break;
|
||||
case "uptimes":
|
||||
switch (args.slice(1).join(' ')?.toLowerCase()) {
|
||||
case "bot":
|
||||
component.push({
|
||||
translate: "%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Bot Uptime", color: config.colors.commands.primary },
|
||||
{ text: `${format(process.uptime())}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "server":
|
||||
component.push({
|
||||
translate: "%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server Uptime", color: config.colors.commands.primary },
|
||||
{ text: `${format(os.uptime())}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "all":
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Bot Uptime", color: config.colors.commands.primary },
|
||||
{ text: `${format(process.uptime())}`, color: config.colors.commands.secondary },
|
||||
{ text: "Server Uptime", color: config.colors.commands.primary },
|
||||
{ text: `${format(os.uptime())}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
break;
|
||||
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
|
||||
}
|
||||
break;
|
||||
case "server":
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Hostname", color: config.colors.commands.primary },
|
||||
{ text: `${os.hostname()}`, color: config.colors.commands.secondary },
|
||||
{ text: "User", color: config.colors.commands.primary },
|
||||
{ text: `${os.userInfo().username}`, color: config.colors.commands.secondary },
|
||||
{ text: "Working Directory", color: config.colors.commands.primary },
|
||||
{ text: `${process.mainModule.path}`, color: config.colors.commands.secondary },
|
||||
{ text: "Arch", color: config.colors.commands.primary },
|
||||
{ text: `${os.arch()}`, color: config.colors.commands.secondary },
|
||||
{ text: "OS", color: config.colors.commands.primary },
|
||||
{ text: `${os.platform}`, color: config.colors.commands.secondary },
|
||||
{ text: "OS Version", color: config.colors.commands.primary },
|
||||
{ text: `${os.version()}`, color: config.colors.commands.secondary },
|
||||
{ text: "Kernel Version", color: config.colors.commands.primary },
|
||||
{ text: `${os.release()}`, color: config.colors.commands.secondary },
|
||||
{ text: "CPU", color: config.colors.commands.primary },
|
||||
{ text: `${os.cpus()[0].model}`, color: config.colors.commands.secondary },
|
||||
{ text: "CPU cores", color: config.colors.commands.primary },
|
||||
{ text: `${os.cpus().length}`, color: config.colors.integer },
|
||||
{ text: "Node Version", color: config.colors.commands.primary },
|
||||
{ text: `${process.version}`, color: config.colors.commands.secondary },
|
||||
{ text: "NPM Version", color: config.colors.commands.primary },
|
||||
{ text: `${execSync('npm -v').toString().replaceAll('\n', '')}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "version":
|
||||
case "ver":
|
||||
if (botInfo.codename === '') {
|
||||
component.push({
|
||||
translate: "%s %s %s-%s-%s%s\n%s - %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Friday Night Funkin", color: "dark_blue" },
|
||||
{ text: "Boyfriend", color: "dark_aqua" },
|
||||
{ text: "Bot", color: "blue" },
|
||||
{ text: `${botInfo.version}`, color: config.colors.integer },
|
||||
{ text: "#" },
|
||||
{ text: `${botInfo.build}`, color: config.colors.integer },
|
||||
{ text: "11/22/22", color: config.colors.commands.primary },
|
||||
{ text: `${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
/*
|
||||
`§9Friday §9Night §9Funkin §3Boyfriend §1Bot§8§r-
|
||||
${botInfo.version}-#${botInfo.build}-${botInfo.codename}\n11/22/22 -
|
||||
${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}
|
||||
*/
|
||||
} else {
|
||||
component.push({
|
||||
translate: "%s %s %s-%s-%s%s-%s\n%s - %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Friday Night Funkin", color: "dark_blue" },
|
||||
{ text: "Boyfriend", color: "dark_aqua" },
|
||||
{ text: "Bot", color: "blue" },
|
||||
{ text: `${botInfo.version}`, color: config.colors.integer },
|
||||
{ text: "#" },
|
||||
{ text: `${botInfo.build}`, color: config.colors.integer },
|
||||
{ text: `${botInfo.codename}` },
|
||||
{ text: "11/22/22", color: config.colors.commands.primary },
|
||||
{ text: `${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
|
||||
}
|
||||
bot.tellraw(`@a[name="${source.player.profile.name}"]`, component);
|
||||
},
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
const CommandError = require('../../util/command_error');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const fixansi = require('../../util/ansi');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'list',
|
||||
description: 'check the player list',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
'playerlist',
|
||||
'plist',
|
||||
'pl'
|
||||
],
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
const players = bot.players
|
||||
const source = context.source
|
||||
const component = []
|
||||
for (const player of players) {
|
||||
component.push({
|
||||
translate: `%s \u203a %s [%s: %s %s %s: %s]`,
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
player.displayName ?? player.profile.name,
|
||||
{
|
||||
text: `${player.uuid}`,
|
||||
color: 'dark_blue',
|
||||
clickEvent: {
|
||||
action: 'copy_to_clipboard',
|
||||
value: `${player.uuid}`
|
||||
},
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
contents: [{
|
||||
text: 'click here to copy the player\'s uuid',
|
||||
color: 'aqua'
|
||||
}]
|
||||
}
|
||||
},
|
||||
{ text: `Ping`, color: 'dark_blue' },
|
||||
{ text: `${player.latency}`, color: 'gold' },
|
||||
{ text: '/', color: 'dark_gray' },
|
||||
{ text: `Gamemode`, color: 'dark_blue' },
|
||||
{ text: `${player.gamemode}`, color: 'gold' },
|
||||
]
|
||||
})
|
||||
component.push('\n')
|
||||
}
|
||||
component.pop()
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine([{ text: `Players: `, color:'gray' }, { text: '(' , color: 'gray' }, { text: `${JSON.stringify(bot.players.length)}`, color: 'gold' }, { text: ')\n', color: 'gray' }])?.toMotd().replaceAll('§','&')}`)
|
||||
setTimeout(() => {
|
||||
for (const player of bot.players) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine([player.displayName ?? player.profile.name, ' &8', player.uuid,` &r&8[&2Ping: &6${player.latency}&8 / &5Gamemode: &6${player.gamemode}&8]`]).toMotd().replaceAll('§', '&')}`)
|
||||
}
|
||||
}, 300)
|
||||
} else if (bot.options.isKaboom) {
|
||||
bot.tellraw(`@a[name="${source.player.profile.name}"]`, [
|
||||
{ text: `Players`, color: 'dark_blue' },
|
||||
{ text: ': ', color: 'dark_gray' },
|
||||
{ text: '(' , color: 'dark_gray' },
|
||||
{ text: `${JSON.stringify(bot.players.length)}`, color: 'gold' },
|
||||
{ text: ')\n', color: 'dark_gray' },
|
||||
component
|
||||
])
|
||||
}
|
||||
},
|
||||
discordExecute(context) {
|
||||
const bot = context.bot
|
||||
const players = bot.players
|
||||
const component = []
|
||||
for (const player of players) {
|
||||
component.push({
|
||||
translate: `%s \u203a %s [%s %s %s %s %s]`,
|
||||
with: [
|
||||
player.displayName ?? player.profile.name,
|
||||
player.uuid,
|
||||
{ text: `Ping:`, color: 'dark_green' },
|
||||
{ text: `${player.latency}`, color: 'gold' },
|
||||
{ text: '/', color: 'gray' },
|
||||
{ text: `Gamemode:`, color: 'dark_purple' },
|
||||
{ text: `${player.gamemode}`, color: 'gold' },
|
||||
]
|
||||
})
|
||||
component.push('\n')
|
||||
}
|
||||
component.pop()
|
||||
const ansi = bot.getMessageAsPrismarine([{ text: `Players: `, color:'gray' }, { text: '(' , color: 'gray' }, { text: `${JSON.stringify(bot.players.length)}`, color: 'gold' }, { text: ')\n', color: 'gray' }, component])?.toAnsi()
|
||||
const fix = fixansi(ansi.replaceAll('`', '`\u200b').substring(0, 3080))
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
}
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
const { request } = require('undici');
|
||||
const CommandError = require('../../util/command_error.js');
|
||||
const mc = require('minecraft-protocol');
|
||||
const util = require('util')
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'mcserver',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"pingserver",
|
||||
"pingsrv",
|
||||
],
|
||||
description: 'look up minecraft server info',
|
||||
usages: [
|
||||
"<minecraft server ip>",
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
const bot = context.bot;
|
||||
const discordClient = context.discordClient;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
try {
|
||||
const [host, port] = args[0].split(':')
|
||||
const server = await mc.ping({ host, port: Number(port ?? 25565) })
|
||||
component.push({
|
||||
translate: '%s %s %s:%s\n%s %s %s / %s\n%s %s %s\n%s %s %s',
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
{ text: 'Ip', color: 'dark_blue' },
|
||||
{ text: '\u203a' },
|
||||
{ text: `${host}`, color: 'dark_blue' },
|
||||
{ text: `${Number(port ?? 25565)}`, color: 'gold' },
|
||||
{ text: 'Players', color: 'dark_blue' },
|
||||
{ text: '\u203a' },
|
||||
{ text: `${server.players.online}`, color: 'gold' },
|
||||
{ text: `${server.players.max}`, color: 'gold' },
|
||||
{ text: 'Version', color: 'dark_blue' },
|
||||
{ text: '\u203a' },
|
||||
{ text: `${server.version.name}`, color: 'blue' },
|
||||
{ text: 'Motd', color: 'dark_blue' },
|
||||
{ text: '\u203a' },
|
||||
server.description
|
||||
]
|
||||
})
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component);
|
||||
/* bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
{
|
||||
text: `Ip \u203a ${host}:${Number(port ?? 25565)}\n`,
|
||||
color: 'gray',
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
contents: [{
|
||||
text: 'click here for the servers ip',
|
||||
color: 'gray'
|
||||
}]
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'copy_to_clipboard',
|
||||
value: `${host}:${Number(port ?? 25565)}`
|
||||
}
|
||||
},
|
||||
{
|
||||
text: `Players \u203a `,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `${server.players.online}`,
|
||||
color: "gold"
|
||||
},
|
||||
{
|
||||
text: ' / ',
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `${server.players.max}\n`,
|
||||
color: "gold"
|
||||
},
|
||||
{
|
||||
text: `Version \u203a ${server.version.name}\n`,
|
||||
color: 'gray',
|
||||
},
|
||||
{
|
||||
text: "Motd \u203a\n",
|
||||
color: 'gray',
|
||||
},
|
||||
server.description,
|
||||
])*/
|
||||
} catch (e) {
|
||||
bot.chat.message(`${e.toString()}`)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
const CommandError = require('../../util/command_error.js')
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'netmsg',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
|
||||
],
|
||||
description: 'netmsg to other servers',
|
||||
usages: [
|
||||
"<message>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const args = context.arguments;
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
if (bot.options.private) {
|
||||
component = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: bot.options.serverName, color: "blue" },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: args.join(' '), color: "blue" },
|
||||
]
|
||||
}
|
||||
} else if (!bot.options.private) {
|
||||
component = {
|
||||
translate: '[%s:%s] %s \u203a %s',
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: bot.options.host, color: "blue" },
|
||||
{ text: `${bot.options.port}`, color: "gold" },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: args.join(' '), color: "blue" },
|
||||
]
|
||||
}
|
||||
}
|
||||
bot.bots.filter((eachBot) => {
|
||||
if (eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom || eachBot.options.isCreayun && !eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom) {
|
||||
eachBot.chat.message(`[${bot.options.serverName}] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} \u203a ${args.join(' ')}`)
|
||||
} else if (!eachBot.options.serverName !== "Savage Friends" && !eachBot.options.isSavage && !eachBot.options.useChat && eachBot.options.isKaboom) {
|
||||
eachBot.tellraw("@a", component);
|
||||
} else if (!eachBot.options.serverName !== "Savage Friends" && !eachBot.options.isSavage && eachBot.options.useChat && eachBot.options.isKaboom) {
|
||||
eachBot.chat.message(`&7[&7${bot.options.serverName}&7] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} &7\u203a ${args.join(' ')}`)
|
||||
} else if (eachBot.options.useChat && !eachBot.options.isSavage) {
|
||||
// eachBot.chat.message(bot.getMessageAsPrismarine(`[${bot.options.host}:${bot.options.port}] ${source.player.displayName ?? source.player.profile.name} \u203a ${args.join(' ')}`)?.toMotd().replaceAll('§','&'))
|
||||
eachBot.chat.message(`&7[&7${bot.options.serverName}&7] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} &7\u203a ${args.join(' ')}`)
|
||||
} else if (!eachBot.options.useChat && !eachBot.options.isSavage) {
|
||||
eachBot.tellraw("@a", component);
|
||||
}
|
||||
})
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
if (bot.options.private) {
|
||||
component = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: bot.options.serverName, color: "blue" },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: args.join(' '), color: "blue" },
|
||||
]
|
||||
}
|
||||
} else if (!bot.options.private) {
|
||||
component = {
|
||||
translate: '[%s:%s] %s \u203a %s',
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: bot.options.host, color: "blue" },
|
||||
{ text: `${bot.options.port}`, color: "gold" },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: args.join(' '), color: "blue" },
|
||||
]
|
||||
}
|
||||
}
|
||||
bot.bots.filter((eachBot) => {
|
||||
if (eachBot.options.serverName === "Savage Friends" && eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom) {
|
||||
eachBot.chat.message(`[${bot.options.serverName}] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} \u203a ${args.join(' ')}`)
|
||||
} else if (!eachBot.options.serverName !== "Savage Friends" && !eachBot.options.isSavage && !eachBot.options.useChat && eachBot.options.isKaboom) {
|
||||
eachBot.tellraw("@a", component);
|
||||
} else if (!eachBot.options.serverName !== "Savage Friends" && !eachBot.options.isSavage && eachBot.options.useChat && eachBot.options.isKaboom) {
|
||||
eachBot.chat.message(`&7[&7${bot.options.serverName}&7] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} &7\u203a ${args.join(' ')}`)
|
||||
} else if (eachBot.options.useChat && !eachBot.options.isSavage) {
|
||||
eachBot.chat.message(`&7[&7${bot.options.serverName}&7] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} &7\u203a ${args.join(' ')}`)
|
||||
} else if (!eachBot.options.useChat && !eachBot.options.isSavage) {
|
||||
eachBot.tellraw("@a", component);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
module.exports = {
|
||||
data: {
|
||||
name: 'refillcore',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"rc",
|
||||
"refill",
|
||||
],
|
||||
description: 'refill the bots core',
|
||||
usages: [
|
||||
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
bot.core.refill()
|
||||
bot.tellraw("@a", "Refilling core,...")
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
bot.core.refill();
|
||||
bot.tellraw("@a", "Refilling core,...");
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
const CommandError = require('../../util/command_error');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'test',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'Make me say something',
|
||||
usages: [
|
||||
"error stack <message>",
|
||||
"error message <message>",
|
||||
"message <message>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
if (!args && !args[0] && !args[1]) return
|
||||
switch (args[0]) {
|
||||
case 'error':
|
||||
switch (args[1]) {
|
||||
case 'stack':
|
||||
throw new Error(args.slice(2).join(' '));
|
||||
break
|
||||
case 'message':
|
||||
throw new CommandError(args.slice(2).join(' '));
|
||||
break
|
||||
}
|
||||
break;
|
||||
case "message":
|
||||
bot.tellraw("@a", [
|
||||
{
|
||||
text: `Hello, World!, Player: ${bot.getMessageAsPrismarine(context.source.player.displayName ?? context.source.player.profile.name)?.toMotd()}§r`,
|
||||
color: 'gray',
|
||||
bold: false
|
||||
},
|
||||
{
|
||||
text: ` Args: ${args.slice(1).join(' ')}`,
|
||||
color: 'gray',
|
||||
bold: false,
|
||||
}
|
||||
])
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
const CommandError = require('../../util/command_error')
|
||||
const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, SlashCommandBuilder } = require('discord.js');
|
||||
const { request } = require('undici');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'urban',
|
||||
description: 'urban dictionary',
|
||||
aliases: [
|
||||
'urbandictionary'
|
||||
],
|
||||
trustLevel: 0,
|
||||
usages: [
|
||||
"<definition>",
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
const prefix = [
|
||||
{ text: '[', color: 'dark_gray' },
|
||||
{ text: 'Urban', color: '#B72A00' },
|
||||
{ text: '] ', color: 'dark_gray'}
|
||||
]
|
||||
let component = [];
|
||||
let term = `${args.join(' ')}`
|
||||
const query = new URLSearchParams({ term });
|
||||
const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`);
|
||||
const { list } = await dictResult.body.json();
|
||||
if (!list.length) {
|
||||
bot.tellraw('@a', { text: 'No results found', color: 'dark_red' });
|
||||
}
|
||||
for (definitions of list) {
|
||||
component.push(prefix, [
|
||||
{
|
||||
text: `${definitions.definition.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray',
|
||||
underlined: false,
|
||||
italic: false,
|
||||
translate:"",
|
||||
hoverEvent: {
|
||||
action:"show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Example \u203a \n ${definitions.example.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Word \u203a ${definitions.word.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray',
|
||||
},
|
||||
{
|
||||
text: `Author \u203a ${definitions.author.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `written on \u203a ${definitions.written_on.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Rating \u203a Thumbs-Up ${definitions.thumbs_up} / Thumbs-Down ${definitions.thumbs_down}`,
|
||||
color: 'gray'
|
||||
}
|
||||
]
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'open_url',
|
||||
value: `${definitions.permalink}`
|
||||
}
|
||||
},
|
||||
])
|
||||
}
|
||||
if (bot.options.useChat) {
|
||||
for (const definitions of list) {
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ text: `${definitions.example.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`})?.toMotd().replaceAll("§","&"));
|
||||
// bot.chat.message(definitions.example.replaceAll("\r", ""));
|
||||
}
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)
|
||||
}
|
||||
},
|
||||
async discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const component = [];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
const CommandError = require('../../util/command_error');
|
||||
const { request } = require('undici');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'weather',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'check the weather of cities',
|
||||
usages: [
|
||||
"<message>"
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
try {
|
||||
let component = [];
|
||||
const weather = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ')}`);
|
||||
const info = await weather.body.json();
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s%s (%s%s)\n%s: %s %s %s (%s %s %s)\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Location", color: config.colors.commands.primary },
|
||||
{ text: `${info.location.name}, ${info.location.region}, ${info.location.country}`, color: config.colors.commands.secondary },
|
||||
{ text: "Latitude", color: config.colors.commands.primary },
|
||||
{ text: `${info.location.lat}`, color: config.colors.integer },
|
||||
{ text: "Longitude", color: config.colors.commands.primary },
|
||||
{ text: `${info.location.lon}`, color: config.colors.integer },
|
||||
{ text: "Time zone", color: config.colors.commands.primary },
|
||||
{ text: `${info.location.tz_id}`, color: config.colors.commands.secondary },
|
||||
{ text: "Time", color: config.colors.commands.primary },
|
||||
{ text: `${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id, })}`, color: config.colors.integer },
|
||||
{ text: "Temp", color: config.colors.commands.primary },
|
||||
{ text: `${info.current.temp_c}`, color: config.colors.integer },
|
||||
{ text: "\u00b0C", color: config.colors.commands.secondary },
|
||||
{ text: `${info.current.temp_f}`, color: config.colors.integer },
|
||||
{ text: "\u00b0F", color: config.colors.commands.secondary },
|
||||
{ text: "Wind speed" , color: config.colors.commands.primary },
|
||||
{ text: `${info.current.wind_kph}`, color: config.colors.integer },
|
||||
{ text: `kph`, color: config.colors.commands.secondary },
|
||||
{ text: `${info.current.wind_dir}`, color: config.colors.commands.secondary },
|
||||
{ text: `${info.current.wind_mph}`, color: config.colors.integer },
|
||||
{ text: `mph`, color: config.colors.commands.secondary },
|
||||
{ text: `${info.current.wind_dir}`, color: config.colors.commands.secondary },
|
||||
{ text: "Condition", color: config.colors.commands.primary },
|
||||
{ text: `${info.current.condition.text}`, color: config.colors.commands.secondary },
|
||||
{ text: "Humidity", color: config.colors.commands.primary },
|
||||
{ text: `${info.current.humidity}`, color: config.colors.integer },
|
||||
]
|
||||
})
|
||||
bot.tellraw("@a", component)
|
||||
} catch (e) {
|
||||
if (e.toString() === "TypeError: Cannot read properties of undefined (reading 'name')" && args.length !== 0) {
|
||||
bot.chat.message('The location is invalid please try a valid location');
|
||||
} else if (args.length === 0) {
|
||||
bot.chat.message('there were no arguments detected')
|
||||
} else {
|
||||
bot.chat.message(`${e.toString()}`);
|
||||
console.warn(e.stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
const wiki = require('wikipedia')
|
||||
const CommandError = require('../../util/command_error')
|
||||
const { EmbedBuilder } = require('discord.js')
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'wiki',
|
||||
description: 'wikipedia',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
'wikipedia'
|
||||
],
|
||||
usages:[
|
||||
"<definition>"
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
try {
|
||||
const page = await wiki.page(args.join(' '))
|
||||
const summary = await page.intro();
|
||||
bot.tellraw(`@a`, { text: `${summary}`, color: 'gray' });
|
||||
} catch (error) {
|
||||
if (error.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')") {
|
||||
bot.tellraw(`@a`, { text: 'Definition not found!', color: 'dark_red' })
|
||||
} else {
|
||||
bot.tellraw(`@a`, `${error.toString()}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,161 +0,0 @@
|
|||
const { EmbedBuilder } = require('discord.js');
|
||||
const CommandError = require('../../util/command_error');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'cloop',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
"commandloop"
|
||||
],
|
||||
description: 'run cloops',
|
||||
usages: [
|
||||
"add <interval> <command>",
|
||||
"remove <index>",
|
||||
"clear",
|
||||
"list",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
const source = context.source
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
switch (args[1]) {
|
||||
case 'add':
|
||||
if (isNaN(args[2])) throw new CommandError({ text: 'Invalid interval', color: 'red' })
|
||||
//bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid interval', color: 'red' })
|
||||
const interval = parseInt(args[2])
|
||||
const command = args.slice(3).join(' ');
|
||||
bot.cloop.add(command, interval)
|
||||
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
|
||||
translate: 'Added \'%s\' with interval %s to the cloops',
|
||||
color: 'gray',
|
||||
with: [ command, { text: `${interval}`, color: 'gold' } ]
|
||||
})
|
||||
break
|
||||
case 'remove':
|
||||
if (parseInt(args[2]) === NaN) bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid index', color: 'red' })
|
||||
|
||||
const index = parseInt(args[2])
|
||||
|
||||
bot.cloop.remove(index)
|
||||
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
|
||||
translate: 'Removed cloop %s',
|
||||
color: 'gray',
|
||||
with: [ { text: `${index}`, color: 'gold' } ]
|
||||
})
|
||||
break
|
||||
case 'clear':
|
||||
bot.cloop.clear()
|
||||
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Cleared all cloops' })
|
||||
break
|
||||
case 'list':
|
||||
const component = []
|
||||
|
||||
const listComponent = []
|
||||
let i = 0
|
||||
for (const cloop of bot.cloop.list) {
|
||||
listComponent.push({
|
||||
translate: '%s \u203a %s (%s)',
|
||||
color: 'gray',
|
||||
with: [
|
||||
{ text: `${i}`, color: 'gold' },
|
||||
cloop.command,
|
||||
{ text: `${cloop.interval}`, color: 'gold'},
|
||||
]
|
||||
})
|
||||
listComponent.push('\n')
|
||||
i++
|
||||
}
|
||||
|
||||
listComponent.pop()
|
||||
|
||||
component.push({
|
||||
translate: 'Cloops (%s):',
|
||||
with: [ { text: `${bot.cloop.list.length}`, color: 'gold' } ]
|
||||
})
|
||||
component.push('\n')
|
||||
component.push(listComponent)
|
||||
if (bot.cloop.list.length === 0) {
|
||||
bot.tellraw(`@a[name="${source?.player.profile?.name}"]`, {
|
||||
translate: 'Cloops (%s):',
|
||||
color: 'gray',
|
||||
with: [ { text: `${bot.cloop.list.length}`, color: 'gold' } ]
|
||||
})
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)
|
||||
}
|
||||
break
|
||||
default:
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid action', color: 'red' })
|
||||
break
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
let Embed;
|
||||
switch (args[0]) {
|
||||
case "add":
|
||||
const interval = parseInt(args[1])
|
||||
const command = args.slice(2).join(' ')
|
||||
bot.cloop.add(command, interval)
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`Added ${command} with the interval ${interval} to the cloops`)
|
||||
bot?.discord?.message?.reply({ embeds: [Embed] })
|
||||
break;
|
||||
case "remove":
|
||||
var index = (args[1])
|
||||
if (parseInt(args[1]) === NaN) throw new CommandError("invalid index");
|
||||
bot.cloop.remove(index)
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`removed cloop ${index}`)
|
||||
bot?.discord?.message?.reply({ embeds: [Embed] })
|
||||
break
|
||||
case 'clear':
|
||||
bot.cloop.clear()
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`cleared cloops`)
|
||||
bot?.discord?.message?.reply({ embeds: [Embed] })
|
||||
break
|
||||
case 'list':
|
||||
const component = []
|
||||
const listComponent = []
|
||||
let i = 0
|
||||
for (const cloop of bot.cloop.list) {
|
||||
listComponent.push({
|
||||
translate: '%s \u203a %s (%s)',
|
||||
with: [
|
||||
`id ${i}`,
|
||||
cloop.command,
|
||||
cloop.interval
|
||||
]
|
||||
})
|
||||
listComponent.push('\n')
|
||||
i++
|
||||
}
|
||||
listComponent.pop()
|
||||
component.push({
|
||||
translate: 'Cloops (%s):',
|
||||
with: [ bot.cloop.list.length ]
|
||||
})
|
||||
component.push('\n')
|
||||
component.push(listComponent)
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(bot.getMessageAsPrismarine(component)?.toString())
|
||||
bot?.discord?.message?.reply({ embeds: [Embed] })
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
const CommandError = require('../../util/command_error');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'kick',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
],
|
||||
description: 'kick or crash players',
|
||||
usages: [
|
||||
"invalidstring <player>",
|
||||
"item <player>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
if (bot.options.useChat || bot.options.isSavage || bot.options.isCreayun) throw new CommandError('Cannot execute command due to smth in the config being enabled');
|
||||
|
||||
switch (args[1]) {
|
||||
case 'invalidstring':
|
||||
bot.exploits.crashes.invalidString(`${args.slice(2).join(' ')}`);
|
||||
break
|
||||
case 'item':
|
||||
bot.exploits.kicks.item(`${args.slice(2).join(' ')}`)
|
||||
break
|
||||
default:
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
if (bot.options.useChat || bot.options.isSavage || bot.options.isCreayun) throw new CommandError('Cannot execute command!');
|
||||
switch (args[0]) {
|
||||
case "invalidstring":
|
||||
bot.exploits.crashes.invalidString(`${args.slice(1).join(' ')}`)
|
||||
break
|
||||
case 'item':
|
||||
bot.exploits.kicks.item(`${args.slice(1).join(' ')}`)
|
||||
break
|
||||
default:
|
||||
throw new CommandError('Invalid argument');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
module.exports = {
|
||||
data: {
|
||||
name: 'reconnect',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
"end",
|
||||
"recon",
|
||||
],
|
||||
description: 'reconnect the bot',
|
||||
usages: [
|
||||
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
bot._client.end("disconnect :3")
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
bot._client.end("disconnect :3")
|
||||
}
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
const between = require('../../util/between')
|
||||
const CommandError = require('../../util/command_error')
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'tpr',
|
||||
description: 'teleport to a random place',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
'rtp',
|
||||
'teleportrandom',
|
||||
'randomteleport'
|
||||
],
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
const source = context.source
|
||||
if (bot.options.isKaboom) {
|
||||
x = between(-30_000_000, 30_000_000)
|
||||
y = 100
|
||||
z = between(-30_000_000, 30_000_000)
|
||||
} else if (bot.options.isSavage) {
|
||||
x = between(-4096, 4096);
|
||||
y = 100
|
||||
z = between(-4096, 4096);
|
||||
}
|
||||
if (args.slice(1).join(' ')) {
|
||||
bot.tellraw("@a", [
|
||||
{ text: 'Randomly Teleported: ', color: 'gray' },
|
||||
{ text: args.slice(1).join(' '), color: 'blue' },
|
||||
{ text: ' to ', color: 'gray' },
|
||||
{ text: `${x} `, color: 'gold' },
|
||||
{ text: `${y} `, color: 'gold' },
|
||||
{ text: `${z}`, color: 'gold' }
|
||||
])
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.command(`minecraft:tp ${args.slice(1).join(' ')} ${x} ${y} ${z}`)
|
||||
} else if (bot.options.isKaboom) {
|
||||
bot.core.run(`minecraft:tp ${args.slice(1).join(' ')} ${x} ${y} ${z}`);
|
||||
}
|
||||
} else {
|
||||
bot.tellraw("@a", [
|
||||
{ text: 'Randomly Teleported: ', color: 'gray' },
|
||||
{ text: source.player.profile.name, color: 'blue' },
|
||||
{ text: ' to ', color: 'gray' },
|
||||
{ text: `${x} `, color: 'gold' },
|
||||
{ text: `${y} `, color: 'gold' },
|
||||
{ text: `${z}`, color: 'gold' }
|
||||
])
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.command(`minecraft:tp ${source.player.profile.name} ${x} ${y} ${z}`)
|
||||
} else if (bot.options.isKaboom) {
|
||||
bot.core.run(`minecraft:tp ${source.player.profile.name} ${x} ${y} ${z}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
const { EmbedBuilder } = require('discord.js');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'validate',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
"val"
|
||||
],
|
||||
description: 'validate through the bot',
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
if (args[0] === bot.validation.trusted) {
|
||||
bot.chat.message('&2Valid Trusted hash');
|
||||
}
|
||||
if (args[0] === bot.validation.admin) {
|
||||
bot.chat.message('&2Valid Admin hash');
|
||||
}
|
||||
if (args[0] === bot.validation.owner) {
|
||||
bot.chat.message('&2Valid Owner hash');
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const event = bot?.discord?.message
|
||||
const roles = event?.member?.roles?.cache
|
||||
const source = context.source;
|
||||
if (roles?.some(role => role.name === `${config.discord.roles.trusted}`)) {
|
||||
bot.discord.message.reply('Valid trusted user')
|
||||
bot.chat.message(`Valid trusted user [${bot.discord.message.member.user.username}]`)
|
||||
} else if (roles?.some(role => role.name === `${config.discord.roles.owner}`)) {
|
||||
bot.discord.message.reply('Valid Owner user')
|
||||
bot.chat.message(`Valid Owner User [${bot.discord.message.member.user.username}]`);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
const http = require('http');
|
||||
const https = require('https');
|
||||
const util = require('util');
|
||||
const fixansi = require('../../util/ansi');
|
||||
const CommandError = require('../../util/command_error')
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'website',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
],
|
||||
description: 'look up website data',
|
||||
usages: [
|
||||
"<url>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
if (args.slice(1).join(' ').toLowerCase().startsWith("http://")) {
|
||||
http.get(args.slice(1).join(' '), (res) => {
|
||||
const { statusCode } = res;
|
||||
const contentType = res.headers['content-type'];
|
||||
res.setEncoding('utf8');
|
||||
let rawData = '';
|
||||
res.on('data', (chunk) => { rawData += chunk; });
|
||||
res.on('end', () => {
|
||||
try {
|
||||
bot.tellraw("@a", { text: util.inspect(rawData.toString().substring(0, 32750)), color: "dark_green" })
|
||||
} catch (e) {
|
||||
bot.tellraw("@a", e.toString());
|
||||
}
|
||||
});
|
||||
}).on('error', (e) => {
|
||||
bot.chat.message(`&4${e.toString()}`);
|
||||
});
|
||||
} else {
|
||||
https.get(args.slice(1).join(' '), (res) => {
|
||||
res.on('data', (d) => {
|
||||
bot.tellraw("@a", { text: util.inspect(d.toString().substring(0, 32750)), color: "dark_green", })
|
||||
// console.log(Object.keys(d.toString().length));
|
||||
});
|
||||
}).on('error', (e) => {
|
||||
bot.chat.message(`&4${e.toString()}`);
|
||||
});
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
let Embed;
|
||||
let fix;
|
||||
let ansi;
|
||||
//bot.discord.message.reply('e');
|
||||
if (args.join(' ').toLowerCase().startsWith("http://")) {
|
||||
http.get(args.join(' '), (res) => {
|
||||
const { statusCode } = res;
|
||||
const contentType = res.headers['content-type'];
|
||||
res.setEncoding('utf8');
|
||||
let rawData = '';
|
||||
res.on('data', (chunk) => { rawData += chunk; });
|
||||
res.on('end', () => {
|
||||
// try {
|
||||
// bot.tellraw("@a", { text: util.inspect(rawData), color: "dark_green" })
|
||||
ansi = bot.getMessageAsPrismarine({ text: util.inspect(rawData.toString()), color: 'dark_green'})?.toAnsi()
|
||||
fix = fixansi(ansi.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
// } catch (e) {
|
||||
// bot.tellraw("@a", e.toString());
|
||||
//throw new CommandError(e.toString())
|
||||
// }
|
||||
});
|
||||
}).on('error', (e) => {
|
||||
//bot.chat.message(`&4${e.toString()}`);
|
||||
});
|
||||
} else {
|
||||
https.get(args.join(' '), (res) => {
|
||||
res.on('data', (d) => {
|
||||
// bot.tellraw("@a", { text: util.inspect(d.toString()), color: "dark_green", })
|
||||
// console.log(Object.keys(d.toString().length));
|
||||
ansi = bot.getMessageAsPrismarine({ text: util.inspect(d.toString()), color: 'dark_green'})?.toAnsi()
|
||||
fix = fixansi(ansi.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.datta.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
// bot.discord.message.reply('e');
|
||||
});
|
||||
}).on('error', (e) => {
|
||||
//bot.chat.message(`&4${e.toString()}`);
|
||||
//throw new CommandError(e.toString())
|
||||
});
|
||||
/*
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix1}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,681 +0,0 @@
|
|||
[
|
||||
{
|
||||
"name": {
|
||||
"text": "HBot",
|
||||
"color": "aqua",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"hhhzzzsss"
|
||||
],
|
||||
"exclaimer": "HBOT HARRYBUTT LMAOOOOOOOOOOOOOOOOO",
|
||||
"foundation": "java/mcprotocollib",
|
||||
"prefixes": [
|
||||
"#"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "FBot",
|
||||
"color": "gold"
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
"popbob/aaa"
|
||||
],
|
||||
"exclaimer": "",
|
||||
"foundation": "nodejs/node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"+"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "Hydra",
|
||||
"color": "dark_red"
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
"popbob/aaa"
|
||||
],
|
||||
"exclaimer": "",
|
||||
"foundation": "nodejs/node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"+",
|
||||
"$",
|
||||
"h:",
|
||||
"hydra:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "JokerBot",
|
||||
"color": "green"
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
"zXzy",
|
||||
"12alex12"
|
||||
],
|
||||
"exclaimer": "",
|
||||
"foundation": "nodejs/mineflayer",
|
||||
"prefixes": [
|
||||
"\\"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "CddehhBot",
|
||||
"color": "red",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"CaydennO1",
|
||||
"spyingcreeper09"
|
||||
],
|
||||
"exclaimer": "WHAT IS THIS GOOFY AAAH FUCKING BOT FUCKING PIECE OF RETARDED ASS SHIT BOT ITS SO FUCKING SHIT I WANNA IPFILTER IT WITH FUCKING CHOMENS",
|
||||
"foundation": "nodejs/mineflayer",
|
||||
"prefixes": [
|
||||
","
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "TurtleBot",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"TurtleKid"
|
||||
],
|
||||
"exclaimer": "nmp when?",
|
||||
"foundation": "nodejs/mineflayer",
|
||||
"prefixes": [
|
||||
"\\"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "NothingBot",
|
||||
"color": "dark_red",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"Yaode_owo"
|
||||
],
|
||||
"exclaimer": "uwu",
|
||||
"foundation": "nodejs/mineflayer",
|
||||
"prefixes": [
|
||||
"?"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "SC09Bot",
|
||||
"color": "dark_gray",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"spyingcreeper09"
|
||||
],
|
||||
"exclaimer": ":3",
|
||||
"foundation": "nodejs/node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"@"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "HorizonBot",
|
||||
"color": "gold",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"ZenZoya",
|
||||
"Yaode_owo",
|
||||
"Parker2991",
|
||||
"and others"
|
||||
],
|
||||
"exclaimer": "originally called §5FleamBot§r",
|
||||
"foundation": "nodejs/node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"^"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "64Bot",
|
||||
"color": "gold",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"64Will64"
|
||||
],
|
||||
"exclaimer": "NINTENDO 64?!?!??!?! 69Bot when??????",
|
||||
"foundation": "NodeJS/Mineflayer",
|
||||
"prefixes": [
|
||||
"w="
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "Nebulabot",
|
||||
"color": "dark_purple",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"IuCC"
|
||||
],
|
||||
"exclaimer": "the void",
|
||||
"foundation": "NodeJS/Node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"["
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "Prism",
|
||||
"color": "#00FF9C",
|
||||
"bold": true
|
||||
},
|
||||
{
|
||||
"text": "Bot",
|
||||
"color": "white",
|
||||
"bold": true
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
"IuCC"
|
||||
],
|
||||
"exclaimer": "prismarine :3",
|
||||
"foundation": "NodeJS/Node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"["
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "SharpBot",
|
||||
"color": "aqua",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"64Will64"
|
||||
],
|
||||
"exclaimer": "sharp as in the tv? idfk im out of jokes also the first c# bot on the list??",
|
||||
"foundation": "C#/MineSharp",
|
||||
"prefixes": [
|
||||
"s="
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "MoonBot",
|
||||
"color": "red",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"64Will64"
|
||||
],
|
||||
"exclaimer": "stop mooning/mooing me ",
|
||||
"foundation": "NodeJS/Mineflayer",
|
||||
"prefixes": [
|
||||
"m="
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "TableBot",
|
||||
"color": "yellow",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"12alex12"
|
||||
],
|
||||
"exclaimer": "TABLE CLOTH BOT?!?! ",
|
||||
"foundation": "NodeJS/Node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"t!"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "Evil",
|
||||
"color": "dark_red",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": "Bot",
|
||||
"color": "dark_purple"
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
"FusseligerDev"
|
||||
],
|
||||
"exclaimer": "",
|
||||
"foundation": "Java/Custom",
|
||||
"prefixes": [
|
||||
"!"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "SBot Java",
|
||||
"color": "white",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"evkc"
|
||||
],
|
||||
"foundation": "Java/MCProtocolLib",
|
||||
"prefixes": [
|
||||
":"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "SBot Rust",
|
||||
"color": "white",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"evkc"
|
||||
],
|
||||
"foundation": "Rust",
|
||||
"prefixes": [
|
||||
"re:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "Z-Boy-Bot",
|
||||
"color": "dark_purple",
|
||||
"bold": false
|
||||
},
|
||||
"exclaimer": "Most likely skidded along with kbot that the dev used",
|
||||
"authors": [
|
||||
"Romnci"
|
||||
],
|
||||
"foundation": "NodeJS/mineflayer or Java/mcprotocollib idfk",
|
||||
"prefixes": [
|
||||
"Z]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "ABot",
|
||||
"color": "gold",
|
||||
"bold": true
|
||||
},
|
||||
"exclaimer": "not used anymore (replaced by V2)",
|
||||
"authors": [
|
||||
{
|
||||
"text": "_yfd",
|
||||
"color": "light_purple"
|
||||
}
|
||||
],
|
||||
"foundation": "NodeJS/Node-Minecraft-Protocol",
|
||||
"prefixes": [
|
||||
"<"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "ABot-V2",
|
||||
"color": "gold",
|
||||
"bold": true
|
||||
},
|
||||
"exclaimer": "",
|
||||
"authors": [
|
||||
{
|
||||
"text": "_yfd",
|
||||
"color": "light_purple"
|
||||
}
|
||||
],
|
||||
"foundation": "NodeJS/Node-Minecraft-Protocol",
|
||||
"prefixes": [
|
||||
"<"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "FardBot",
|
||||
"color": "light_purple",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"_yfd"
|
||||
],
|
||||
"exclaimer": "bot is dead lol",
|
||||
"foundation": "NodeJS/Mineflayer",
|
||||
"prefixes": [
|
||||
"<"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "ChipmunkBot Java",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"_ChipMC_"
|
||||
],
|
||||
"exclaimer": "chips? also shoutout to chip and chayapak for helping in the rewrite",
|
||||
"foundation": "Java/MCProtocolLib",
|
||||
"prefixes": [
|
||||
"'",
|
||||
"/'"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "ChipmunkBot NodeJS",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"_ChipMC_"
|
||||
],
|
||||
"foundation": "NodeJS/Node-Minecraft-Protocol"
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "TestBot",
|
||||
"color": "aqua",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"Blackilykat"
|
||||
],
|
||||
"foundation": "Java/MCProtocolLib",
|
||||
"prefixes": [
|
||||
"-"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "UBot",
|
||||
"color": "gray",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"HexWoman"
|
||||
],
|
||||
"exclaimer": "UwU OwO",
|
||||
"foundation": "NodeJS/node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "ChomeNS Bot Java",
|
||||
"color": "yellow",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"chayapak"
|
||||
],
|
||||
"exclaimer": "wow its my bot !! ! 4374621q43567%^&#%67868-- chayapak \n rip ChomeNS bot i wonder what chayapak is currently doing -- Parker2991",
|
||||
"foundation": "Java/MCProtocolLib",
|
||||
"prefixes": [
|
||||
"*",
|
||||
"cbot ",
|
||||
"/cbot "
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "ChomeNS Bot NodeJS",
|
||||
"color": "yellow",
|
||||
"bold": false
|
||||
},
|
||||
"authors": [
|
||||
"chayapak"
|
||||
],
|
||||
"foundation": "NodeJS/Node-Minecraft-Protocol",
|
||||
"prefixes": [
|
||||
"*",
|
||||
"cbot",
|
||||
"/cbot"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "RecycleBot",
|
||||
"color": "dark_green",
|
||||
"bold": false
|
||||
},
|
||||
"foundation": [
|
||||
"MorganAnkan"
|
||||
],
|
||||
"exclaimer": "nice bot",
|
||||
"language": "NodeJS/node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"="
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "neobot",
|
||||
"color": "blue",
|
||||
"bold": false
|
||||
},
|
||||
"exclaimer": "n e o b o t ;oslkdfj;salkdfj;ladsjf",
|
||||
"authors": [
|
||||
"mirkokral"
|
||||
],
|
||||
"foundation": "java/MCProtocolLib",
|
||||
"prefixes": [
|
||||
"_"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"text": "ManBot",
|
||||
"color": "dark_green",
|
||||
"bold": false
|
||||
},
|
||||
"exclaimer": "(more like men bot :skull:) OH HAAAAAAAAAAAAAAIIILL LOGINTIMEDOUT",
|
||||
"authors": [
|
||||
"Man/LogintimedOut"
|
||||
],
|
||||
"foundation": "NodeJS/mineflayer",
|
||||
"prefixes": [
|
||||
"(Note:I dont remember!!)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "Useless",
|
||||
"color": "red",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": "Bot",
|
||||
"color": "gray",
|
||||
"bold": false
|
||||
}
|
||||
],
|
||||
"exclaimer": "it isnt useless its a good bot................",
|
||||
"authors": [
|
||||
"IuCC"
|
||||
],
|
||||
"foundation": "NodeJS/node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"["
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "SnifferBot",
|
||||
"color": "gold",
|
||||
"bold": false
|
||||
}
|
||||
],
|
||||
"exclaimer": "sniff sniff FNFBoyfriendBot simp",
|
||||
"authors": [
|
||||
"popbob/aaa"
|
||||
],
|
||||
"foundation": "NodeJS/Node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
">"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "XBot",
|
||||
"color": "dark_purple",
|
||||
"bold": false
|
||||
}
|
||||
],
|
||||
"exclaimer": "",
|
||||
"authors": [
|
||||
"popbob/aaa"
|
||||
],
|
||||
"foundation": "ts-Node/Node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"$"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "Kitty",
|
||||
"color": "gold",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": "Corp",
|
||||
"color": "aqua",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": "Bot",
|
||||
"color": "yellow",
|
||||
"bold": false
|
||||
}
|
||||
],
|
||||
"exclaimer": "3 words ginlang is gay",
|
||||
"authors": [
|
||||
"ginlang , G6_, ArrayBuffer, and i guess more??"
|
||||
],
|
||||
"foundation": "NodeJS/node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"^"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "FNF",
|
||||
"color": "dark_purple",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": "Boyfriend",
|
||||
"color": "aqua",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": "Bot",
|
||||
"color": "dark_red",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": " nmp",
|
||||
"color": "black",
|
||||
"bold": false
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"text": "Parker2991",
|
||||
"color": "dark_red"
|
||||
},
|
||||
{
|
||||
"text": " _ChipMC_",
|
||||
"color": "dark_green",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": " chayapak",
|
||||
"color": "yellow",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": " _yfd",
|
||||
"color": "light_purple",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": "popbob/aaa",
|
||||
"color": "gold"
|
||||
},
|
||||
{
|
||||
"text": "MorganAnkan",
|
||||
"color": "dark_green"
|
||||
},
|
||||
{
|
||||
"text": "TurtleKid",
|
||||
"color": "green"
|
||||
}
|
||||
],
|
||||
"exclaimer": "v4.0x - current",
|
||||
"foundation": "NodeJS/node-minecraft-protocol",
|
||||
"prefixes": [
|
||||
"~",
|
||||
"fnfbfbot ",
|
||||
"",
|
||||
"",
|
||||
"█"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": [
|
||||
{
|
||||
"text": "FNF",
|
||||
"color": "dark_purple",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": "Boyfriend",
|
||||
"color": "aqua",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": "Bot",
|
||||
"color": "dark_red",
|
||||
"bold": false
|
||||
},
|
||||
{
|
||||
"text": " legacy",
|
||||
"color": "green",
|
||||
"bold": false
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"text": "Parker2991",
|
||||
"color": "dark_red"
|
||||
},
|
||||
{
|
||||
"text": " _ChipMC_",
|
||||
"color": "dark_green",
|
||||
"bold": false
|
||||
}
|
||||
],
|
||||
"exclaimer": "1037 LINES OF CODE WTFARD!??! also this version is in console commands only",
|
||||
"foundation": "NodeJS/mineflayer",
|
||||
"prefixes": []
|
||||
}
|
||||
]
|
|
@ -1,19 +0,0 @@
|
|||
module.exports = {
|
||||
data: {
|
||||
name: '<command name>',
|
||||
trustLevel: 0, // trust levels: 0, 1, 2, 3, 4
|
||||
aliases: [
|
||||
""
|
||||
],
|
||||
description: '',
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
|
||||
},
|
||||
discordExecute (context) {
|
||||
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
prefixes:
|
||||
- "!"
|
||||
|
||||
discord:
|
||||
token: "discord token here"
|
||||
prefix: "!"
|
||||
invite: "discord invite here"
|
||||
roles:
|
||||
trusted: "trusted"
|
||||
admin: "admin"
|
||||
owner: "FNFBoyfriendBot Owner"
|
||||
|
||||
core:
|
||||
name: {"translate":"outOfMemory.message"}
|
||||
area:
|
||||
start:
|
||||
x: 0
|
||||
y: 0
|
||||
z: 0
|
||||
end:
|
||||
x: 15
|
||||
y: 0
|
||||
z: 15
|
||||
|
||||
commandSetMessage: false
|
||||
|
||||
keys:
|
||||
trusted: "trusted key here"
|
||||
admin: "admin key here"
|
||||
owner: "owner key here"
|
||||
|
||||
weatherApiKey: ""
|
||||
|
||||
colors:
|
||||
integer: "gold"
|
||||
discord:
|
||||
embed: "#000000"
|
||||
error: "#FF0000"
|
||||
commands:
|
||||
primary: "dark_blue"
|
||||
secondary: "blue"
|
||||
tertiary: "dark_gray"
|
||||
|
||||
console:
|
||||
prefix: "c."
|
||||
filelogger: false
|
||||
|
||||
bots:
|
||||
- host: "localhost"
|
||||
username: "FNFBoyfriendBot"
|
||||
usernameGen: true
|
||||
version: "1.20.2"
|
||||
serverName: "localhost"
|
||||
private: false
|
||||
reconnectDelay: 6000
|
||||
channelId: "discord channel id here"
|
||||
logging: false
|
||||
useChat: false
|
||||
isKaboom: true
|
||||
isSavage: false
|
||||
isCreayun: false
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
export default {
|
||||
data: {
|
||||
name: '<command name>',
|
||||
trustLevel: 0, // trust levels: 0, 1, 2, 3, 4
|
||||
aliases: [
|
||||
|
||||
],
|
||||
description: '',
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
|
||||
},
|
||||
discordExecute (context) {
|
||||
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
[{"ignoreCase":false,"regexed":false,"name":"04928"},{"ignoreCase":false,"regexed":false,"name":"04928"},{"ignoreCase":false,"regexed":false,"name":"04928"},{"ignoreCase":false,"regexed":false,"name":"04928"},{"ignoreCase":false,"regexed":false,"name":"Parker2991"}]
|
File diff suppressed because it is too large
Load diff
31
src/index.js
31
src/index.js
|
@ -1,31 +0,0 @@
|
|||
const createBot = require('./bot.js');
|
||||
const readline = require('readline');
|
||||
const loadModules = require('./util/loadModules');
|
||||
const js_yaml = require('js-yaml');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const checks = require('./util/checks');
|
||||
const { Client, GatewayIntentBits } = require('discord.js');
|
||||
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits;
|
||||
const discordClient = new Client({ intents: [Guilds, GuildMessages, MessageContent] });
|
||||
console.log('Starting FNFBoyfriendBot');
|
||||
checks();
|
||||
|
||||
try {
|
||||
config = js_yaml.load(fs.readFileSync(path.join(__dirname, '../', 'config.yml')))
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
})
|
||||
if (config.discord.enabled) discordClient.login(config.discord.token);
|
||||
const bots = [];
|
||||
for (const options of config.bots) {
|
||||
const bot = new createBot(options, config);
|
||||
bots.push(bot);
|
||||
bot.bots = bots;
|
||||
loadModules(bot, options, config, discordClient);
|
||||
bot.console.readlineInterface(rl);
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
function boot (bot, options, discordClient, config) {
|
||||
bot.on("packet.login", (data) => {
|
||||
if (bot.options.isCreayun) return
|
||||
if (new Date().getDay() === 5) {
|
||||
bot.chat.message('Gettin\' freaky on a friday night!');
|
||||
} else {
|
||||
bot.chat.message('&9FNF&3Boyfriend&1Bot &fcreated by &4Parker&02991');
|
||||
}
|
||||
}) // &9 &3 &1
|
||||
}
|
||||
module.exports = boot;
|
||||
|
|
@ -1,172 +0,0 @@
|
|||
const loadPrismarineChat = require('prismarine-chat');
|
||||
const KaboomChatParser = require('../util/ChatParsers/Kaboom');
|
||||
const ChipmunkModChatParser = require('../util/ChatParsers/ChipmunkMod');
|
||||
const CreayunChatParser = require('../util/ChatParsers/Creayun');
|
||||
const sayConsoleChatParser = require('../util/ChatParsers/sayConsole');
|
||||
const VanillaChatParser = require("../util/ChatParsers/VanillaChat");
|
||||
const yfdCustomChatParser = require('../util/ChatParsers/yfdCustomChat');
|
||||
function tryParse (json) {
|
||||
try {
|
||||
return JSON.parse(json)
|
||||
} catch (error) {
|
||||
return { text: '' }
|
||||
}
|
||||
}
|
||||
//what was changed??
|
||||
function chat (bot, options, config) {
|
||||
let ChatMessage
|
||||
bot.on('registry_ready', registry => {
|
||||
ChatMessage = loadPrismarineChat(registry)
|
||||
})
|
||||
if (options.isSavage || options.isCreayun) {
|
||||
bot.chatParsers = [CreayunChatParser, sayConsoleChatParser]
|
||||
} else {
|
||||
bot.chatParsers = [KaboomChatParser, ChipmunkModChatParser, VanillaChatParser, sayConsoleChatParser, yfdCustomChatParser]
|
||||
}
|
||||
bot.on('packet.profileless_chat', packet => {
|
||||
const message = tryParse(packet.message)
|
||||
const sender = tryParse(packet.name)
|
||||
bot.emit('profileless_chat', {
|
||||
message,
|
||||
type: packet.type,
|
||||
sender
|
||||
})
|
||||
switch (packet.type) {
|
||||
case 1:
|
||||
bot.emit('profilelessChat', { translate: "chat.type.emote", with: [ sender, message ]})
|
||||
break
|
||||
case 2:
|
||||
bot.emit('profilelessChat', { translate: "commands.message.display.incoming", with: [ sender, message], color: "gray", italic: true })
|
||||
break
|
||||
case 3:
|
||||
bot.emit('profilelessChat', [{ translate: "commands.message.display.outgoing", with: [ sender, message ], color: "gray", italic: true }])
|
||||
break
|
||||
case 4:
|
||||
bot.emit('profilelessChat', [message]);
|
||||
break
|
||||
case 5:
|
||||
bot.emit('profilelessChat', [{ translate: 'chat.type.announcement', with: [ sender, message ]}])
|
||||
break
|
||||
}
|
||||
tryParsingMessage(message, { senderName: sender, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
|
||||
})
|
||||
|
||||
bot.on('packet.player_chat', (packet, data) => {
|
||||
const unsigned = tryParse(packet.unsignedChatContent)
|
||||
bot.emit('player_chat', { plain: packet.plainMessage, unsigned, senderUuid: packet.senderUuid })
|
||||
switch (packet.type) {
|
||||
case 5:
|
||||
bot.emit('playerChat', { translate: "chat.type.announcement", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
|
||||
break
|
||||
case 4:
|
||||
bot.emit('playerChat', unsigned);
|
||||
break
|
||||
case 3:
|
||||
bot.emit('playerChat', { translate: "commands.message.display.outgoing", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
|
||||
break
|
||||
case 2:
|
||||
bot.emit('playerChat', { translate: "commands.message.display.incoming", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
|
||||
break
|
||||
case 1:
|
||||
bot.emit('playerChat', { translate: "chat.type.emote", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
|
||||
break
|
||||
}
|
||||
tryParsingMessage(unsigned, { senderUuid: packet.senderUuid, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
|
||||
})
|
||||
|
||||
bot.on('packet.system_chat', packet => {
|
||||
const message = tryParse(packet.content)
|
||||
if (!config.commandSetMessage) {
|
||||
if (message.translate === 'advMode.setCommand.success') return // Ignores command set message
|
||||
}
|
||||
if (message.translate === 'multiplayer.message_not_delivered') return
|
||||
bot.emit('system_chat', { message, actionbar: packet.isActionBar })
|
||||
|
||||
if (packet.isActionBar) {
|
||||
return
|
||||
}
|
||||
|
||||
bot.emit('systemChat', message)
|
||||
|
||||
tryParsingMessage(message, { players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
|
||||
})
|
||||
|
||||
bot.on('packet.action_bar', (message) => {
|
||||
let parsedMessage = tryParse(message.text)
|
||||
bot.emit('actionBar', {
|
||||
translate: '[%s] %s',
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
{ text: "Action Bar", color: "light_purple" },
|
||||
parsedMessage
|
||||
]
|
||||
});
|
||||
})
|
||||
|
||||
bot.on('packet.boss_bar', (data) => {
|
||||
bot.emit('bossBar', {
|
||||
translate: '[%s | %s: %s] %s',
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
{ text: "Boss Bar", color: "dark_aqua" },
|
||||
{ text: "Action ID", color: "blue" },
|
||||
{ text: `${data.action}`, color: 'gold' },
|
||||
tryParse(data.title)
|
||||
]
|
||||
})
|
||||
})
|
||||
|
||||
function tryParsingMessage (message, data) {
|
||||
let parsed
|
||||
for (const parser of bot.chatParsers) {
|
||||
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: message => {
|
||||
const acc = 0;
|
||||
const bitset = Buffer.allocUnsafe(3);
|
||||
bitset[0] = acc & 0xFF;
|
||||
bitset[1] = (acc >> 8) & 0xFF;
|
||||
bitset[2] = (acc >> 16) & 0xFF;
|
||||
bot._client.write('chat_message', {
|
||||
message: message?.substring(0, 256),
|
||||
timestamp: BigInt(Date.now()),
|
||||
salt: 0n,
|
||||
offset: 0,
|
||||
acknowledged: bitset
|
||||
})
|
||||
},
|
||||
command: command => {
|
||||
bot._client.write('chat_command', {
|
||||
command: command?.substring(0, 256),
|
||||
timestamp: BigInt(Date.now()),
|
||||
salt: 0n,
|
||||
argumentSignatures: [],
|
||||
signedPreview: false,
|
||||
messageCount: 0,
|
||||
acknowledged: Buffer.alloc(3),
|
||||
previousMessages: []
|
||||
})
|
||||
}
|
||||
}
|
||||
bot.tellraw = (selector, message) => {
|
||||
bot.core.run(`minecraft:tellraw ${selector} ` + JSON.stringify(message))
|
||||
}
|
||||
}
|
||||
module.exports = chat;
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
const CommandSource = require('../util/command_source');
|
||||
module.exports = (bot, options, config) => {
|
||||
let ratelimit = 0;
|
||||
bot.on("parsed_message", (data) => {
|
||||
if (data.type !== "minecraft:chat") return;
|
||||
const prefixes = config.prefixes;
|
||||
prefixes.map((prefix) => {
|
||||
const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString();
|
||||
if (!plainMessage.startsWith(prefix)) return
|
||||
const command = plainMessage.substring(prefix.length)
|
||||
const source = new CommandSource(data.sender, { discord: false, console: false }, true)
|
||||
ratelimit++
|
||||
setTimeout(() => {
|
||||
ratelimit--
|
||||
}, 1000)
|
||||
if (ratelimit > 2) {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'You are using commands too fast!', color: 'dark_red'})
|
||||
} else if (command.split(" ")[0].length === 0) {
|
||||
} else {
|
||||
bot.commandManager.executeString(source, command)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
function core (bot, options, config) {
|
||||
let number = 0;
|
||||
bot.core = {
|
||||
area: {
|
||||
start: config.core?.area.start ?? { x: 0, y: 0, z: 0 },
|
||||
end: config.core?.area.end ?? { x: 15, y: 0, z: 15 }
|
||||
},
|
||||
|
||||
position: null,
|
||||
|
||||
currentBlockRelative: { x: 0, y: 0, z: 0 },
|
||||
|
||||
refill () {
|
||||
const pos = bot.core.position
|
||||
const { start, end } = bot.core.area
|
||||
|
||||
if (!pos) return
|
||||
if (bot.options.useChat || bot.options.isCreayun || bot.options.isSavage) return
|
||||
if (isNaN(pos.x + start.x)) {
|
||||
bot.chat.command('spawn');
|
||||
return
|
||||
}
|
||||
/*^^^
|
||||
for checking is the core pos is null and if so
|
||||
it will not refill core until the pos is not NaN
|
||||
instead of tping to a set cords cuz fuck you im not doing that
|
||||
*/
|
||||
bot.chat.command(`minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'}`)
|
||||
},
|
||||
|
||||
move (pos = bot.position) {
|
||||
bot.core.position = {
|
||||
x: Math.floor(pos.x / 16) * 16,
|
||||
y: 0,
|
||||
z: Math.floor(pos.z / 16) * 16
|
||||
}
|
||||
bot.core.refill()
|
||||
},
|
||||
|
||||
currentBlock () {
|
||||
const relativePosition = bot.core.currentBlockRelative
|
||||
const corePosition = bot.core.position
|
||||
if (!corePosition) return null
|
||||
return { x: relativePosition.x + corePosition.x, y: relativePosition.y + corePosition.y, z: relativePosition.z + corePosition.z }
|
||||
},
|
||||
|
||||
incrementCurrentBlock () {
|
||||
const relativePosition = bot.core.currentBlockRelative
|
||||
const { start, end } = bot.core.area
|
||||
|
||||
relativePosition.x++
|
||||
|
||||
if (relativePosition.x > end.x) {
|
||||
relativePosition.x = start.x
|
||||
relativePosition.z++
|
||||
}
|
||||
|
||||
if (relativePosition.z > end.z) {
|
||||
relativePosition.z = start.z
|
||||
relativePosition.y++
|
||||
}
|
||||
|
||||
if (relativePosition.y > end.y) {
|
||||
relativePosition.x = start.x
|
||||
relativePosition.y = start.y
|
||||
relativePosition.z = start.z
|
||||
}
|
||||
},
|
||||
|
||||
run (command) {
|
||||
const eee = Math.floor(Math.random() * 10000)
|
||||
const location = bot.core.currentBlock()
|
||||
if (!location) return
|
||||
if (bot.options.isSavage || bot.options.isCreayun || bot.options.useChat) {
|
||||
return
|
||||
} else {
|
||||
bot._client.write('update_command_block', { command: command.substring(0, 32767), location, mode: 1, flags: 0b100 });
|
||||
bot._client.write('query_block_nbt', ({ location: location, transactionId: eee}));
|
||||
bot.core.incrementCurrentBlock()
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
if (bot.options.isSavage || bot.options.isCreayun) return
|
||||
bot.on('move', () => {
|
||||
bot.core.move(bot.position)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = core;
|
|
@ -1,31 +0,0 @@
|
|||
function command_loop (bot, options, config) {
|
||||
bot.cloop = {
|
||||
list: [],
|
||||
add (command, interval) {
|
||||
let timer;
|
||||
timer = ({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
|
||||
this.list.push(timer)
|
||||
|
||||
bot.on('end', () => {
|
||||
this.clear()
|
||||
})
|
||||
|
||||
bot.on('packet.login', () => {
|
||||
if (this.list.length === 0) return
|
||||
timer = ({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
|
||||
this.list.push(timer);
|
||||
})
|
||||
},
|
||||
|
||||
remove (index) {
|
||||
clearInterval(this.list[index].timer)
|
||||
bot.cloop.list.splice(index, 1)
|
||||
},
|
||||
|
||||
clear () {
|
||||
for (const cloop of this.list) clearInterval(cloop.timer)
|
||||
this.list = []
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = command_loop;
|
|
@ -1,172 +0,0 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const CommandError = require('../util/command_error.js');
|
||||
const CommandSource = require('../util/command_source');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
async function command_manager (bot, options, config, discordClient) {
|
||||
bot.commandManager = {
|
||||
commands: {},
|
||||
commandlist: [],
|
||||
execute (source, commandName, args) {
|
||||
const command = this.getCommand(commandName.toLowerCase());
|
||||
try {
|
||||
if (source?.sources?.discord && !source?.sources?.console) {
|
||||
if (!command || !command?.execute) {
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.error}`)
|
||||
.setTitle("Unknown command")
|
||||
.setDescription(`Unknown command: ${commandName}`)
|
||||
bot?.discord?.message?.reply({ embeds: [Embed] })
|
||||
}
|
||||
} else if (!source?.sources?.discord && !source?.sources?.console) {
|
||||
if (!command || !command.execute)
|
||||
bot.tellraw("@a", {
|
||||
translate: "%s%s%s %s",
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ translate: "command.unknown.command", color: "red" },
|
||||
{ text: "\n" },
|
||||
{ text: `${commandName}` },
|
||||
{ translate: "command.context.here", color: "red" }
|
||||
]
|
||||
})
|
||||
} else if (source?.sources?.console && !source?.sources?.discord) {
|
||||
if (!command || !command.execute)
|
||||
bot.console.warn(bot.getMessageAsPrismarine({
|
||||
translate: "%s%s%s %s",
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ translate: "command.unknown.command", color: "red" },
|
||||
{ text: "\n" },
|
||||
{ text: `${commandName}` },
|
||||
{ translate: "command.context.here", color: "red" }
|
||||
]
|
||||
})?.toAnsi())
|
||||
}
|
||||
if (command?.data?.trustLevel > 0) {
|
||||
const event = bot.discord.message;
|
||||
const roles = event?.member?.roles?.cache;
|
||||
if (command?.data?.trustLevel === 1 && !source?.sources?.discord) {
|
||||
if (args.length === 0 && bot.validation.trusted && bot.validation.admin && bot.validation.owner && !source?.sources?.console) throw new CommandError({ text: "Please provide an trusted or an admin or an owner hash", color: "dark_red" })
|
||||
if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.admin && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted or admin or owner hash', color: 'dark_red' });
|
||||
} else if (command?.data?.trustLevel === 1 && source?.sources.discord) {
|
||||
const hasRole = roles?.some(role => role.name === `${config.discord.roles.trusted}` || role.name === `${config.discord.roles.owner}`)
|
||||
if (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!', color: "dark_red" })
|
||||
}
|
||||
if (command?.data?.trustLevel === 2 && !source.sources.console) {
|
||||
if (args.length === 0 && bot.validation.admin && bot.validation.owner && !source.sources.console) throw new CommandError({ text: "Please provide an trusted or owner hash", color: 'dark_red' })
|
||||
if (args[0] !== bot.validation.admin && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted or owner hash', color: 'dark_red' });
|
||||
}
|
||||
if (command?.data?.trustLevel === 3 && !source.sources.discord && !source.sources.console) {
|
||||
if (args.length === 0 && bot.validation.owner) throw new CommandError({ text: "Please provide an owner hash", color: "dark_red" })
|
||||
if (args[0] !== bot.validation.owner) throw new CommandError({ translate: 'Invalid owner hash', color: 'dark_red' })
|
||||
} else if (command?.data?.trustLevel === 3 && source.sources.discord && !source.sources.console) {
|
||||
const hasRole = roles?.some(role => role.name === `${config.discord.roles.owner}`)
|
||||
if (!hasRole) throw new CommandError({ translate: 'You are not the owner!', color: "dark_red" })
|
||||
} else if (command?.data?.trustLevel === 4 && !source.sources.console) {
|
||||
throw new CommandError({ text: 'This command can only be ran via console', color: "dark_red" });
|
||||
}
|
||||
}
|
||||
if (!command?.discordExecute && command && source?.sources?.discord) {
|
||||
throw new CommandError(`${command.name} command is not supported in discord!`)
|
||||
} else if (command?.discordExecute && command && source?.sources?.discord) {
|
||||
return command.discordExecute({ bot, source, arguments: args, config, discordClient })
|
||||
} else if (!command?.execute && command && !source?.sources?.discord) {
|
||||
throw new CommandError(`${command.name} command is not supported in game!`)
|
||||
} else if (command?.execute && command && !source?.sources?.discord) {
|
||||
return command?.execute({ bot, source, arguments: args, config, discordClient });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
if (source?.sources?.discord && !source?.sources?.console) {
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.error}`)
|
||||
.setTitle(`${command?.name} command`)
|
||||
.setDescription(`\`\`\`${error}\`\`\``)
|
||||
bot?.discord?.message?.reply({
|
||||
embeds: [
|
||||
Embed
|
||||
]
|
||||
})
|
||||
} else if (!source?.sources?.discord && !source?.sources?.console) {
|
||||
if (error instanceof CommandError) {
|
||||
if (bot.options.isSavage || bot.options.isCreayun) {
|
||||
bot.chat.message(`&4${error.message}`)
|
||||
} else {
|
||||
if (error.toString().length > 256) {
|
||||
bot.tellraw("@a", error._message);
|
||||
} else if (error.toString().length < 256) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&')}`)
|
||||
} else {
|
||||
bot.tellraw("@a", error._message);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (bot.options.isSavage || bot.options.isCreayun) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine({ translate: "command.failed", color: "dark_red" })?.toMotd().replaceAll('§','&')}`)
|
||||
} else {
|
||||
bot.tellraw("@a", [{ translate: 'command.failed', color: "dark_red", hoverEvent: { action: 'show_text', contents: `${error.stack}` } }])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
executeString (source, command) {
|
||||
const [commandName, ...args] = command.split(' ')
|
||||
return this.execute(source, commandName, args)
|
||||
},
|
||||
|
||||
discordExecute(source, command) {
|
||||
const [commandName, ...args] = command.split(" ");
|
||||
if (source?.sources?.discord && !source?.sources?.console) {
|
||||
return this.discordExecute(source, commandName, args)
|
||||
}
|
||||
},
|
||||
|
||||
register (command) {
|
||||
this.commands[command.data.name] = command
|
||||
if (command.data.aliases) {
|
||||
command.data.aliases.map((a) => (this.commands[a] = command));
|
||||
}
|
||||
},
|
||||
|
||||
getCommand (name) {
|
||||
return this.commands[name]
|
||||
},
|
||||
|
||||
getCommands () {
|
||||
return Object.values(this.commands)
|
||||
},
|
||||
}
|
||||
|
||||
/*
|
||||
file loader ported from my discord bot SkiBot
|
||||
and edited to support mjs files and to support FNFBoyfriendBot's command format
|
||||
*/
|
||||
commandlist = [];
|
||||
const foldersPath = path.join(__dirname, '../commands');
|
||||
const commandFolders = fs.readdirSync(foldersPath);
|
||||
for (const folder of commandFolders) {
|
||||
const commandsPath = path.join(foldersPath, folder);
|
||||
const commandFiles = fs.readdirSync(commandsPath)
|
||||
for (const filename of commandFiles) {
|
||||
try {
|
||||
const filePath = path.join(commandsPath, filename);
|
||||
if (filename.endsWith('.mjs')) {
|
||||
let command = await import(filePath);
|
||||
bot.commandManager.register(command.default);
|
||||
bot.commandManager.commandlist.push(command.default);
|
||||
}
|
||||
if (filename.endsWith('.js')) {
|
||||
let command = require(filePath);
|
||||
bot.commandManager.register(command);
|
||||
bot.commandManager.commandlist.push(command);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load command ', filename, ':', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = command_manager;
|
|
@ -1,139 +0,0 @@
|
|||
const CommandSource = require('../util/command_source');
|
||||
const prismarineChat = require('prismarine-chat')('1.20.2');
|
||||
function Console (bot, options, config) {
|
||||
let ratelimit = 0;
|
||||
bot.console = {
|
||||
readline: null,
|
||||
server: 'all',
|
||||
readlineInterface (rl) {
|
||||
this.readline = rl
|
||||
rl.on('line', (args) => {
|
||||
if (bot.options.serverName !== this.server && this.server !== 'all') return
|
||||
if (args.startsWith(config.console.prefix)) {
|
||||
return bot.commandManager.executeString(bot.console.source, args.substring(config.console.prefix.length))
|
||||
} else if (args.startsWith("")) {
|
||||
return bot.commandManager.executeString(bot.console.source, `console say ${args.substring(0)}`);
|
||||
}
|
||||
rl.on('close', () => {
|
||||
this.readline = null;
|
||||
})
|
||||
})
|
||||
},
|
||||
source: new CommandSource(bot._client.username, { console: true, discord: false }),
|
||||
refreshLine (...args) {
|
||||
this.readline.output.write("\x1b[2K\r");
|
||||
console.log.apply(console, arguments);
|
||||
this.readline._refreshLine();
|
||||
},
|
||||
log (message) {
|
||||
this.refreshLine(bot.getMessageAsPrismarine(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO" })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })} §6logs§8] §8[${options.serverName}§8] `)?.toAnsi() + message)
|
||||
},
|
||||
warn (error) {
|
||||
this.refreshLine(prismarineChat.fromNotch(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §ewarn§8] §8[${options.serverName}§8] `)?.toAnsi() + error)
|
||||
},
|
||||
error (error) {
|
||||
this.refreshLine(bot.getMessageAsPrismarine(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §4error§8] §8[${options.serverName}§8] `)?.toAnsi() + error)
|
||||
},
|
||||
info (message) {
|
||||
this.refreshLine(prismarineChat.fromNotch(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §2info§8] §8[${options.serverName}§8] `)?.toAnsi() + message)
|
||||
},
|
||||
customChat: {
|
||||
enabled: false,
|
||||
chat (message) {
|
||||
const prefix = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
color:'dark_gray',
|
||||
with: [
|
||||
{
|
||||
text: 'FNFBoyfriendBot Console',
|
||||
color:'#00FFFF'
|
||||
},
|
||||
{
|
||||
selector: `${bot.username}`, color:'#00FFFF',
|
||||
clickEvent: { action: 'suggest_command', value: `${config.prefixes[0]}help` }
|
||||
},
|
||||
{
|
||||
text: '',
|
||||
extra: [`${message}`],
|
||||
color:'white'
|
||||
},
|
||||
],
|
||||
hoverEvent: { action:"show_text", value: 'FNF Sky is a fangirl but a simp for boyfriend confirmed??'},
|
||||
clickEvent: 'https://doin-your.mom' ?
|
||||
{ action: 'open_url', value: 'https://doin-your.mom' } : undefined,
|
||||
}
|
||||
bot.tellraw('@a', prefix)
|
||||
}
|
||||
}
|
||||
}
|
||||
setInterval(() => ratelimit = 0, 1000 * 2);
|
||||
|
||||
bot.on('profilelessChat', (message) => {
|
||||
if (!options.logging) return;
|
||||
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
||||
})
|
||||
|
||||
bot.on('systemChat', (message) => {
|
||||
if (!options.logging) return;
|
||||
if (ratelimit > 15) return;
|
||||
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
||||
ratelimit++
|
||||
})
|
||||
|
||||
bot.on('playerChat', (message) => {
|
||||
if (!options.logging) return;
|
||||
if (ratelimit > 15) return;
|
||||
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
||||
ratelimit++
|
||||
})
|
||||
// console.log(ratelimit)
|
||||
bot.on('bossBar', (message) => {
|
||||
if (!options.logging) return;
|
||||
if (ratelimit > 10) return;
|
||||
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
||||
ratelimit++
|
||||
})
|
||||
|
||||
bot.on('actionBar', (message) => {
|
||||
if (!options.logging) return;
|
||||
if (ratelimit > 10) return
|
||||
// bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
||||
ratelimit++
|
||||
})
|
||||
|
||||
/*
|
||||
setInterval(() => spamCount = 0, 1000 * 2)
|
||||
|
||||
bot.on('message', message => {
|
||||
if (spamCount > 300) {
|
||||
console.log('WTF spam detected not logging')
|
||||
return
|
||||
}
|
||||
|
||||
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi()
|
||||
const string = bot.getMessageAsPrismarine(message)?.toString()
|
||||
const now = new Date().toLocaleString()
|
||||
|
||||
|
||||
spamCount++
|
||||
*/
|
||||
|
||||
/* bot.on('message', (message) => {
|
||||
rateLimit++
|
||||
setTimeout(() => {
|
||||
rateLimit--
|
||||
}, 1000)
|
||||
if (!options.logging) return;
|
||||
if (rateLimit > 100) {
|
||||
return
|
||||
}
|
||||
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
|
||||
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
||||
})*/
|
||||
}
|
||||
module.exports = Console;
|
|
@ -1,165 +0,0 @@
|
|||
// TODO: Maybe move client creation elsepwhere
|
||||
//const { Client, GatewayIntentBits, interaction } = require('discord.js')
|
||||
//const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits
|
||||
const fixansi = require('../util/ansi');
|
||||
const CommandSource = require('../util/command_source')
|
||||
|
||||
//const client = new Client({ intents: [Guilds, GuildMessages, MessageContent] })
|
||||
const util = require('util')
|
||||
|
||||
function discord(bot, options, config, discordClient) {
|
||||
if (!options?.channelId) {
|
||||
bot.discord = {
|
||||
invite: config.discord?.invite
|
||||
}
|
||||
return
|
||||
}
|
||||
bot.discord = {
|
||||
client: discordClient,
|
||||
channel: undefined,
|
||||
invite: config.discord.invite || undefined,
|
||||
prefix: config.discord.prefix,
|
||||
// presence: bot.discord.presence,
|
||||
// token: config.discord.token,
|
||||
}
|
||||
discordClient.once('ready', (context) => {
|
||||
bot.discord.channel = discordClient.channels.cache.get(options.channelId)
|
||||
discordClient.user.setPresence({
|
||||
activities: [{
|
||||
name: `your mother`,
|
||||
type: 0
|
||||
}],
|
||||
status: `dnd`
|
||||
});
|
||||
})
|
||||
|
||||
let discordQueue = []
|
||||
setInterval(() => {
|
||||
if (discordQueue.length === 0) return
|
||||
try {
|
||||
bot?.discord?.channel?.send(`\`\`\`ansi\n${discordQueue.join('\n').substring(0, 1984)}\n\`\`\``)
|
||||
} catch (error) {
|
||||
bot.console.warn(error.toString())
|
||||
}
|
||||
discordQueue = []
|
||||
}, 2000)
|
||||
|
||||
function sendDiscordMessage(message) {
|
||||
discordQueue.push(message)
|
||||
}
|
||||
|
||||
function sendComponent(message) {
|
||||
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(bot.registry.language).replaceAll('```\u001b[9```' + '```\u001b[3```').replaceAll('https://discord','https:\rdiscord')?.replaceAll('discord.gg', 'discord.\rgg').replaceAll('BlackStone Mafia On Top!', "Fuck off you god damn cunt");
|
||||
try {
|
||||
sendDiscordMessage(fixansi(ansi?.replaceAll('`', '`\u200b')))
|
||||
} catch (e) {
|
||||
bot.console.error(`Error sending a message to Discord:\n${e.message}`)
|
||||
sendDiscordMessage(e.message)
|
||||
}
|
||||
}
|
||||
|
||||
bot.on('profilelessChat', (message) => {
|
||||
sendComponent(message);
|
||||
})
|
||||
|
||||
bot.on('systemChat', (message) => {
|
||||
sendComponent(message);
|
||||
})
|
||||
|
||||
bot.on('playerChat', (message) => {
|
||||
sendComponent(message);
|
||||
})
|
||||
/* bot.on('message', message => {
|
||||
sendComponent(message)
|
||||
})*/
|
||||
|
||||
function messageCreate(message, source) {
|
||||
bot.discord.message = message;
|
||||
if (message.author.id === bot.discord.client.user.id) return
|
||||
|
||||
if (message.channel.id !== bot.discord.channel.id) return
|
||||
|
||||
if (message.content.startsWith(config.discord.prefix)) { // TODO: Don't hardcode this
|
||||
const source = new CommandSource({
|
||||
profile: {
|
||||
name: message?.member?.displayName
|
||||
}
|
||||
}, {
|
||||
discord: true,
|
||||
console: false
|
||||
}, false, message)
|
||||
|
||||
bot.sendFeedback = message => {
|
||||
sendComponent(message)
|
||||
}
|
||||
|
||||
bot.commandManager.executeString(source, message.content.substring(config.discord.prefix.length))
|
||||
return
|
||||
}
|
||||
const tag = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
with: [{
|
||||
translate: '%s%s%s %s',
|
||||
bold: false,
|
||||
with: [{
|
||||
text: 'FNF',
|
||||
bold: false,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: 'Boyfriend',
|
||||
bold: false,
|
||||
color: 'dark_aqua'
|
||||
},
|
||||
{
|
||||
text: 'Bot',
|
||||
bold: false,
|
||||
color: 'dark_blue'
|
||||
},
|
||||
{
|
||||
text: 'Discord',
|
||||
bold: false,
|
||||
color: 'dark_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
|
||||
]
|
||||
}
|
||||
if (message.attachments.size > 0) {
|
||||
message.attachments.forEach(Attachment => {
|
||||
bot.tellraw('@a', [tag, {
|
||||
text: ' ' ? ' [Attachment] ' : ' [Attachment] ',
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
contents: 'Click here to view attachment'
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'open_url',
|
||||
value: `${Attachment.url}`
|
||||
}
|
||||
}])
|
||||
})
|
||||
} else {
|
||||
if (options.useChat || options.isSavage || options.isCreayun) {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(`&7[&9FNF&3Boyfriend&1Bot Discord&7] ${message?.member?.displayName} \u203a ${message?.content}`)?.toMotd().replaceAll('§','&'))
|
||||
} else {
|
||||
bot.tellraw('@a', tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
discordClient.on('messageCreate', messageCreate)
|
||||
|
||||
}
|
||||
module.exports = discord;
|
|
@ -1,60 +0,0 @@
|
|||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { createGzip } = require("zlib");
|
||||
const readline = require('readline');
|
||||
const { Console } = require("console");
|
||||
function fileLogger(bot, options, message) {
|
||||
const currentDate = new Date();
|
||||
const timestamp = `${currentDate.getFullYear()}-${(currentDate.getMonth() + 1)
|
||||
.toString()
|
||||
.padStart(2, "0")}-${currentDate.getDate().toString().padStart(2, "0")}`;
|
||||
const logFolder = path.join(__dirname, "../../logs");
|
||||
const logFileName = "latest.log";
|
||||
const logFilePath = path.join(logFolder, logFileName);
|
||||
const logStream = fs.createWriteStream(logFilePath, { flags: "a" });
|
||||
if (!fs.existsSync(path.join(__dirname, "../../logs"))) {
|
||||
fs.mkdirSync(path.join(__dirname, "../../logs"))
|
||||
}
|
||||
try {
|
||||
if (!fs.existsSync(logFolder)) {
|
||||
fs.mkdirSync(logFolder);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(`Unable to create log folder: ${e}`);
|
||||
}
|
||||
|
||||
function compressFile(input, output) {
|
||||
// if (!bot.Console.filelogging) return
|
||||
const plainOutput = output.slice(0, -3);
|
||||
|
||||
fs.renameSync(input, plainOutput);
|
||||
const gzip = createGzip();
|
||||
fs.createReadStream(plainOutput)
|
||||
.pipe(gzip)
|
||||
.pipe(fs.createWriteStream(output + ".tmp"))
|
||||
.once("finish", () => {
|
||||
fs.unlinkSync(plainOutput);
|
||||
fs.renameSync(output + ".tmp", output);
|
||||
});
|
||||
}
|
||||
|
||||
if (fs.existsSync(logFilePath)) {
|
||||
const plainName = fs
|
||||
.statSync(logFilePath)
|
||||
.ctime.toISOString()
|
||||
.split("T")[0];
|
||||
let name = plainName;
|
||||
let counter = 1;
|
||||
let newFileName = path.join(logFolder, `${name}.log.gz`);
|
||||
while (fs.existsSync(newFileName)) {
|
||||
name = `${plainName}-${counter}`;
|
||||
newFileName = path.join(logFolder, `${name}.log.gz`);
|
||||
counter++;
|
||||
}
|
||||
compressFile(logFilePath, newFileName);
|
||||
}
|
||||
bot.console.fileLogger = function logging (message) {
|
||||
logStream.write(message + "\n");
|
||||
};
|
||||
}
|
||||
module.exports = fileLogger;
|
|
@ -1,88 +0,0 @@
|
|||
function player_list (bot, options, config) {
|
||||
bot.players = []
|
||||
|
||||
bot.on('packet.player_info', async (packet) => {
|
||||
const actions = []
|
||||
if (packet.action & 0b000001) actions.push(addPlayer)
|
||||
if (packet.action & 0b000010) actions.push(initializeChat)
|
||||
if (packet.action & 0b000100) actions.push(updateGamemode)
|
||||
if (packet.action & 0b001000) actions.push(updateListed)
|
||||
if (packet.action & 0b010000) actions.push(updateLatency)
|
||||
if (packet.action & 0b100000) actions.push(updateDisplayName)
|
||||
|
||||
for (const entry of packet.data) {
|
||||
for (const action of actions) {
|
||||
action(entry)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
bot.on('packet.player_remove', async ({players}) => { // players has uuids of the players
|
||||
let player_completion = (await bot.tab_complete('scoreboard players add ')).filter(_ => _.tooltip == undefined) // exclude @a, @r, @s, @e, @p -aaa
|
||||
bot.players.forEach(async player => {
|
||||
if(!players.includes(player.uuid)) return
|
||||
|
||||
const a = player_completion.filter(_ => _.match == player.profile.name)
|
||||
if(a.length >= 1) {
|
||||
player.vanished = true
|
||||
} else {
|
||||
bot.players = bot.players.filter(_ => _.uuid != player.uuid)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
function addPlayer (entry) {
|
||||
bot.players = bot.players.filter(_entry => _entry.uuid !== entry.uuid)
|
||||
bot.players.push({
|
||||
uuid: entry.uuid,
|
||||
profile: { name: entry.player.name, properties: entry.player.properties },
|
||||
chatSession: undefined,
|
||||
gamemode: undefined,
|
||||
listed: undefined,
|
||||
latency: undefined,
|
||||
displayName: undefined,
|
||||
vanished: false
|
||||
})
|
||||
}
|
||||
|
||||
function initializeChat (entry) {
|
||||
|
||||
}
|
||||
|
||||
function updateGamemode (entry) {
|
||||
const target = bot.players.find(_entry => _entry.uuid === entry.uuid)
|
||||
if (!target) return
|
||||
|
||||
target.gamemode = entry.gamemode
|
||||
}
|
||||
|
||||
function updateListed (entry) {
|
||||
const target = bot.players.find(_entry => _entry.uuid === entry.uuid)
|
||||
if (!target) return
|
||||
|
||||
target.listed = entry.listed
|
||||
}
|
||||
|
||||
function updateLatency (entry) {
|
||||
const target = bot.players.find(_entry => _entry.uuid === entry.uuid)
|
||||
if (!target) return
|
||||
|
||||
target.latency = entry.latency
|
||||
}
|
||||
|
||||
function updateDisplayName (entry) {
|
||||
const target = bot.players.find(_entry => _entry.uuid === entry.uuid)
|
||||
if (!target) return
|
||||
|
||||
try {
|
||||
target.displayName = JSON.parse(entry.displayName)
|
||||
} catch {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
bot.on('end', () => (bot.players = []))
|
||||
}
|
||||
|
||||
module.exports = player_list;
|
|
@ -1,19 +0,0 @@
|
|||
function position (bot, options, config) {
|
||||
bot.position = null
|
||||
|
||||
bot.on('packet.position', packet => {
|
||||
bot.position = {
|
||||
x: packet.flags & 1 ? (this.x + packet.x) : packet.x,
|
||||
y: packet.flags & 2 ? (this.y + packet.y) : packet.y,
|
||||
z: packet.flags & 4 ? (this.z + packet.z) : packet.z
|
||||
}
|
||||
|
||||
bot._client.write('teleport_confirm', { teleportId: packet.teleportId })
|
||||
|
||||
bot.emit('move')
|
||||
})
|
||||
|
||||
bot.on('end', () => { bot.position = null })
|
||||
}
|
||||
|
||||
module.exports = position
|
|
@ -1,23 +0,0 @@
|
|||
const mc = require('minecraft-protocol');
|
||||
const usernameGen = require("../util/usernameGen");
|
||||
function reconnect (bot, options, config) {
|
||||
bot.on('end', () => {
|
||||
//bot = undefined;
|
||||
|
||||
bot._client.removeAllListeners();
|
||||
//client = undefined;
|
||||
//bot._client = undefined;
|
||||
if (bot.reconnectDelay < 0) return
|
||||
setTimeout(() => {
|
||||
if (options.usernameGen) {
|
||||
client = options.client ?? mc.createClient(options, options.username = usernameGen(bot))
|
||||
} else {
|
||||
client = options.client ?? mc.createClient(options)
|
||||
}
|
||||
bot._client = client
|
||||
bot.emit('init_client', bot._client)
|
||||
}, options.reconnectDelay);
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = reconnect;
|
|
@ -1,156 +0,0 @@
|
|||
function selfcare (bot, options, config) {
|
||||
let entityId;
|
||||
let permissionLevel = 2;
|
||||
let unmuted = false;
|
||||
let gameMode;
|
||||
let commandSpy = false;
|
||||
let vanished = false;
|
||||
let prefix = false;
|
||||
let god = false;
|
||||
let teleportToggle = false;
|
||||
let username = false;
|
||||
let nickname = false;
|
||||
let login = false;
|
||||
let register = false;
|
||||
let positionCount = 0;
|
||||
bot.vanished = true
|
||||
// You now have the tag: &8[&bPrefix&8: &3~&8]
|
||||
// You no longer have a tag
|
||||
bot.on('systemChat', (message) => {
|
||||
const stringMessage = bot.getMessageAsPrismarine(message)?.toString();
|
||||
if (options.isSavage) {
|
||||
if (stringMessage === "Please, login with the command: /login <password>") login = true;
|
||||
else if (stringMessage === "Successful login!") login = false;
|
||||
else if (stringMessage === "You're already logged in!") login = false;
|
||||
else if (stringMessage === "Please, register to the server with the command: /register <password> <ConfirmPassword>") register = true;
|
||||
else if (stringMessage === "This user isn't registered!") register = true;
|
||||
else if (stringMessage === "Successfully registered!") register = false;
|
||||
// else if (stringMessage === "You already have registered this username!") register = false;
|
||||
|
||||
else if (stringMessage === "You're already logged in!") register = false;
|
||||
else if (stringMessage === "Successful login!") register = false;
|
||||
/*
|
||||
You're already logged in!
|
||||
Please, register to the server with the command: /register <password> <ConfirmPassword>
|
||||
Please, login with the command: /login <password>
|
||||
Successfully registered!
|
||||
Successful login!
|
||||
You already have registered this username!
|
||||
*/
|
||||
|
||||
} else if (options.isKaboom) {
|
||||
// const stringMessage = bot.getMessageAsPrismarine(message)?.toString();
|
||||
if (stringMessage === "Successfully enabled CommandSpy") commandSpy = true;
|
||||
else if (stringMessage === "Successfully enabled CommandSpy.") commandSpy = true;
|
||||
else if (stringMessage === "Successfully disabled CommandSpy") commandSpy = false;
|
||||
else if (stringMessage === "Successfully disabled CommandSpy.") commandSpy = false;
|
||||
else if (stringMessage === `Vanish for ${bot.options.username}: enabled`) vanished = true;
|
||||
else if (stringMessage === `Vanish for ${bot.options.username}: disabled`) vanished = false;
|
||||
else if (stringMessage === `You now have the tag: &8[&bPrefix&8: &3${config.prefixes[0]}&8]` || stringMessage === "Something went wrong while saving the prefix. Please check console.") prefix = true;
|
||||
else if (stringMessage?.startsWith("You now have the tag: ") || stringMessage === "You no longer have a tag") prefix = false
|
||||
else if (stringMessage?.startsWith("You have been muted")) unmuted = true;
|
||||
else if (stringMessage?.startsWith("You have been unmuted")) unmuted = false;
|
||||
else if (stringMessage?.startsWith("Your voice has been silenced")) unmuted = true;
|
||||
else if (stringMessage === "God mode disabled.") god = false;
|
||||
else if (stringMessage === "God mode enabled.") god = true;
|
||||
else if (stringMessage === "Teleportation disabled.") teleportToggle = true;
|
||||
else if (stringMessage === "Teleportation enabled.") teleportToggle = false;
|
||||
else if (stringMessage === `Successfully set your username to "${bot.username}"`) {
|
||||
username = false
|
||||
return
|
||||
}
|
||||
else if (stringMessage?.startsWith("Successfully set your username to ")) username = true
|
||||
else if (stringMessage === `You already have the username "${bot.username}"`) username = false
|
||||
else if (stringMessage === `You no longer have a nickname.`) nickname = false;
|
||||
else if (stringMessage.startsWith('Your nickname is now ')) nickname = true;
|
||||
}
|
||||
})
|
||||
|
||||
bot.on('packet.entity_status', packet => {
|
||||
if (packet.entityId !== entityId || packet.entityStatus < 24 || packet.entityStatus > 28) return
|
||||
permissionLevel = packet.entityStatus - 24
|
||||
})
|
||||
|
||||
bot.on('packet.game_state_change', packet => {
|
||||
if (packet.reason !== 3) return // Reason 3 = Change Game Mode
|
||||
gameMode = packet.gameMode;
|
||||
});
|
||||
|
||||
bot.on("packet.game_state.change", packet => {
|
||||
if (packet.reason !== 4) return // checks if the bot is seeing the endcredits or died
|
||||
clientLock = packet.gameMode;
|
||||
})
|
||||
|
||||
bot.on("packet.position", (packet, position) => {
|
||||
if (options.isSavage || options.isCreayun) return
|
||||
positionCount++
|
||||
setTimeout(() => {
|
||||
positionCount--
|
||||
if (positionCount > 4) {
|
||||
bot.core.run('sudo * icu stop');
|
||||
} if (permissionLevel < 2 || gameMode !== 1) {
|
||||
bot._client.end('anti icu :3');
|
||||
}
|
||||
}, 1000)
|
||||
})
|
||||
|
||||
bot.on("packet.teams", (data) => {
|
||||
if (options.isSavage || options.isCreayun) return;
|
||||
try {
|
||||
/*
|
||||
if (data.team !== "FNFBoyfriendBot") {
|
||||
bot.chat.command(`minecraft:team add FNFBoyfriendBot`);
|
||||
}
|
||||
if (data.mode > 1 && !data.team === "FNFBoyfriendBot") {
|
||||
bot.chat.command(`minecraft:team add FNFBoyfriendBot`);
|
||||
}
|
||||
if (data.team === "FNFBoyfriendBot") {
|
||||
console.log(data);
|
||||
}
|
||||
*/
|
||||
} catch (e) {
|
||||
console.log(e.stack)
|
||||
}
|
||||
})
|
||||
|
||||
let timer;
|
||||
bot.on('packet.login', (packet) => {
|
||||
entityId = packet.entityId;
|
||||
gameMode = packet.gameMode;
|
||||
clientLock = packet.gameMode;
|
||||
timer = setInterval(() => {
|
||||
if (bot.options.isSavage && !bot.options.isKaboom && !bot.options.isCreayun) {
|
||||
if (login) bot.chat.command('login amogusissus');
|
||||
else if (register) bot.chat.command('register amogusissus amogusissus');
|
||||
// else if (permissionLevel < 2) bot.chat.command(`minecraft:op ${bot.options.username}`);
|
||||
else if (gameMode !== 1) bot.chat.command('minecraft:gamemode creative');
|
||||
else if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 });
|
||||
} else if (bot.options.isCreayun && !bot.options.isKaboom && !bot.options.isSavage) {
|
||||
|
||||
} else if (bot.options.isKaboom && !bot.options.isSavage) {
|
||||
if (permissionLevel < 2) bot.chat.command('op @s[type=player]');
|
||||
else if (gameMode !== 1) bot.chat.command('minecraft:gamemode creative');
|
||||
else if (!commandSpy) bot.chat.command('commandspy on');
|
||||
else if (username) bot.chat.command(`username ${bot.options.username}`)
|
||||
else if (nickname) bot.chat.command(`nick off`)
|
||||
else if (!prefix) bot.chat.command(`prefix &8[&bPrefix&8: &3${config.prefixes[0]}&8]`);
|
||||
else if (!vanished && bot.vanished) bot.chat.command(`essentials:vanish on`);
|
||||
else if (unmuted) bot.core.run(`essentials:mute ${bot.uuid}`);
|
||||
else if (!god) bot.core.run(`god ${bot.options.username} enable`);
|
||||
else if (!teleportToggle) bot.core.run(`tptoggle ${bot.options.username} disable`);
|
||||
else if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 });
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
bot.on('end', () => {
|
||||
if (timer) clearInterval(timer)
|
||||
prefix = false;
|
||||
commandSpy = false;
|
||||
vanished = false;
|
||||
prefix = false;
|
||||
god = false;
|
||||
unmuted = false;
|
||||
username = false;
|
||||
});
|
||||
}
|
||||
module.exports = selfcare;
|
|
@ -1,16 +0,0 @@
|
|||
module.exports = (bot) => {
|
||||
// let aaa cook
|
||||
bot.tab_complete = (str) => {
|
||||
return new Promise((resolve) => {
|
||||
bot._client.write('tab_complete', {
|
||||
text: str, assumeCommand: false, sendBlockInSight: false
|
||||
})
|
||||
const tab_completeH = (packet) => {
|
||||
bot._client.removeListener('tab_complete', tab_completeH)
|
||||
|
||||
resolve(packet.matches)
|
||||
}
|
||||
bot._client.once('tab_complete', tab_completeH)
|
||||
})
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
const crypto = require('crypto')
|
||||
function validation (bot, options, config) {
|
||||
setInterval(() => {
|
||||
bot.validation = {
|
||||
trusted: crypto.createHash('sha256').update(Math.floor(Date.now() / 1000) + config.keys.trusted).digest('hex').substring(0, 16),
|
||||
admin: crypto.createHash('sha256').update(Math.floor(Date.now() / 1000) + config.keys.admin).digest('hex').substring(0, 16),
|
||||
owner: crypto.createHash('sha256').update(Math.floor(Date.now() / 1000) + config.keys.owner).digest('hex').substring(0, 16),
|
||||
}
|
||||
}, 100)
|
||||
}
|
||||
module.exports = validation
|
|
@ -1,27 +0,0 @@
|
|||
function ChipmunkMod (message, data, context, bot) {
|
||||
try {
|
||||
if (message === null || typeof message !== 'object') return
|
||||
if (message.with?.length < 3 || (message.translate !== '[%s] %s › %s' && message.translate !== '%s %s › %s')) return
|
||||
|
||||
const senderComponent = message.with[1]
|
||||
const contents = message.with[2]
|
||||
let sender
|
||||
const hoverEvent = senderComponent.hoverEvent
|
||||
if (hoverEvent?.action === 'show_entity') {
|
||||
const id = hoverEvent.contents.id
|
||||
|
||||
sender = data.players.find(player => player.uuid === id)
|
||||
} else {
|
||||
const stringUsername = data.getMessageAsPrismarine(senderComponent).toString() // TypeError: data.getMessageAsPrismarine is not a function
|
||||
|
||||
sender = data.players.find(player => player.profile.name === stringUsername)
|
||||
}
|
||||
|
||||
if (!sender) return null;
|
||||
|
||||
return { sender, contents, type: 'minecraft:chat', senderComponent }
|
||||
} catch(e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
module.exports = ChipmunkMod
|
|
@ -1,25 +0,0 @@
|
|||
const ChatMessage = require('prismarine-chat')('1.20.2');
|
||||
const util = require('util');
|
||||
function creayun (messageobj, data) {
|
||||
let match;
|
||||
let sender;
|
||||
const stringify = message => new ChatMessage(message).toString()
|
||||
const message = stringify(messageobj);
|
||||
const playerWithPrefix = /^(.*?) (\S*?) » (.*?)$/;
|
||||
const playerWithoutPrefix = /^(\S*?) » (.*?)$/
|
||||
if (playerWithPrefix.test(message)) {
|
||||
match = message.match(playerWithPrefix)
|
||||
// console.log(match[2])
|
||||
// console.log(data.players.find(player => player.profile.name.toString().replaceAll('§','') === match[2]))
|
||||
// console.log(data.players)
|
||||
// console.log(match[0])
|
||||
// console.log(match[2])
|
||||
// console.log(data.players.find(player => player.profile.name === match[2]))
|
||||
sender = data.players.find(player => player.profile.name === match[2])
|
||||
// sender = data.players.find(player => util.isDeepStrictEqual(player.displayName, playerListDisplayName))
|
||||
// if (!sender) return;
|
||||
// console.log(sender)
|
||||
return { sender, contents: match[3], type: 'minecraft:chat'};
|
||||
}
|
||||
}
|
||||
module.exports = creayun;
|
|
@ -1,41 +0,0 @@
|
|||
const util = require('util')
|
||||
|
||||
function kaboom (message, data) {
|
||||
if (message === null || typeof message !== 'object') return
|
||||
|
||||
if (message.text !== '' || !Array.isArray(message.extra) || message.extra.length < 3) return
|
||||
|
||||
const children = message.extra
|
||||
|
||||
const prefix = children[0]
|
||||
let displayName = data.senderName ?? { text: '' }
|
||||
let contents = { text: '' }
|
||||
|
||||
if (isSeparatorAt(children, 1)) { // Missing/blank display name
|
||||
if (children.length > 3) contents = children[3]
|
||||
} else if (isSeparatorAt(children, 2)) {
|
||||
displayName = children[1]
|
||||
if (children.length > 4) contents = children[4]
|
||||
} else {
|
||||
return undefined
|
||||
}
|
||||
|
||||
const playerListDisplayName = { extra: [prefix, displayName], text: '' }
|
||||
let sender
|
||||
if (data.uuid) {
|
||||
sender = data.players.find(player => player.uuid === data.senderUuid)
|
||||
} else {
|
||||
const playerListDisplayName = { extra: [prefix, displayName], text: '' }
|
||||
sender = data.players.find(player => util.isDeepStrictEqual(player.displayName, playerListDisplayName))
|
||||
}
|
||||
|
||||
if (!sender) return undefined
|
||||
|
||||
return { sender, contents, type: 'minecraft:chat', displayName }
|
||||
}
|
||||
|
||||
function isSeparatorAt (children, start) {
|
||||
return (children[start]?.text === ':' || children[start]?.text === '\xa7f:') && children[start + 1]?.text === ' '
|
||||
}
|
||||
|
||||
module.exports = kaboom
|
|
@ -1,23 +0,0 @@
|
|||
function VanillaChat (message, data, context) {
|
||||
try {
|
||||
if (message === null || typeof message !== 'object') return
|
||||
|
||||
if (message.with?.length < 2 || (message.translate !== 'chat.type.text' && message.translate !== '%s %s')) return
|
||||
const senderComponent = message.with[0]
|
||||
const contents = message.with[1]
|
||||
let sender
|
||||
const hoverEvent = senderComponent.hoverEvent
|
||||
if (hoverEvent?.action === 'show_entity') {
|
||||
const id = hoverEvent.contents.id
|
||||
sender = data.players.find(player => player.uuid === id)
|
||||
} else {
|
||||
const stringUsername = data.getMessageAsPrismarine(senderComponent).toString() // TypeError: data.getMessageAsPrismarine is not a function
|
||||
sender = data.players.find(player => player.profile.name === stringUsername)
|
||||
}
|
||||
if (!sender) return stringUsername
|
||||
return { sender, contents, type: 'minecraft:chat', senderComponent }
|
||||
} catch(e) {
|
||||
console.error(`${e.toString()}`)
|
||||
}
|
||||
}
|
||||
module.exports = VanillaChat;
|
|
@ -1,26 +0,0 @@
|
|||
function sayConsole (message, data, context, bot) {
|
||||
try {
|
||||
if (message === null || typeof message !== 'object') return
|
||||
|
||||
if (message.with?.length < 2 || (message.translate !== 'chat.type.announcement' && message.translate !== '%s %s')) return
|
||||
|
||||
const senderComponent = message.with[0]
|
||||
const contents = message.with[1]
|
||||
let sender
|
||||
const hoverEvent = senderComponent.hoverEvent
|
||||
if (hoverEvent?.action === 'show_entity') {
|
||||
const id = hoverEvent?.contents?.id
|
||||
sender = data.players.find(player => player.uuid === id)
|
||||
} else {
|
||||
const stringUsername = data.getMessageAsPrismarine(senderComponent).toString() // TypeError: data.getMessageAsPrismarine is not a function
|
||||
|
||||
sender = data.players.find(player => player.profile.name) //=== stringusername)
|
||||
}
|
||||
if (!sender) return null
|
||||
|
||||
return { sender, contents, type: 'minecraft:chat', senderComponent }
|
||||
} catch(e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
module.exports = sayConsole
|
|
@ -1,25 +0,0 @@
|
|||
function yfdCustomChat (message, data, context, bot) {
|
||||
try {
|
||||
if (message === null || typeof message !== 'object') return
|
||||
if (message.with?.length < 3 || (message.translate !== '[%s] %s: %s' && message.translate !== '%s %s › %s')) return
|
||||
|
||||
const senderComponent = message.with[1]
|
||||
const contents = message.with[2]
|
||||
let sender
|
||||
const hoverEvent = senderComponent.hoverEvent
|
||||
if (hoverEvent?.action === 'show_entity') {
|
||||
const id = hoverEvent.contents.id
|
||||
sender = data.players.find(player => player.uuid === id)
|
||||
} else {
|
||||
const stringUsername = data.getMessageAsPrismarine(senderComponent).toString() // TypeError: data.getMessageAsPrismarine is not a function
|
||||
sender = data.players.find(player => player.profile.name === stringUsername)
|
||||
}
|
||||
|
||||
if (!sender) return null
|
||||
|
||||
return { sender, contents, type: 'minecraft:chat', senderComponent }
|
||||
} catch(e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
module.exports = yfdCustomChat
|
|
@ -1,81 +0,0 @@
|
|||
function ansi (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
|
||||
"\x1B\[30m": "\x1B[30m", // black
|
||||
"\x1B\[35m": "\x1B[35m", // purple
|
||||
'\x1B[3m': "\x1B[23m", // italic
|
||||
'\x1B[4m': "\x1B[24m", // underline
|
||||
'\x1B[9m': "\x1B[29m", // strike through
|
||||
'\x1B[6m': "\x1B[29m" // obfuscated
|
||||
|
||||
/*
|
||||
Black 30 40
|
||||
Red 31 41
|
||||
Green 32 42
|
||||
Yellow 33 43
|
||||
Blue 34 44
|
||||
Magenta 35 45
|
||||
Cyan 36 46
|
||||
White 37 47
|
||||
Default 39 49
|
||||
Reset 0 0
|
||||
ESC[1;34;{...}m Set graphics modes for cell, separated by semicolon (;).
|
||||
ESC[0m reset all modes (styles and colors)
|
||||
ESC[1m ESC[22m set bold mode.
|
||||
ESC[2m ESC[22m set dim/faint mode.
|
||||
ESC[3m ESC[23m set italic mode.
|
||||
ESC[4m ESC[24m set underline mode.
|
||||
ESC[5m ESC[25m set blinking mode
|
||||
ESC[7m ESC[27m set inverse/reverse mode
|
||||
ESC[8m ESC[28m set hidden/invisible mode
|
||||
ESC[9m ESC[29m set strikethrough mode.
|
||||
*/
|
||||
/*
|
||||
const defaultAnsiCodes = {
|
||||
'§0': '\u001b[30m',
|
||||
'§1': '\u001b[34m',
|
||||
'§2': '\u001b[32m',
|
||||
'§3': '\u001b[36m',
|
||||
'§4': '\u001b[31m',
|
||||
'§5': '\u001b[35m',
|
||||
'§6': '\u001b[33m',
|
||||
'§7': '\u001b[37m',
|
||||
'§8': '\u001b[90m',
|
||||
'§9': '\u001b[94m',
|
||||
'§a': '\u001b[92m',
|
||||
'§b': '\u001b[96m',
|
||||
'§c': '\u001b[91m',
|
||||
'§d': '\u001b[95m',
|
||||
'§e': '\u001b[93m',
|
||||
'§f': '\u001b[97m',
|
||||
'§l': '\u001b[1m',
|
||||
'§o': '\u001b[3m',
|
||||
'§n': '\u001b[4m',
|
||||
'§m': '\u001b[9m',
|
||||
'§k': '\u001b[6m',
|
||||
'§r': '\u001b[0m'
|
||||
}
|
||||
*/
|
||||
};
|
||||
let i = message;
|
||||
|
||||
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 = ansi;
|
|
@ -1,7 +0,0 @@
|
|||
function between(min, max) {
|
||||
return Math.floor(
|
||||
Math.random() * (max - min) + min
|
||||
)
|
||||
}
|
||||
module.exports = between;
|
||||
// ported from FNFBoyfriendBot v3
|
|
@ -1,24 +0,0 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
module.exports = () => {
|
||||
if (!fs.existsSync(path.join(__dirname, "../../config.yml"))) {
|
||||
console.warn("Config not found creating config from the default config");
|
||||
fs.copyFileSync(
|
||||
path.join(__dirname, "../data/default_config.yml"),
|
||||
path.join(__dirname, "../../config.yml")
|
||||
)
|
||||
}
|
||||
|
||||
if (!fs.existsSync(path.join(__dirname, "../data/filter.json"))) {
|
||||
console.warn("filter json not found creating the file,......");
|
||||
let data = [{ ignoreCase: false, regexed: false, name: 'whatever player username idfk' }]
|
||||
fs.writeFileSync(path.join(__dirname, "../data/filter.json"), JSON.stringify(data))
|
||||
}
|
||||
|
||||
/*
|
||||
if (!fs.existsSync(path.join(__dirname, "../data/trustedPlayers.json"))) {
|
||||
console.warn("Trusted Players json not found creating the file,......");
|
||||
let data = [{player: ""}]
|
||||
fs.writeFileSync(path.join(__dirname, "../data/trustedPlayers.json"), JSON.stringify(data))
|
||||
}*/
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
// TODO: Improve how messages are stringified
|
||||
const ChatMessage = require('prismarine-chat')('1.20.2')
|
||||
const stringify = message => new ChatMessage(message)?.toString()
|
||||
|
||||
class CommandError extends Error {
|
||||
constructor (message, filename, lineError, useChat) {
|
||||
super(stringify(message), filename, lineError, useChat)
|
||||
this.name = 'CommandError'
|
||||
this._message = message
|
||||
return this._useChat = useChat
|
||||
// this._useChat = useChat
|
||||
}
|
||||
|
||||
get message () {
|
||||
return stringify(this._message)
|
||||
}
|
||||
}
|
||||
module.exports = CommandError
|
|
@ -1,7 +0,0 @@
|
|||
class CommandSource {
|
||||
constructor (player, sources) {
|
||||
this.player = player;
|
||||
this.sources = sources;
|
||||
}
|
||||
}
|
||||
module.exports = CommandSource
|
|
@ -1,38 +0,0 @@
|
|||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
async function loadModules (bot, options, config, discordClient) {
|
||||
// let module
|
||||
bot.loadModule = module => module(bot, options, config, discordClient)
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, '../', 'modules'))) {
|
||||
try {
|
||||
if (filename.endsWith(".mjs")) {
|
||||
// const module = await import(path.join(__dirname, '../', 'modules', filename));
|
||||
// bot.loadModule(module);
|
||||
} else if (filename.endsWith(".js")) {
|
||||
const module = require(path.join(__dirname, '../', 'modules', filename));
|
||||
bot.loadModule(module);
|
||||
}
|
||||
//bot.loadModule(module)
|
||||
} catch (error) {
|
||||
console.error('Failed to load module', filename, ':', error)
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = loadModules;
|
||||
/*
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, '../commands'))) {
|
||||
try {
|
||||
if (filename.endsWith('.mjs')) {
|
||||
let commands = await import(path.join(__dirname, '../commands', filename))
|
||||
bot.commandManager.register(commands.command);
|
||||
bot.commandManager.commandlist.push(commands.command);
|
||||
} if (filename.endsWith('.js')) {
|
||||
let commands = require(path.join(__dirname, '../commands', filename));
|
||||
bot.commandManager.register(commands);
|
||||
bot.commandManager.commandlist.push(commands);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load command', filename, ':', error)
|
||||
}
|
||||
}
|
||||
*/
|
|
@ -1,5 +0,0 @@
|
|||
module.exports = (bot, options, config, discordClient, proxyClient) => {
|
||||
proxyClient.on('packet.player_chat', (packet) => {
|
||||
proxyClient.emit('playerChat', packet.unsignedChatContent)
|
||||
})
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
async function delay (ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
module.exports = delay;
|
||||
// ported from FNFBoyfriendBot v3
|
|
@ -1,22 +0,0 @@
|
|||
const styles = {
|
||||
bigint: '\xa76', // gold
|
||||
boolean: '\xa76', // gold
|
||||
date: '\xa75', // dark_purple
|
||||
module: '\xa7n', // underline
|
||||
name: undefined, //undefined
|
||||
null: '\xa73', // bold
|
||||
number: '\xa76', // gold
|
||||
regexp: '\xa74', // dark_red
|
||||
special: '\xa73', // blue
|
||||
string: '\xa72', // green
|
||||
symbol: '\xa72', // green
|
||||
undefined: '\xa78' // dark_gray
|
||||
}
|
||||
|
||||
function stylize (str, styleType) {
|
||||
const style = styles[styleType]
|
||||
if (style !== undefined) return `${style}${str}\xa7r`
|
||||
return str
|
||||
}
|
||||
|
||||
module.exports = { stylize, styles }
|
|
@ -1,15 +0,0 @@
|
|||
function usernameGen (bot, config) {
|
||||
// const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
|
||||
if (bot.options.isSavage || bot.options.isCreayun && !bot.options.isKaboom) {
|
||||
characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
|
||||
} else {
|
||||
characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_-+={]}[|\\:;>.<,/?ඞ♋'
|
||||
}
|
||||
let username = '';
|
||||
for (let i = 0; i < 10; i++ ) {
|
||||
const randomIndex = Math.floor(Math.random() * characters.length);
|
||||
username += characters[randomIndex];
|
||||
}
|
||||
return username;
|
||||
}
|
||||
module.exports = usernameGen;
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue