Compare commits

..
16 Commits
40 changed files with 10129 additions and 800 deletions
+10
View File
@@ -1 +1,11 @@
# you know the usual stuff that needs to be ignored when committing
node_modules
config.yml
src/modules/exploits.js
.git
src/modules/custom_chat.js
+26
View File
@@ -0,0 +1,26 @@
SkiBot is a client chat bot created by Parker2991 using Custom FNFBoyfriendBot source
SkiBot's source can be found at https://code.chipmunk.land/Parker2991/SkiBot.git
FNFBoyfriendBot's source can be found at https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot.git
The idea of the bot is to try and make it close to a minecraft java client as much as i can
Setup:
1. run git clone https://code.chipmunk.land/Parker2991/SkiBot
2. make sure to have node, npm, and git installed
if those are installed skip step 2
3. then run npm i to install packages
4. run node src to start the bot
note:
files config.yml, exploits.js, and custom_chat.js are git ignored and wont be in the source because they contain private stuff such as keys and tokens and ips for private servers
but the bot will recreate them from src/data/
after setup is done the bot can be configured and ran
-800
View File
@@ -1,800 +0,0 @@
const mineflayer = require('mineflayer')
let symbol = require('illegal-symbols')
var server = 'play.kaboom.pw'
//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: 'FNFBoyfriendbot',
version: 1.17,
auth: 'prismarine-auth'
})
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&l[&5&lFNF&b&lBoyfriend&4&lBot&8&l]&8&l[&b&lWoomyBot&8&l][&b&lVersion&a&l2&8&l.&4&l2&8&l]&8&l[&4&lParker&0&l2991&8&l]';
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 () => {
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('/nick &5FNF&bBoyfriend&4bot')
await sleep(1)
await sendChat('/world 3')
await sleep(1)
await sendChat ('/tptoggle parker2991')
await sleep(1)
await sendChat ('/tp parker2991')
await sleep(1)
await sendChat ('/tptoggle parker2991')
await sleep(1)
await sendChat('/console ')
await sleep(1)
await sendChat('/c on')
await sleep(1)
await sendChat('/night')
await sleep(1)
await sendChat('/gamerule doMobSpawning false')
await sleep(1)
await sendChat('/gamerule commandBlockOutput false')
await sleep(1)
await sendChat('/de')
await sleep(1)
await sendChat('/gamerule sendCommandFeedback false')
await sleep (1)
await sendChat('/online')
await sleep(1)
await sendChat('/cspy on')
await sleep(1)
await sendChat('/sudo parker2991 nick &4Parker&02991')
await sleep(1)
await sendChat('/prefix &4[BOT/CONSOLE]')
await sleep(1)
await sendChat('/sudo parker2991 prefix &8&l[&9&lDiscord&8&l]&8&l[&4&lOwner &a&lof &a&lthe &5&lFNF&b&lBoyfriend&4&lBot &8&land &b&lWoomyBot&8&l]')
await sleep(1)
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 &4&lis &4Parker&02991')
runInCore('bcraw ' + prefix + 'no longer in developement but forked for a smaller bot')
})
const cmd = require('mineflayer-cmd').plugin
cmd.allowConsoleInput = false // Optional config argument
bot.loadPlugin(cmd)
//nuke 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'), 50 })
setInterval(function() { runInCore('eco give * 1000'), 50 })
setInterval(function() { runInCore('day'), 50 })
setInterval(function() { runInCore('night'), 50 })
setInterval(function() { runInCore('clear @a'), 50})
setInterval(function() { runInCore('summon fireball 115 62 -5'), 50 })
setInterval(function() { runInCore('bcraw ' + prefix + 'WELCOME TO HELL'), 50 })
break
}
})
//fakekick command
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&lFNFBoyfriendbot&8&l] ' + args + ' has been kicked!')
break
}
})
//gmc command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'gmc':
sendChat('/minecraft:gamemode creative')
break
}
})
//deop command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'deop':
sendChat('/deop ' + args.join(' '))
break
}
})
//cloopdeop command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'cloopdeop':
setInterval(function() {
sendChat('/deop ' + args.join(' ')), 1 })
break
}
})
//cloopmute command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'cloopmute':
setInterval(function() {
sendC('/mute ' + args.join(' ')), 1 })
break
}
})
//mute command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'mute':
sendChat('/mute ' + args.join(' '))
break
}
})
//kaboom command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'kaboom':
setInterval(function() { runInCore('sudo * kaboom'), 1 })
runInCore('bcraw have fun =)')
break
}
})
//BOOM command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'BOOM':
runInCore('sudo * /fast')
runInCore('sudo * god')
runInCore('sudo * gms')
runInCore('sudo * /sphere tnt 75')
runInCore('sudo * kaboom')
runInCore('BOOM GOES THE DINOMITE')
break
}
})
//kick command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
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&lFNFBoyfriendbot&8&l] ' + args + ' has been kicked!')
break
}
})
//greeting command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'greeting':
runInCore('bcraw &eAyunami2000 Joined the game')
break
}
})
//fakeban commnad
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'fakeban':
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
}
})
//thor commnad
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'thor':
runInCore('essentials:smite *' + args)
runInCore('bcraw ' + prefix + '&4&lI AM ZEUS')
break
}
})
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'vanish':
sendChat('/vanish on ' + bot.username + '')
break
}
})
//OHHAIL console
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'OHHAIL':
runInCore('sudo * c: OH HAIL FIRE MOTHER FUCKER' + args.join(' '))
break
}
})
//servercrash command
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
}
})
//explode command
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
}
})
//trol command
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
}
})
//cloop command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'cloop':
setInterval(function() { runInCore(args.join(' ')), 1 })
break
}
})
//altcrash command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'altcrash':
setInterval(function() { runInCore('sudo * execute at @a run give @a diamond_hoe 64'), 1 })
setInterval(function() { runInCore('bcraw ' + prefix + '&8&l Have fun with hoes =) '), 1 })
runInCore
break
}
})
//Myhead command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'myhead':
runInCore('give @a minecraft:player_head{SkullOwner:Parker2991}')
runInCore('bcraw ' + prefix + 'My Head')
break
}
})
//MYLEG! command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'myleg':
runInCore('bcraw ' + prefix + '&4&lM&4&lY &4&lLEG!!!')
runInCore('give @a bone 64')
break
}
})
//KFCFINGERLICKINGOOD command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'kfc':
runInCore('give @a cooked_chicken 64')
runInCore('bcraw ' + prefix + 'KFC FINGER LICKIN GOOD')
break
}
})
//GODSWORD!! command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'godsword':
runInCore('give @a diamond_sword')
runInCore('sudo * enchantall')
runInCore('bcraw ' + prefix + 'GOD SWORD!!!!!!!!!!!!!!!!!')
break
}
})
//technoblade command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'technoblade':
runInCore('sudo * summon pig')
runInCore('bcraw ' + prefix + 'Rest in peace technoblade we will always love and remember what you have done for youtube technoblade if you can hear me i love your youtube channel')
break
}
})
//DREAMSTANALERT command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'dreamstanalert':
runInCore('bcraw ' + prefix + 'OH HELL NO DREAM STAN ALERT')
runInCore('execute unless entity @s[name= run ] run stop')
break
}
})
//test command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'test':
setInterval(function() { runInCore('sudo * ' + args + ' summon minecraft:iron_golem'), 1 })
break
}
})
//soundbreaker
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'soundbreaker':
runInCore('sudo * execute at @a run playsound minecraft:entity.wolf.hurt master @a ~ ~ ~ 10000 1.5 1 ')
runInCore('sudo * execute at @a run playsound minecraft:entity.cat.hurt master @a ~ ~ ~ 10000 1.5 1 ')
runInCore('sudo * execute at @a run playsound minecraft:entity.wolf.hurt master @a ~ ~ ~ 10000 1 1 ')
runInCore('sudo * execute at @a run playsound minecraft:entity.cat.hurt master @a ~ ~ ~ 10000 1 1 ')
runInCore('sudo * execute at @a run playsound minecraft:entity.cat.hiss master @a ~ ~ ~ 10000 1.5 1 ')
runInCore('sudo * execute at @a run playsound minecraft:entity.cat.hiss master @a ~ ~ ~ 10000 1 1 ')
break
}
})
//entityspam
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'entityspam':
setInterval(function() { runInCore('sudo * summon fireball '), 1 })
setInterval(function() { runInCore('sudo * summon ender_dragon '), 1 })
setInterval(function() { runInCore('sudo * summon zombie '), 1 })
setInterval(function() { runInCore('sudo * summon creeper'), 1 })
setInterval(function() { runInCore('sudo * blaze'), 1 })
setInterval(function() { runInCore('sudo * summon horse '), 1 })
setInterval(function() { runInCore('sudo * summon spider '), 1 })
setInterval(function() { runInCore('sudo * summon fireball '), 1 })
setInterval(function() { runInCore('sudo * summon ender_dragon '), 1 })
setInterval(function() { runInCore('sudo * summon zombie '), 1 })
setInterval(function() { runInCore('sudo * summon creeper '), 1 })
setInterval(function() { runInCore('sudo * summon blazed '), 1 })
setInterval(function() { runInCore('sudo * summon horse '), 1 })
setInterval(function() { runInCore('sudo * summon spider '), 1 })
break
}
})
//tp command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'tp':
runInCore('essentials:sudo * tp ' + args)
break
}
})
//gms command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'gms':
runInCore('sudo * gms ')
runInCore('sudo ' + bot.username + ' gmc')
runInCore('sudo parker2991 gmc ')
break
}
})
//stop command
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
}
})
//tntspam command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'tntspam':
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt'), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt '), 1 })
setInterval(function() { runInCore('sudo * summon tnt'), 1 })
break
}
})
//prefix command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'prefix':
runInCore('sudo * prefix ' + args)
break
}
})
//annoy command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'annoy':
runInCore('sudo * c:WHYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY' + '')
runInCore('sudo * playsound minecraft:entity.cat.hurt master @a ~ ~ ~ 10000 1.5 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
}
})
//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('essentials:smite * '), 1 })
setInterval(function() { runInCore('clear @a '), 1 })
setInterval(function() { runInCore('effect give @a nausea'), 1 })
setInterval(function() { runInCore('effect give @a poison'), 1 })
runInCore('sudo * gms ' )
setInterval(function() { runInCore('sudo * summon pig'), 1 })
setInterval(function() { runInCore('sudo * tntminecart '), 1 })
setInterval(function() { runInCore('sudo * summon zombie '), 1 })
setInterval(function() { runInCore('sudo * kaboom '), 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 + ' Parker2991'), 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 'op':
sendChat('/op ' + bot.username + '')
break
}
})
//sudo command
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 'refillcore':
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`)
break
}
})
//sudoall command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'sudoall':
runInCore('essentials:sudo * ' + args.join(' '))
break
}
})
//selfdestruct command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'selfdestruct':
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'), 1 })
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 })
setInterval(function() { runInCore('sudo * /fast'), 1 })
setInterval(function() { runInCore('sudo * gms'), 1 })
setInterval(function() { runInCore('sudo * /sphere tnt 75'), 1 })
setInterval(function() { runInCore('sudo * kaboom'), 1 })
break
}
})
//ckill command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'ckill':
setInterval(function() { runInCore('ekill ' + args), 1 })
break
}
})
//serversuicidal command
rl.on('line', (line) => {
let args = line.split(' ')
let command = args.shift()
switch (command) {
case 'serversuicidal':
setInterval(function() { runInCore('sudo * suicide'), 1 })
setInterval(function() { runInCore('bcraw ' + prefix + 'are yall mother fuckers suicidal?'), 1 })
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())
})
+1309
View File
File diff suppressed because it is too large Load Diff
+13
View File
@@ -0,0 +1,13 @@
{
"dependencies": {
"discord.js": "^14.25.1",
"js-yaml": "^4.1.1",
"minecraft-data": "^3.102.3",
"minecraft-protocol": "^1.62.0",
"prismarine-chat": "^1.12.0",
"prismarine-nbt": "^2.8.0",
"prismarine-registry": "^1.11.0",
"terminal-kit": "^3.1.2",
"undici": "^7.18.1"
}
}
+75
View File
@@ -0,0 +1,75 @@
const mc = require('minecraft-protocol');
const { EventEmitter } = require('events');
EventEmitter.defaultMaxListeners = 5e6;
const util = require('util');
const ChatMessage = require('prismarine-chat');
function createBot(context) {
const bot = new EventEmitter();
const config = context.config;
bot.server = {
// Set some default values in options
host: config.server.host ??= 'localhost',
username: config.server.username ??= 'Player',
hideErrors: config.server.hideErrors ??= true, // HACK: Hide errors by default as a lazy fix to console being spammed with them
auth: config.server.auth
};
bot.server = config.server;
const { fromNotch } = require('prismarine-chat')(bot.server.version);
// 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', (data) => {
bot.uuid = client.uuid
bot.username = client.username
})
client.on('disconnect', data => {
bot.emit("disconnect", data);
bot?.console?.disconnect(data.reason);
})
client.on('end', reason => {
bot.emit('end', reason);
if (reason === "socketClosed") return
bot?.console?.disconnect(reason);
})
client.on('error', error => {
bot.emit('error', error);
bot?.console?.disconnect(error);
})
client.on("keep_alive", ({ keepAliveId }) => {
bot.emit("keep_alive", { keepAliveId })
})
client.on('kick_disconnect', (data) => {
bot.emit("kick_disconnect", data);
bot?.console?.disconnect(data.reason);
})
client.on('success', (data) => {
bot?.console?.log(`Successfully logged into ${bot.server.host}:${bot.server.port}`)
});
client.on('server_data', (data) => {
bot.console.log(require('./util/nbt_parser')(null, data.motd))
// bot?.console?.log(data.motd)
});
process.on("uncaughtException", (e) => {
console?.warn(e.stack)
});
})
const client = mc.createClient(bot.server)
bot._client = client
bot.emit('init_client', client)
return bot;
}
module.exports = createBot;
+95
View File
@@ -0,0 +1,95 @@
module.exports = {
data: {
name: "cloop",
aliases: [
"commandloop",
"loop"
],
description: "loops commands",
enabled: true,
usages: [
]
},
execute (context) {
const bot = context.bot;
const config = context.config;
const args = context.arguments;
if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4] && !args[5]) return;
switch (args[0]?.toLowerCase()) {
case "add":
if (isNaN(args[1]) === true) throw new CommandError("invalid interval");
const interval = parseInt(args[1]);
const command = args.slice(2).join(' ');
bot.cloop.add(command, interval);
bot.console.command(`added ${command} to the cloops with the interval ${interval}`);
break;
case "clear":
bot.cloop.clear();
bot.console.command('cleared the cloops');
break;
case "remove":
// if (isNaN(args[1]) === true) throw new CommandError('argument must be an integer!');
const index = parseInt(args[1]);
bot.cloop.remove(index);
bot.chat.message(`removed ${index} from 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: "dark_blue",
with: [
{ text: `${i}`, color: "gold" },
cloop.command,
{ text: `${cloop.interval}`, color: "gold" },
]
})
listComponent.push('\n')
i++
}
listComponent.pop()
component.push({
translate: 'Cloops (%s):',
color: "dark_blue",
with: [
{ text: `${bot.cloop.list.length}`, color: "gold"}
]
})
component.push('\n')
if (bot.cloop.list.length > 0) {
component.push(listComponent)
}
bot.console.command(component);
/*
if (bot.cloop.list.length === 0) {
bot.tellraw(`@a[name="${source?.player.profile?.name}"]`, {
translate: 'Cloops (%s):',
color: config.colors.commands.primary,
with: [
{ text: `${bot.cloop.list.length}`, color: config.colors. }
]
})
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)
}*/
break;
default:
bot.console.command("invalid argument")
//throw new CommandError('invalid argument')
}
}
}
+19
View File
@@ -0,0 +1,19 @@
module.exports = {
data: {
name: "core",
enabled: true,
aliases: [
"cb",
"corerun"
],
description: "run commands in core",
usages: [
"<command>"
]
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
bot.core.run(args.join(' '));
}
}
+28
View File
@@ -0,0 +1,28 @@
module.exports = {
data: {
name: "customchat",
enabled: true,
aliases: [
],
description: "toggle the custom chat",
usages: [
"enable/disable"
]
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
switch (args[0]?.toLowerCase()) {
case "enable":
bot.customChat.enabled = true;
bot.console.command('enabling custom chat');
break;
case "disable":
bot.customChat.enabled = false;
bot.console.command('disabling custom chat');
break;
default:
bot.console.command(`Custom chat is ${bot.customChat.enabled}`);
}
}
}
+19
View File
@@ -0,0 +1,19 @@
module.exports = {
data: {
name: "echo",
enabled: true,
aliases: [
"say",
"botsay"
],
description: "send things in chat",
usages: [
"<message>"
]
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
bot._client.chat(args.join(' '));
}
}
+24
View File
@@ -0,0 +1,24 @@
const { stylize } = require('../util/eval_colors');
const util = require('util');
module.exports = {
data: {
name: "eval",
enabled: true,
aliases: [
],
description: "self explanatory",
usages: [
"<input>"
]
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
try {
bot.console.command(util.inspect(eval(args.join(' ')), { stylize }));
} catch (e) {
bot.console.command(e.toString());
}
}
}
+81
View File
@@ -0,0 +1,81 @@
module.exports = {
data: {
name: "help",
enabled: true,
aliases: [
"heko",
"?",
"cmds",
"commands"
],
description: "get a list of the commands",
usages: [
"<command>"
]
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
let commandComponent = [];
let outputComponent = [];
let colorMix = true;
for (const commands of bot.commandManager.commandlist) {
let usagesComponent = [];
let infoComponent = [];
for (const usages of commands.data.usages) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.console.prefix}`, color: "dark_blue" },
{ text: `${commands.data.name}`, color: "aqua" },
{ text: `${usages}`, color: "blue" },
]
});
usagesComponent.push("\n");
}
usagesComponent.pop();
infoComponent.push({
translate: "%s: %s\n%s: %s\n%s: %s\n%s:",
color: "dark_gray",
with: [
{ text: "Command Name", color: "dark_blue" },
{ text: `${commands.data.name}`, color: "blue" },
{ text: "Aliases", color: "dark_blue" },
{ text: `${commands.data.aliases.toString().replaceAll(',',' ')}`, color: "blue" },
{ text: "Description", color: "dark_blue" },
{ text: `${commands.data.description}`, color: "blue" },
{ text: "Usages", color: "dark_blue" },
]
});
infoComponent.push("\n");
infoComponent.push(usagesComponent);
if (args[0]?.toLowerCase() === commands.data.name) {
bot.console.command(infoComponent);
return;
}
commandComponent.push({
text: commands.data.name + ' ',
color: (!(colorMix = !colorMix) ? "aqua" : "dark_blue")
});
}
outputComponent.push({
translate: "%s (%s) \u203a\n %s",
color: "dark_gray",
with: [
{ text: "Commands", color: "blue" },
{ text: `${bot.commandManager.commandlist.length}`, color: "gold" },
commandComponent
]
})
bot.console.command(outputComponent);
}
}
+58
View File
@@ -0,0 +1,58 @@
const { request } = require('undici');
const { execSync } = require('child_process');
const { buildstring } = require('../data/info.json');
module.exports = {
data: {
name: "info",
enabled: true,
aliases: [
"information",
],
description: "bot information",
usages: [
"version"
]
},
async execute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
let component = [];
switch (args[0]?.toLowerCase()) {
case "version":
let fnfbfbotversionurl = await request('https://code.chipmunk.land/api/v1/repos/Parker2991/FridayNightFunkinBoyfriendBot/releases');
let fnfbfbotcommiturl = await request('https://code.chipmunk.land/api/v1/repos/Parker2991/FridayNightFunkinBoyfriendBot/commits');
let urlVersionData = await fnfbfbotversionurl.body.json();
let urlCommitData = await fnfbfbotcommiturl.body.json();
let urlVersionOutput = urlVersionData[0];
let urlCommitOutput = urlCommitData[0];
component.push({
translate: "%s%s-%s\n%s: %s\n%s: %s\n\n%s%s%s-%s\n%s: %s",
color: "dark_gray",
with: [
{ text: "Ski", color: "aqua" },
{ text: "Bot", color: "blue" },
{ text: `${buildstring.version}`, color: "blue" },
{ text: "Build", color: "dark_blue" },
{ text: `${buildstring.build}`, color: "blue" },
{ text: "Commit", color: "dark_blue" },
{ text: `${execSync("git rev-parse HEAD").toString().substring(0, 10).replaceAll('\n', '')}`, color: "blue" },
{ text: "FNF", color: "dark_blue" },
{ text: "Boyfriend", color: "dark_aqua" },
{ text: "Bot", color: "blue" },
{ text: `${urlVersionOutput.name}`, color: "blue" },
{ text: "Commit", color: "dark_blue" },
{ text: `${urlCommitOutput.sha.substring(0, 10)}`, color: "blue" }
]
});
break;
default:
bot.console.command('SkiBot is a client chat bot created by Parker2991 using Custom FNFBoyfriendBot source\nSkiBot\'s source can be found at https://code.chipmunk.land/Parker2991/SkiBot.git\nFNFBoyfriendBot\'s source can be found at https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot.git\n\nthe idea of the bot is to try and make it close to a minecraft java client as much as i can')
}
bot.console.command(component);
}
}
+32
View File
@@ -0,0 +1,32 @@
module.exports = {
data: {
name: "kick",
enabled: true,
aliases: [
],
description: "kick players",
usages: [
"invalidstring <player>",
"item <player>",
]
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
switch (args[0]?.toLowerCase()) {
case "invalidstring":
bot.exploits.crashes.invalidString(args.slice(1).join(' '));
bot.console.command(`Crashing ${args.slice(1).join(' ')}`);
break;
case "item":
bot.exploits.kicks.item(args.slice(1).join(' '));
bot.console.command(`Kicking ${args.slice(1).join(' ')}`);
break;
case "te":
bot.exploits.kicks.translateEntity(args.slice(1).join(' '))
break;
default:
bot.console.command("invalid argument");
}
}
}
+16
View File
@@ -0,0 +1,16 @@
module.exports = {
data: {
name: "kill",
enabled: true,
aliases: [
],
description: "kills the process",
usages: [
]
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
process.exit();
}
}
+24
View File
@@ -0,0 +1,24 @@
module.exports = {
data: {
name: "rc",
enabled: true,
aliases: [
"refill",
"refillcore"
],
description: "refills the core",
usages: [
]
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
if (config.core.itemRefill === true) {
bot.core.itemRefill();
} else {
bot.core.chatRefill();
}
bot.console.command('refilling core,...');
}
}
+17
View File
@@ -0,0 +1,17 @@
module.exports = {
data: {
name: "reconnect",
enabled: true,
aliases: [
"end"
],
description: "reconnect to the server",
usages: [
]
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
bot._client.end('command reconnect');
}
}
+187
View File
@@ -0,0 +1,187 @@
module.exports = {
data: {
name: "selfcare",
enabled: true,
aliases: [
"sc",
"selfcaretoggle",
"sctoggles"
],
description: "toggle the selfcare",
usages: [
"vanish enable/disable",
"mute enable/disable",
"cspy enable/disable",
"gamemode enable/disable",
"op enable/disable",
"icu enable/disable",
"god enable/disable",
"nick enable/disable",
"username enable/disable",
"prefix enable/disable"
]
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
/*
vanish: true
mute: true
cspy: true
gamemode: true
op: true
icu: true
god: true
nick: true
username: true
prefix: true
*/
if (!args && !args[0] && !args[1]) return;
switch (args[0]?.toLowerCase()) {
case "vanish":
switch (args[1]) {
case "enable":
config.selfcare.vanish = true;
bot.console.command('enabling vanish selfcare');
break;
case "disable":
config.selfcare.vanish = false;
bot.console.command('disabling vanish selfcare');
break;
default:
bot.console.command(`Vanish selfcare is currently ${config.selfcare.vanish}`);
}
break;
case "prefix":
switch (args[1]) {
case "enable":
config.selfcare.prefix = true;
bot.console.command('enabling prefix selfcare');
break;
case "disable":
config.selfcare.prefix = false;
bot.console.command('disabling prefix selfcare');
break;
default:
bot.console.command(`Prefix selfcare is currently ${config.selfcare.prefix}`);
}
break;
case "username":
switch (args[1]) {
case "enable":
config.selfcare.username = true;
bot.console.command('enabling username selfcare');
break;
case "disable":
config.selfcare.username = false;
bot.console.command('disabling username selfcare');
break;
default:
bot.console.command(`Username selfcare is currently ${config.selfcare.username}`);
}
break;
case "nick":
switch (args[1]) {
case "enable":
config.selfcare.nick = true;
bot.console.command('enabling nick selfcare');
break;
case "disable":
config.selfcare.nick = false;
bot.console.command('disabling nick selfcare');
break;
default:
bot.console.command(`Nick selfcare is currently ${config.selfcare.nick}`);
}
break;
case "mute":
switch (args[1]) {
case "enable":
config.selfcare.mute = true;
bot.console.command('enabling mute selfcare');
break;
case "disable":
config.selfcare.mute = false;
bot.console.command('disabling mute selfcare');
break;
default:
bot.console.command(`Mute selfcare is currently ${config.selfcare.mute}`);
}
break;
case "cspy":
switch (args[1]) {
case "enable":
config.selfcare.cspy = true;
bot.console.command('enabling cspy selfcare');
break;
case "disable":
config.selfcare.cspy = false;
bot.console.command('disabling cspy selfcare');
break;
default:
bot.console.command(`Cspy selfcare is currently ${config.selfcare.cspy}`);
}
break;
case "god":
switch (args[1]) {
case "enable":
config.selfcare.god = true;
bot.console.command('enabling god selfcare');
break;
case "disable":
config.selfcare.god = false;
bot.console.command('disabling god selfcare');
break;
default:
bot.console.command(`God selfcare is currently ${config.selfcare.god}`);
}
break;
case "icu":
switch (args[1]) {
case "enable":
config.selfcare.icu = true;
bot.console.command('enabling icu selfcare');
break;
case "disable":
config.selfcare.icu = false;
bot.console.command('disabling icu selfcare');
break;
default:
bot.console.command(`Icu selfcare is currently ${config.selfcare.icu}`);
}
break;
case "gamemode":
switch (args[1]) {
case "enable":
config.selfcare.gamemode = true;
bot.console.command('enabling gamemode selfcare');
break;
case "disable":
config.selfcare.gamemode = false;
bot.console.command('disabling gamemode selfcare');
break;
default:
bot.console.command(`Gamemode selfcare is currently ${config.selfcare.gamemode}`);
}
break;
case "op":
switch (args[1]) {
case "enable":
config.selfcare.op = true;
bot.console.command('enabling op selfcare');
break;
case "disable":
config.selfcare.op = false;
bot.console.command('disabling op selfcare');
break;
default:
bot.console.command(`Op selfcare is currently ${config.selfcare.vanish}`);
}
break;
default:
bot.console.command('invalid argument');
}
}
}
+79
View File
@@ -0,0 +1,79 @@
const crypto = require('crypto');
module.exports = {
data: {
name: "validate",
enabled: true,
aliases: [
"val"
],
description: "validate through bots",
usages: [
"chomens <arguments>",
"fnfboyfriendbot <arguments>",
"qbot <arguments>",
"sbot <arguments>",
"testbot <arguments>",
]
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
let hash;
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return;
switch (args[0]) {
case "chomens":
const time = Math.floor(Date.now() / 5_000)
const value = bot.uuid + args.slice(1).join(' ') + time + config.bots.chomens.key
hash = crypto.createHash('sha256').update(value).digest('hex').substring(0, 16)
if (bot.customChat.enabled) {
bot.customChat.chat(`${config.bots.chomens.prefix}${args.slice(1).shift()} ${hash} ${args.slice(2).join(' ')}`);
} else {
bot.chat(`${config.bots.chomens.prefix}${args.slice(1).shift()} ${hash} ${args.slice(2).join(' ')}`);
}
break;
case "fnfboyfriendbot":
hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 2000) + config.bots.fnfboyfriendbot.key).digest("hex").substring(0, 16);
if (bot.customChat.enabled) {
bot.customChat.chat(`${config.bots.fnfboyfriendbot.prefix}${args.slice(1).shift()} ${crypto.createHash('sha256').update(Math.floor(Date.now() / 2000) + config.bots.fnfboyfriendbot.key).digest('hex').substring(0, 16)} ${args.slice(2).join(' ')}`)
} else {
bot.chat(`${config.bots.fnfboyfriendbot.prefix}${args.slice(1).shift()} ${crypto.createHash('sha256').update(Math.floor(Date.now() / 2000) + config.bots.fnfboyfriendbot.key).digest('hex').substring(0, 16)} ${args.slice(2).join(' ')}`);
}
break;
case "qbot":
hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 1000) + config.bots.qbot.key).digest("hex").substring(0, 16);
if (bot.customChat.enabled) {
bot.customChat.chat(`${config.bots.qbot.prefix}${args.slice(1).shift()} ${hash} ${args.slice(2).join(' ')}`);
} else {
bot.chat(`${config.bots.qbot.prefix}${args.slice(1).shift()} ${hash} ${args.slice(2).join(' ')}`);
}
break;
case "sbot":
const md = crypto.createHash("md5");
const command = args.slice(1).join(' ');
const time1 = Math.floor(+new Date() / 20000);
const raw = ":"+`${command.replace(/&[0-9a-fklmnor]/g, '')};${bot.server.username};${time1};${config.bots.key}`;
md.update(raw);
const hash = md.digest();
const big_int = hash.slice(0, 4).readUInt32BE();
bot.chat(`${config.bots.sbot.prefix}${command} ${big_int.toString(36)}`);
break;
case "testbot":
context.webhook.send(`${bot.server.username}`);
if (bot.customChat.enabled) {
bot.customChat.chat(`${config.bots.testbot.prefix}${args.slice(1).join(' ')}`);
} else {
bot.chat(`${config.bots.testbot.prefix}${args.slice(1).join(' ')}`);
}
break;
default:
console.warn('unknown argument');
}
}
}
+56
View File
@@ -0,0 +1,56 @@
bots:
chomens:
prefix: "*"
key: ""
fnfboyfriendbot:
prefix: "~"
key: ""
qbot:
prefix: "]"
key: ""
sbot:
prefix: ":"
key: ""
testbot:
prefix: "-"
token: ""
console:
prefix: "."
core:
itemRefill: false
area:
start:
x: 0
y: 0
z: 0
end:
x: 15
y: 0
z: 15
itemName: { text: "https://doin-your.mom", color: "dark_red" }
name: { text: "https://doin-your.mom", color: "dark_red" }
selfcare:
vanish: true
mute: true
cspy: true
gamemode: true
op: true
icu: true
god: true
nick: true
username: true
prefix: true
server:
host: "localhost"
# port: ""
username: "player"
version: "1.20.2"
reconnectDelay: 3000
+28
View File
@@ -0,0 +1,28 @@
module.exports = {
data: {
description: "pretty self explanatory",
enabled: true,
name: "custom chat",
type: "extras"
},
inject (context) {
const bot = context.bot;
bot.customChat = {
enabled: true,
chat (args) {
const prefix = {
translate: "chat.type.text",
with: [
{ selector: `${bot.username}` },
{
text: '',
extra: [ args ]
}
]
}
bot.tellraw("@a", prefix);
}
}
}
}
+20
View File
@@ -0,0 +1,20 @@
module.exports = {
data: {
description: "server exploits :3",
enabled: true,
name: "exploits",
type: "extras",
},
inject (context) {
const bot = context.bot;
bot.exploits = {
kicks: {
},
crashes: {
}
}
}
}
+6
View File
@@ -0,0 +1,6 @@
{
"buildstring": {
"version": "1.3.5",
"build": "50"
}
}
File diff suppressed because it is too large Load Diff
+43
View File
@@ -0,0 +1,43 @@
const fs = require('fs');
const { load } = require('js-yaml');
const path = require('path');
const { WebhookClient } = require('discord.js');
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, "./modules/custom_chat.js"))) {
console.warn("custom chat format not found recreating from default custom chat format");
fs.copyFileSync(
path.join(__dirname, "./data/default_custom_chat.js"),
path.join(__dirname, "./modules/custom_chat.js")
)
}
if (!fs.existsSync(path.join(__dirname, "./modules/exploits.js"))) {
console.warn("exploits module not found recreating from default exploits");
fs.copyFileSync(
path.join(__dirname, "./data/default_exploits.js"),
path.join(__dirname, "./modules/exploits.js")
)
}
try {
config = load(fs.readFileSync(path.join(__dirname, '../', 'config.yml')));
} catch (e) {
console.error("Failed to load the config look below for the error stack");
console.error(e.stack);
}
const webhook = new WebhookClient({ id: config.bots.testbot.id, token: config.bots.testbot.token });
//webhook.send({ content: "amogus" });
let bot = require('./bot.js')({ config });
require('./util/loadModules')(bot, config, webhook);
+145
View File
@@ -0,0 +1,145 @@
const convertNbtComponentToJson = require('../util/nbt_parser')
/*
please note that the code here for 1.21.8
was ported from the FNFBoyfriendBot Reignite 1.21.8 port
and had SkiBot's console format added to it
*/
function parse (chatTypes, type, sender, target, message) {
const chatType = chatTypes[type]
const parsed = convertNbtComponentToJson(null, chatType.value.value.chat)
const json = { translate: parsed.translation_key, with: [] }
for (const parameter of parsed.parameters) {
switch (parameter) {
case "sender": json.with.push(sender)
break;
case "target": json.with.push(target)
case "content": json.with.push(message)
break;
}
}
return json
}
module.exports = {
data: {
description: "parses chat",
enabled: true,
name: "chat",
type: "logging"
},
inject (context) {
const bot = context.bot;
const config = context.config;
bot.on('packet.registry_data', (packet) => {
if (packet.id !== 'minecraft:chat_type') return // taken from FNFBoyfriendBot Reignite 1.21.8 port
chatTypes = packet.entries
})
bot.on('packet.player_chat', (packet) => {
const unsigned = convertNbtComponentToJson(null, packet.unsignedChatContent);
bot.emit('message', [
{
translate: "[%s %s %s%s %s] ",
color: "dark_gray",
with: [
{ text: 'Player Chat', color: 'dark_purple' },
{ text: '|' },
{ text: 'Packet Type', color: "aqua" },
{ text: ':' },
{ text: packet.type.chatType, color: 'gold' },
],
},
unsigned
])
});
bot.on('packet.profileless_chat', (packet) => {
const sender = convertNbtComponentToJson(null, packet.name);
const message = convertNbtComponentToJson(null, packet.message);
const target = convertNbtComponentToJson(null, packet.target)
const type = packet.type.chatType;
const parsed = parse(chatTypes, type, sender, target, message)
bot.emit('message', [
{
translate: "[%s %s %s%s %s] ",
color: "dark_gray",
with: [
{ text: 'Profileless Chat', color: 'dark_aqua' },
{ text: '|' },
{ text: 'Packet Type', color: "aqua" },
{ text: ':' },
{ text: packet.type.chatType, color: 'gold' },
],
},
parsed
])
});
bot.on('packet.system_chat', packet => {
try {
const message = convertNbtComponentToJson(null, packet.content)
if (message.translate === 'advMode.setCommand.success') return // Ignores command set message
if (message.translate === 'multiplayer.message_not_delivered') return;
if (packet.isActionBar) {
return
}
bot.emit('message', [
{
translate: "[%s] ",
color: "dark_gray",
with: [
{ text: 'System Chat', color: 'dark_blue' },
],
},
message
]);
bot.emit('system_chat_selfcare', message); // this is for selfcare
} catch (e) {
console.log(e.stack)
}
});
bot.chat = (args) => {
if (args.startsWith('/')) {
bot._client.write('chat_command', {
command: args?.substring(1).substring(0, 256),
timestamp: BigInt(Date.now()),
salt: 0n,
argumentSignatures: [],
signedPreview: false,
messageCount: 0,
acknowledged: Buffer.alloc(3),
previousMessages: []
})
return;
}
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: args?.substring(0, 256),
timestamp: BigInt(Date.now()),
salt: 0n,
offset: 0,
acknowledged: bitset
})
}
bot.tellraw = (selector, message) => {
bot.core.run(`minecraft:tellraw ${selector} ${JSON.stringify(message)}`);
}
}
}
+173
View File
@@ -0,0 +1,173 @@
const mcData = require('minecraft-data')('1.20.2');
const nbt = require('prismarine-nbt');
module.exports = {
data: {
description: "runs commands in command blocks",
enabled: true,
name: "command core",
type: "commands"
},
inject (context) {
const bot = context.bot;
const config = context.config;
const Item = require("prismarine-item")(bot.server.version);
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,
itemPosition: null,
currentBlockRelative: { x: 0, y: 0, z: 0 },
usePlacedCommandBlock: false,
chatRefill () {
const pos = bot.core.position
const { start, end } = bot.core.area
if (!pos) return
const 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)}}`
bot.chat(`${command}`)
},
itemRefill () {
const pos = bot.core.position;
const { start, end } = bot.core.area;
const itemPosition = bot.core.itemPosition;
if (!pos) return;
const 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} command_block{CustomName:${JSON.stringify(config.core.name)}}`
bot._client.write('set_creative_slot', {
slot: 36,
item: Item.toNotch(
new Item(
bot.registry.itemsByName.repeating_command_block.id,
1,
0,
),
),
});
bot._client.write('block_dig', {
status: 0,
location: itemPosition,
face: 0
});
bot._client.write('block_place', {
hand: 0,
location: itemPosition,
direction: 0,
cursorX: 0.1,
cursorY: 0,
cursorZ: 0.1,
insideBlock: false
});
if (bot.core.usePlacedCommandBlock) {
return
} else {
bot._client.write('update_command_block', {
location: itemPosition,
command,
flags: 5,
mode: 1
})
}
},
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.itemPosition = {
x: pos.x,
y: pos.y -1,
z: pos.z
}
if (config.core.itemRefill === true) {
bot.core.itemRefill();
} else {
bot.core.chatRefill();
}
},
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 location = bot.core.currentBlock();
const itemPosition = bot.core.itemPosition;
if (!location || bot.server.mode === "savageFriends") return;
if (bot.core.usePlacedCommandBlock) {
bot._client.write('update_command_block', {
command: command.substring(0, 32767),
location: itemPosition,
mode: 1,
flags: 5,
});
bot.core.incrementCurrentBlock();
} else {
bot._client.write('update_command_block', {
command: command.substring(0, 32767),
location,
mode: 1,
flags: 5
});
bot.core.incrementCurrentBlock();
}
},
}
bot.on('move', () => {
if (bot.server.mode === "savageFriends") return;
bot.core.move(bot.position)
})
bot.on('packet.block_change', (data) => {
})
}
}
+43
View File
@@ -0,0 +1,43 @@
module.exports = {
data: {
description: "loops commands",
enabled: true,
name: "command loop",
type: "extras"
},
inject (context) {
const bot = context.bot;
bot.cloop = {
list: [],
add (command, interval) {
let timer;
if (bot.server.mode === "savageFriends") {
timer = ({ timer: setInterval(() => bot.chat(`${command}`), interval), command, interval })
} else {
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 = []
}
}
}
}
+68
View File
@@ -0,0 +1,68 @@
const fs = require('fs')
const path = require('path')
module.exports = {
data: {
description: "registers commands",
enabled: true,
name: "command manager",
type: "commands"
},
inject (context) {
const bot = context.bot;
const config = context.config;
const webhook = context.webhook;
const { MessageBuilder } = require('prismarine-chat')(bot.server.version);
bot.commandManager = {
commands: {},
commandlist: [],
execute (commandName, args) {
const command = bot.commandManager.getCommand(commandName?.toLowerCase())
try {
if (!command || !command.execute) bot.console.command('unknown command');
return command?.execute({ bot, config, arguments: args, MessageBuilder, webhook })
} catch (error) {
console.error(error)
}
},
executeString (command) {
const [commandName, ...args] = command.split(' ')
return this.execute(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)
}
}
for (const filename of fs.readdirSync(path.join(__dirname, '../commands'))) {
try {
const command = require(path.join(__dirname, '../commands', filename))
if (command.data.enabled === false) {
} else {
bot.commandManager.register(command);
bot.commandManager.commandlist.push(command);
}
} catch (error) {
console.error('Failed to load command', filename, ':', error)
}
}
}
}
+62
View File
@@ -0,0 +1,62 @@
const { fromNotch } = require('prismarine-chat')('1.20.2');
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
module.exports = {
data: {
description: "console functions",
enabled: true,
name: "console",
type: "console"
},
inject (context) {
const bot = context.bot;
const config = context.config;
rl.on('line', (args) => {
if (args.startsWith(config.console.prefix)) {
return bot.commandManager.executeString(args.substring(config.console.prefix.length));
} else if (args.startsWith('')) {
if (bot.customChat.enabled) {
if (args.startsWith('/')) {
bot.chat(`/${args.substring(1)}`);
return;
}
bot.customChat.chat(args.substring(0));
} else {
bot.commandManager.executeString(`echo ${args.substring(0)}`);
}
}
});
refreshLine = function (...args) {
rl.output.write("\x1b[2K\r");
console.log(args.toString());
rl._refreshLine();
}
bot.console = {
log (message) {
if (fromNotch(message)?.toString().includes("https://www.innersloth.com/games/among-us/ › amogus")) {
} else {
refreshLine(`${fromNotch("§8[§6logs§8]§r")?.toAnsi()} ${fromNotch(message)?.toAnsi(require('../data/language.json'))}`)
}
},
command (message) {
refreshLine(`${fromNotch("§8[§ecommand§8]§r")?.toAnsi()} ${fromNotch(message)?.toAnsi(require('../data/language.json'))}`)
},
disconnect (reason) {
refreshLine(`${fromNotch("§8[§bdisconnect§8]§r")?.toAnsi()} ${fromNotch(reason)?.toAnsi(require('../data/language.json'))}`)
},
warn (error) {
refreshLine(`${fromNotch("§8[§cwarn§8]§r")?.toAnsi()} ${fromNotch(error)?.toAnsi(require('../data/language.json'))}`)
},
error (error) {
refreshLine(`${fromNotch("§8[§4error§8]§r")?.toAnsi()} ${fromNotch(error)?.toAnsi(require('../data/language.json'))}`)
}
}
}
}
+18
View File
@@ -0,0 +1,18 @@
module.exports = {
data: {
descripton: "logs chat to console",
enabled: true,
name: "log",
type: "console"
},
inject (context) {
const bot = context.bot;
bot.on('message', (message) => {
try {
bot.console.log(message)
} catch {}
})
}
}
+26
View File
@@ -0,0 +1,26 @@
module.exports = {
data: {
description: "where the bot is at",
enabled: true,
name: "position",
type: "client"
},
inject (context) {
const bot = context.bot;
bot.position = null;
bot.on('packet.position', packet => {
bot.position = {
x: packet.x,
y: packet.y,
z: packet.z
};
bot._client.write('teleport_confirm', { teleportId: packet.teleportId })
bot.emit('move')
})
bot.on('end', () => { bot.position = null })
}
}
+22
View File
@@ -0,0 +1,22 @@
const mc = require('minecraft-protocol');
module.exports = {
data: {
description: "reconnects the players to the server",
enabled: true,
name: "reconnect",
type: "client"
},
inject (context) {
const bot = context.bot;
const config = context.config;
if (bot.server.reconnectDelay < 0) return
bot.on('end', () => {
setTimeout(() => {
let client = new mc.createClient(bot.server)
bot._client = client;
bot.emit('init_client', client)
}, bot.server.reconnectDelay);
})
}
}
+19
View File
@@ -0,0 +1,19 @@
const registry = require('prismarine-registry');
module.exports = {
data: {
description: "registers the client data",
enabled: true,
name: 'registry',
type: 'client',
},
inject (context) {
const bot = context.bot;
bot.on('packet.login', packet => {
bot.registry = registry(bot._client.version)
// bot.registry.language = require('../data/language.json');
bot.emit('registry_ready', bot.registry)
});
}
}
+139
View File
@@ -0,0 +1,139 @@
const { fromNotch } = require('prismarine-chat')('1.20.2');
module.exports = {
data: {
description: "self explanatory",
enabled: true,
name: "selfcare",
type: "client"
},
inject (context) {
const bot = context.bot;
const config = context.config;
let entityId;
let permission = 2;
let gameMode;
let positionCount = 0;
let mute = false;
let god = false;
let commandSpy = false;
let prefix = false;
let vanish = false;
let nick = false;
let username = false;
bot.on("system_chat_selfcare", (message) => {
try {
const parsedMessage = fromNotch(message)?.toMotd();
if (parsedMessage?.startsWith("§6You have been muted")) mute = true;
else if (parsedMessage?.startsWith("§6You have been unmuted")) mute = false;
else if (parsedMessage?.startsWith("§6Your voice has been silenced")) mute = true;
else if (parsedMessage === "§6God mode§c enabled§6.") god = true;
else if (parsedMessage === "§6God mode§c disabled§6.") god = false;
else if (parsedMessage === "Successfully enabled CommandSpy") commandSpy = true;
else if (parsedMessage === "Successfully disabled CommandSpy") commandSpy = false;
else if (parsedMessage === "Successfully disabled CommandSpy.") commandSpy = false;
else if (parsedMessage === "Successfully enabled CommandSpy.") commandSpy = true;
else if (parsedMessage?.startsWith("You now have the tag:")) prefix = true;
else if (parsedMessage === "You no longer have a tag" || parsedMessage === "Something went wrong while saving the prefix. Please check console.") prefix = false;
else if (parsedMessage === `§6Vanish for ${bot.server.username}: enabled`) vanish = true;
else if (parsedMessage === `§6Vanish for §c${bot.server.username}§6: disabled`) vanish = false;
else if (parsedMessage?.startsWith('§6Your nickname is now')) nick = true;
else if (parsedMessage === "§6You no longer have a nickname.") nick = false;
else if (parsedMessage?.startsWith("Successfully set your username to ") || parsedMessage?.endsWith(`${bot.server.username}`)) username = true;
else if (parsedMessage === `Successfully set your username to "${bot.server.username}"`) username = false;
else if (parsedMessage === `You already have the username "${bot.server.username}"`) username = false;
} catch (e) {
console.log(e.stack)
}
});
bot.on('packet.entity_status', (data) => {
if (data.entityId !== entityId || data.entityStatus < 24 || data.entityStatus > 28) return;
permission = data.entityStatus - 24
});
bot.on('packet.game_state_change', (packet) => {
if (packet.reason === 3 || packet.reason === "change_game_mode") {
gameMode = packet.gameMode;
} if (packet.reason === 4 || packet.reason === "win_game") {
bot._client.write('client_command', { action: 0 })
}
});
/* bot.on("packet.position", (packet, position) => {
if (!config.selfcare.icu || bot.server.mode === "savageFriends") return;
positionCount++
setTimeout(() => {
positionCount--
if (positionCount > 4) {
bot.core.run('sudo * icu stop');
} if (permission < 2 || gameMode !== 1) {
bot._client.end('anti icu :3');
}
}, 1000)
})*/
let timer;
bot.on('packet.login', (data) => {
entityId = data.entityId;
switch (data.worldState.gamemode) {
case 'survival':
gameMode = 0
break
case 'creative':
gameMode = 1
break
case 'adventure':
gameMode = 2
break
case 'spectator':
gameMode = 3
break
default:
gameMode = 0
break
}
// if (bot.server.mode === "savageFriends") return;
timer = setInterval(() => {
if (bot.server.mode === "savageFriends") {
if (gameMode !== 1 && config.selfcare.game) bot.chat("/minecraft:gamemode creative")
else if (permission < 2 && config.selfcare.op) bot.chat(`/minecraft:op ${bot._client.username}`)
} else {
if (permission < 2 && config.selfcare.op) bot.chat("/minecraft:op @s[type=player]");
else if (gameMode !== 1 && config.selfcare.gamemode) bot.chat("/minecraft:gamemode creative");
else if (!commandSpy && config.selfcare.cspy) bot.chat('/cspy on');
else if (prefix && config.selfcare.prefix) bot.chat('/prefix off');
else if (!vanish && config.selfcare.vanish) bot.chat('/vanish on');
else if (username && config.selfcare.username) bot.chat(`/username ${bot.server.username}`);
else if (mute && config.selfcare.mute) bot.core.run(`essentials:mute ${bot.uuid}`);
else if (!god && config.selfcare.god) bot.core.run(`god ${bot.server.username} on`);
else if (nick && config.selfcare.nick) bot.core.run(`nick ${bot.server.username} off`);
else if (gameMode !== 4) bot._client.write("client_command", { actionId: 0 });
}
}, 1000);
});
bot.on('end', () => {
if (timer) clearInterval(timer);
commandSpy = false;
god = false;
mute = false;
prefix = false;
vanish = false;
nick = false;
username = false;
});
}
}
+44
View File
@@ -0,0 +1,44 @@
const BOOLEAN_TYPES = ['interpret', 'bold', 'italic', 'underlined', 'strikethrough', 'obfuscated']
function convertNbtComponentToJson (key, tag) {
let chatTypes
if (!tag) {
return null
} else if (tag.type === 'compound') {
const object = {}
for (const key of Object.keys(tag.value)) {
object[key === '' ? 'text' : key] = convertNbtComponentToJson(key, tag.value[key])
}
return object
} else if (tag.type === 'list') {
const array = []
for (const item of tag.value.value) {
array.push(convertNbtComponentToJson(null, { type: tag.value.type, value: item }))
}
return array
} else if (tag.type === 'byte') {
if (key && BOOLEAN_TYPES.includes(key)) return tag.value !== 0
return tag.value
} else if (tag.type === 'int') {
return tag.value
} else if (tag.type === 'string') {
return tag.value
} else if (tag.type === 'intArray') {
const array = []
for (const value of tag.value) {
array.push(value)
}
return array
} else {
console.log('Failed to parse NBT component type ' + tag.type)
return { text: '' }
}
}
module.exports = convertNbtComponentToJson
+22
View File
@@ -0,0 +1,22 @@
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 }
+18
View File
@@ -0,0 +1,18 @@
const fs = require("fs");
const path = require("path");
async function loadModules (bot, config, webhook) {
for (const filename of fs.readdirSync(path.join(__dirname, '../', 'modules'))) {
try {
if (filename.endsWith(".js")) {
const module = require(path.join(__dirname, '../modules', filename));
if (module.data.enabled === false) return;
module.inject({ bot, config, webhook });
bot.emit('modules', module.data);
}
} catch (error) {
console.error(`Failed to load module ${filename} due to error`);
console.error(`\x1b[31m${error.stack}\x1b[0m`);
}
}
}
module.exports = loadModules;
+59
View File
@@ -0,0 +1,59 @@
const BOOLEAN_TYPES = [
"interpret",
"bold",
"italic",
"underlined",
"strikethrough",
"obfuscated",
"float"
];
function convertNbtComponentToJson(key, tag) {
let chatTypes;
if (!tag) {
return null;
} else if (tag.type === "compound") {
const object = {};
for (const key of Object.keys(tag.value)) {
object[key === "" ? "text" : key] = convertNbtComponentToJson(
key,
tag.value[key],
);
}
return object;
} else if (tag.type === "list") {
const array = [];
for (const item of tag.value.value) {
array.push(
convertNbtComponentToJson(null, { type: tag.value.type, value: item }),
);
}
return array;
} else if (tag.type === "byte") {
if (key && BOOLEAN_TYPES.includes(key)) return tag.value !== 0;
return tag.value;
} else if (tag.type === "int") {
return tag.value;
} else if (tag.type === "string") {
return tag.value;
} else if (tag.type === "float") {
return tag.value
} else if (tag.type === "intArray") {
const array = [];
for (const value of tag.value) {
array.push(value);
}
return array;
} else {
console.log("Failed to parse NBT component type " + tag.type);
return { text: "" };
}
}
module.exports = convertNbtComponentToJson;
+6
View File
@@ -0,0 +1,6 @@
async function delay(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
module.exports = delay;
// ported from FNFBoyfriendBot v3