mirror of
https://code.chipmunk.land/Parker2991/NitoriBot/
synced 2026-11-30 06:05:40 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4aa3599b5d | ||
|
|
1e9fb94e1d |
@@ -11,11 +11,8 @@ const rs = require('randomstring')
|
||||
// Set some default values in options
|
||||
let r = Math.floor(Math.random() * 255) + 1;
|
||||
options.host ??= 'localhost'
|
||||
options.username ??= rs.generate({
|
||||
length:8,
|
||||
charset: ['abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_-+=[{]}|/?.>,<`~\\\'']// Added some characters that were missing - yfd
|
||||
});
|
||||
options.hideErrors ??= true // HACK: Hide errors by default as a lazy fix to console being spammed with them
|
||||
options.username ??= username()
|
||||
options.hideErrors ??= false // HACK: Hide errors by default as a lazy fix to console being spammed with them
|
||||
|
||||
bot.options = options
|
||||
|
||||
@@ -59,4 +56,15 @@ const buildstring = process.env['buildstring']
|
||||
return bot
|
||||
}
|
||||
|
||||
// ABot username function mabe mabe
|
||||
function username() {
|
||||
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; // remove sus characters like ` or like ( or whatever because it breaks whatever
|
||||
let username = '';
|
||||
for (let i = 0; i < 8; i++) {
|
||||
const randomIndex = Math.floor(Math.random() * characters.length);
|
||||
username += characters[randomIndex];
|
||||
}
|
||||
return username;
|
||||
}
|
||||
|
||||
module.exports = createBot
|
||||
+17
-36
@@ -1,52 +1,33 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
const CharacterAI = require('node_characterai');
|
||||
const CharacterAI = require('node_characterai'); // im gonna push it to the main bot afterwards
|
||||
const characterAI = new CharacterAI();
|
||||
// won't work on server nodejs. only works on windows I guess :|
|
||||
|
||||
// ???
|
||||
async function start() {
|
||||
await characterAI.authenticateAsGuest();
|
||||
await characterAI.authenticateAsGuest(); //well idk how to get the bot to sign into a account
|
||||
}
|
||||
|
||||
async function ask(key, message) {
|
||||
const characterId = key;
|
||||
const characterId = key;
|
||||
|
||||
const chat = await characterAI.createOrContinueChat(characterId);
|
||||
const response = await chat.sendAndAwaitResponse(message, true);
|
||||
const chat = await characterAI.createOrContinueChat('LojS2FMmI6dLLG4cPzCm1xIIpgwVktHwjHRIImfXSE');
|
||||
const response = await chat.sendAndAwaitResponse(message, true);
|
||||
|
||||
return response.text
|
||||
}
|
||||
return response.text//lag real
|
||||
console.debug(message)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
start,
|
||||
ask,
|
||||
name: 'cai',
|
||||
|
||||
execute (context) {
|
||||
async execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
/*
|
||||
const CharacterAI = require('node_characterai');
|
||||
const characterAI = new CharacterAI();
|
||||
|
||||
async function start() {
|
||||
await characterAI.authenticateAsGuest();
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
|
||||
//yfd idk what im doing
|
||||
context.source.sendFeedback(start, false)
|
||||
context.source.sendFeedback(ask, false)
|
||||
}
|
||||
|
||||
async function ask(key, message) {
|
||||
const characterId = key;
|
||||
|
||||
const chat = await characterAI.createOrContinueChat(characterId);
|
||||
const response = await chat.sendAndAwaitResponse(message, true);
|
||||
|
||||
return response.text
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
start,
|
||||
ask
|
||||
};
|
||||
```*/
|
||||
}
|
||||
+30
-1
@@ -225,10 +225,39 @@ const bots = [
|
||||
foundation: '10/03/23',
|
||||
exclaimer:'moved the custom chat text and cmd block text to config.js',
|
||||
},
|
||||
{
|
||||
name: { text: 'v4.1.6', color: 'green', bold:false },
|
||||
authors: [''],
|
||||
|
||||
foundation: '10/08/23',
|
||||
exclaimer:'fixed the relay chat and fixed the cr issue with urban and also fixed reconnect',
|
||||
},
|
||||
{
|
||||
name: { text: 'v4.1.7', color: 'green', bold:false },
|
||||
authors: [''],
|
||||
|
||||
foundation: '10/08/03',
|
||||
exclaimer:'added mute, tag, and skin to selfcare',
|
||||
}, // am I even gonna be credited?
|
||||
{
|
||||
name: { text: 'v4.1.8', color: 'green', bold:false },
|
||||
authors: [''],//cai cee mmm deee sus
|
||||
|
||||
foundation: '10/11/23',
|
||||
exclaimer:'fixed the issue with memused cee mmm dee',
|
||||
},
|
||||
{//
|
||||
name: { text: 'v4.1.9', color: 'gray', bold:false },
|
||||
authors: [''],
|
||||
|
||||
foundation: '10/12/23',
|
||||
exclaimer:'rewrote evaljs its now using isolated-vm and not vm2',
|
||||
},
|
||||
]
|
||||
//back
|
||||
|
||||
|
||||
/*{
|
||||
/*{//
|
||||
name: { text: '', color: 'gray', bold:false },
|
||||
authors: [''],
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
|
||||
//how do i stop following? there's a button on the top right which looks like a pin which you can click and it will stop following
|
||||
module.exports = {
|
||||
name: 'creator',
|
||||
name: 'creator',//thx
|
||||
|
||||
execute (context, prefix) {
|
||||
const message = context.arguments.join(' ')
|
||||
|
||||
+11
-1
@@ -5,6 +5,16 @@ module.exports = {
|
||||
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
context.source.sendFeedback(context.bot.discord.invite, false)
|
||||
const event = {
|
||||
|
||||
clickevent: { action:"open_url", value: `${context.bot.discord.invite}`},
|
||||
"color": "#5A5A5A",
|
||||
"translate": `%s`,
|
||||
"with": [
|
||||
{ "color": "green", "text": "Click here for the bots discord server link"},
|
||||
|
||||
]//
|
||||
}
|
||||
context.source.sendFeedback(event, false)
|
||||
}
|
||||
}
|
||||
|
||||
+84
-21
@@ -1,43 +1,106 @@
|
||||
const { VM } = require('vm2-fixed')
|
||||
const util = require('util')
|
||||
const ivm = require('isolated-vm');//new ivm.Isolate(options)
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
// const isolate = new ivm.isolate({ memoryLimit: 128 });
|
||||
const { stylize } = require('../util/eval_colors')
|
||||
|
||||
const options = {
|
||||
timeout: 1000
|
||||
timeout: 1000//?
|
||||
}
|
||||
let vm = new VM(options)
|
||||
let isolate = new ivm.Isolate({ memoryLimit: 32 }) // 32 seems fine
|
||||
|
||||
module.exports = {
|
||||
name: 'evaljs',
|
||||
hashOnly:true, // null
|
||||
execute (context) {
|
||||
hashOnly:false, // vm owners please dont get mad at me ;-;
|
||||
async execute (context) {
|
||||
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const cmd = {
|
||||
const util = require('util')
|
||||
const cmd = {
|
||||
translate: '[%s] ',
|
||||
bold: false,
|
||||
color: 'white',
|
||||
with: [
|
||||
{ color: 'dark_green', text: 'EvalJS Cmd'},
|
||||
{ color: 'dark_green', text: 'EvalJS'},
|
||||
]
|
||||
}
|
||||
switch (args[0]) {
|
||||
/* bot.tellraw(selector, { text: util.inspect(bot.vm.run(args.slice(1).join(' ')), { stylize }).substring(0, 32000) })
|
||||
} catch (err) {
|
||||
bot.tellraw(selector, { text: util.inspect(err).replaceAll('runner', 'Parker2991'), color: 'red' })
|
||||
*/
|
||||
switch (args[0]) {
|
||||
case 'run':
|
||||
try {
|
||||
const output = vm.run(args.slice(1).join(' '))
|
||||
|
||||
source.sendFeedback([cmd, { text: util.inspect(output, { stylize }) }])
|
||||
} catch (e) {
|
||||
source.sendFeedback([cmd, { text: String(e), color: 'white' }])
|
||||
}
|
||||
|
||||
break
|
||||
case 'reset':
|
||||
vm = new VM(options)
|
||||
try {//context.eval()
|
||||
/*
|
||||
let kitty
|
||||
const output = test.compileScript(args.slice(1).join(' '))// ivm.createContext(args.slice(1).join(' '))
|
||||
const realoutput = output.then(result => {
|
||||
kitty = result.run({
|
||||
context: amonger,
|
||||
})
|
||||
}).catch(reason => {
|
||||
console.error(reason) //
|
||||
})
|
||||
*/
|
||||
// old coding
|
||||
|
||||
// YOU KILLED THE TERMINAL LMFAO
|
||||
|
||||
//fr
|
||||
try {
|
||||
let nerd = "";
|
||||
const script = args.slice(1).join(' '); // Ensure script is a string
|
||||
const cOmtext = isolate.createContext();
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
let result = await (await cOmtext).eval(script, {
|
||||
timeout: 1000
|
||||
})
|
||||
nerd = result;
|
||||
source.sendFeedback([cmd, { text: util.inspect(result, { stylize }) }]);
|
||||
} catch (reason) {
|
||||
nerd = reason;
|
||||
source.sendFeedback([cmd, { text: String(reason.message), color: 'white' }]);
|
||||
console.log(`AAA at ${reason}\n${reason.stack}`);
|
||||
}
|
||||
})();
|
||||
} catch (reason) {
|
||||
source.sendFeedback([cmd, { text: String("UwU OwO ewwor" + reason.message), color: 'white' }]);
|
||||
console.log(`AAA at ${reason}\n${reason.stack}`);
|
||||
}
|
||||
|
||||
// credits to chatgpt because im lazy mabe mabe? idfk again ty
|
||||
//
|
||||
break//
|
||||
} catch (e) {
|
||||
// ral
|
||||
}
|
||||
case 'reset':
|
||||
|
||||
isolate = null
|
||||
isolate = new ivm.Isolate({ memoryLimit: 32 }) // 32 seems fine
|
||||
source.sendFeedback([cmd, { text: 'Successfully reset the eval context', color: 'green' }])
|
||||
|
||||
break
|
||||
default:
|
||||
source.sendFeedback([cmd, { text: 'Invalid option!', color: 'dark_red' }])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
this is typescript
|
||||
|
||||
import ivm from 'isolated-vm';
|
||||
|
||||
const code = `(function() { return 'Hello, Isolate!'; })()`;
|
||||
|
||||
const isolate = new ivm.Isolate({ memoryLimit: 8 }); // mego bites
|
||||
const script = isolate.compileScriptSync(code);
|
||||
const context = isolate.createContextSync();
|
||||
//this
|
||||
// Prints "Hello, Isolate!"
|
||||
console.log(script.runSync(context));
|
||||
|
||||
*/
|
||||
@@ -25,38 +25,9 @@ context.source.sendFeedback(`OS platform: ${os.platform()}`, false)
|
||||
context.source.sendFeedback(`OS name: ${os.version()}`, false)
|
||||
context.source.sendFeedback(`CPU cores: ${os.cpus().length}`, false)
|
||||
context.source.sendFeedback(`CPU model: ${await getCpuModelName()}`, false)
|
||||
context.source.sendFeedback(`Total memory usage: ${Math.floor(os.totalmem() / 512 / 512)} MB`, false)
|
||||
context.source.sendFeedback(`Available memory usage: ${Math.floor(os.freemem() / 512 / 512)} MB`, false)
|
||||
context.source.sendFeedback(`Node js Version @${process.version}`, false)
|
||||
context.source.sendFeedback(`Minecraft-Protocol Version @${MinecraftProtocolVersion}`, false)
|
||||
context.source.sendFeedback(`Discord.js @${discordJSVersion}`, false)
|
||||
|
||||
}
|
||||
}
|
||||
/*component.push({ text: 'Hostname: ', color: 'gold' })
|
||||
component.push({ text: os.hostname(), color: 'aqua' })
|
||||
component.push('\n')
|
||||
component.push({ text: 'Working directory: ', color: 'gold' })
|
||||
component.push({ text: path.join(__dirname, '..') /* if without .. it will includes the commands directory , color: 'aqua' })
|
||||
component.push('\n')
|
||||
component.push({ text: 'OS architecture: ', color: 'gold' })
|
||||
component.push({ text: os.arch(), color: 'aqua' })
|
||||
component.push('\n')
|
||||
component.push({ text: 'OS platform: ', color: 'gold' })
|
||||
component.push({ text: os.platform(), color: 'aqua' })
|
||||
component.push('\n')
|
||||
component.push({ text: 'OS name: ', color: 'gold' })
|
||||
component.push({ text: os.version(), color: 'aqua' })
|
||||
component.push('\n')
|
||||
component.push({ text: 'CPU cores: ', color: 'gold' })
|
||||
component.push({ text: os.cpus().length, color: 'aqua' })
|
||||
component.push('\n')
|
||||
component.push({ text: 'CPU model: ', color: 'gold' })
|
||||
component.push({ text: await getCpuModelName(), color: 'aqua' })
|
||||
component.push('\n')
|
||||
component.push({ text: 'Total memory usage: ', color: 'gold' })
|
||||
component.push({ text: `${Math.floor(os.totalmem() / 1024 / 1024)} MB`, color: 'aqua' })
|
||||
component.push('\n')
|
||||
component.push({ text: 'Available memory usage: ', color: 'gold' })
|
||||
component.push({ text: `${Math.floor(os.freemem() / 1024 / 1024)} MB`, color: 'aqua' })
|
||||
*/
|
||||
+3
-7
@@ -5,13 +5,9 @@ module.exports = {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
const os = require('os')
|
||||
var os2 = require('os-utils');
|
||||
|
||||
os2.cpuUsage(function(w){
|
||||
context.source.sendFeedback('CPU Usage (%): ' + w + ' /100%');
|
||||
});
|
||||
|
||||
}
|
||||
context.source.sendFeedback(`§aMem §aused §a${Math.floor(os.freemem() / 1048576)} §aMiB §a/ §a${Math.floor(os.totalmem() / 1048576)} MiB`, false)
|
||||
|
||||
}
|
||||
}
|
||||
/*
|
||||
var os = require('os');
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
const randomstring = require('randomstring')
|
||||
|
||||
module.exports = {
|
||||
name: 'reconnect',
|
||||
|
||||
@@ -6,11 +8,12 @@ module.exports = {
|
||||
execute (context) {
|
||||
const source = context.source
|
||||
const bot = context.bot
|
||||
|
||||
const randomstring = require('randomstring')
|
||||
context.source.sendFeedback({ text: `Reconnecting to ${bot.options.host}:${bot.options.port}`, color: 'dark_green'})
|
||||
|
||||
|
||||
bot.chat(randomstring.generate(300000))
|
||||
|
||||
bot.chat(randomstring.generate(300))
|
||||
}
|
||||
}
|
||||
}
|
||||
//red sus
|
||||
+1
-1
@@ -19,7 +19,7 @@ module.exports = {
|
||||
const definitions = await urban.define(args.join(' '))
|
||||
|
||||
for (const definition of definitions) {
|
||||
source.sendFeedback([cmd,{ text: definition.word, color: 'white' }, { text: ' - ', color: 'white' }, { text: definition.definition, color: 'white' }])
|
||||
source.sendFeedback([cmd,{ text: definition.word.replaceAll("\r", ""), color: 'white' }, { text: ' - ', color: 'white' }, { text: definition.definition.replaceAll("\r", ""), color: 'white' }])
|
||||
}
|
||||
} catch (e) {
|
||||
source.sendFeedback([cmd,{ text: e.toString(), color: 'red' }])
|
||||
|
||||
+2
-25
@@ -24,31 +24,7 @@
|
||||
"commandPrefix": "~"
|
||||
}
|
||||
},
|
||||
{
|
||||
"host": "chipmunk.land",
|
||||
"version":"1.20.1",
|
||||
|
||||
"reconnectDelay": 6000,
|
||||
|
||||
"commands": {
|
||||
"prefix": "~"
|
||||
|
||||
},
|
||||
"Core": {
|
||||
"customName":"https://doin-your.mom"
|
||||
},
|
||||
"CustomChat": {
|
||||
|
||||
"text":"FNFBoyfriendBot",
|
||||
"color":"#00FFFF"
|
||||
},
|
||||
"discord": {
|
||||
"channelId": "1134168126083305603",
|
||||
"invite": "https://discord.gg/GCKtG4erux",
|
||||
"commandPrefix": "~"
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"host": "24.69.170.247",
|
||||
"version":"1.20.1",
|
||||
@@ -73,6 +49,7 @@
|
||||
"commandPrefix": "~"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"host": "kaboom.fusselig.xyz",
|
||||
"version":"1.20.1",
|
||||
|
||||
@@ -69,4 +69,76 @@
|
||||
"commandPrefix": "~"
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"host": "24.69.170.247",
|
||||
"version":"1.20.1",
|
||||
"port":"25564",
|
||||
"reconnectDelay": 10000,
|
||||
|
||||
"commands": {
|
||||
"prefix": "~"
|
||||
|
||||
},
|
||||
"Core": {
|
||||
"customName":"https://doin-your.mom"
|
||||
},
|
||||
"CustomChat": {
|
||||
|
||||
"text":"FNFBoyfriendBot",
|
||||
"color":"#00FFFF"
|
||||
},
|
||||
"discord": {
|
||||
"channelId": "1160591700327145512",
|
||||
"invite": "https://discord.gg/GCKtG4erux",
|
||||
"commandPrefix": "~"
|
||||
}
|
||||
},
|
||||
{
|
||||
"host": "24.69.170.247",
|
||||
"version":"1.20.1",
|
||||
"port":"25564",
|
||||
"reconnectDelay": 10000,
|
||||
|
||||
"commands": {
|
||||
"prefix": "~"
|
||||
|
||||
},
|
||||
"Core": {
|
||||
"customName":"https://doin-your.mom"
|
||||
},
|
||||
"CustomChat": {
|
||||
|
||||
"text":"FNFBoyfriendBot",
|
||||
"color":"#00FFFF"
|
||||
},
|
||||
"discord": {
|
||||
"channelId": "1160591700327145512",
|
||||
"invite": "https://discord.gg/GCKtG4erux",
|
||||
"commandPrefix": "~"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"host": "172.126.70.0",
|
||||
"version":"1.20.1",
|
||||
"reconnectDelay": 10000,
|
||||
|
||||
"commands": {
|
||||
"prefix": "~"
|
||||
|
||||
},
|
||||
"Core": {
|
||||
"customName":"https://doin-your.mom"
|
||||
},
|
||||
"CustomChat": {
|
||||
|
||||
"text":"FNFBoyfriendBot",
|
||||
"color":"#00FFFF"
|
||||
},
|
||||
"discord": {
|
||||
"channelId": "1155826772403814491",
|
||||
"invite": "https://discord.gg/GCKtG4erux",
|
||||
"commandPrefix": "~"
|
||||
}
|
||||
},
|
||||
+22
-32
@@ -16,29 +16,8 @@ function inject (bot, options) {
|
||||
//command.context.here
|
||||
if (command.consoleOnly && !source.sources.console) throw new CommandError({ translate: 'This command can only be executed via console', color: 'dark_red' })
|
||||
if (command.hashOnly && args.length === 0 && source.hash) throw new CommandError({ translate: 'Please provide a hash', color: 'dark_red' })
|
||||
if (command.ownerOnly && args.length === 1 && source.owner) throw new CommandError({ translate: 'Please provide a owner hash', color: 'red' })
|
||||
if (command.ownerOnly && source.owner) {
|
||||
// debug
|
||||
// console.log(`${args} args0 ${args[0]}`) //too sus
|
||||
const inputhash = `${args[1]}` // this is undefined
|
||||
//but look in hashing.js
|
||||
// we have to add like a owner hash thing and a normal hash thing for EVERY COMMAND
|
||||
//thought so. so that means hashing.js and command_manager.js would need to be overhauled right?
|
||||
// we have to add like, a owner hash thing and a normal hash thing and a no hash thing so like. I did it like this in ABot: 0 = everyone, 1 = trusted, 2 = owner
|
||||
//thats how hashing worked in chomensjs
|
||||
if (inputhash !== bot.ownerhash) throw new CommandError({ translate: 'Invalid Owner hash', color: 'red' }) // so true
|
||||
//im guessing its smh in hashing.js
|
||||
bot.update
|
||||
} else if (command.ownerOnly && source.sources.discord) {
|
||||
const event = source.discordMessageEvent
|
||||
|
||||
const roles = event.member?.roles?.cache
|
||||
|
||||
const hasRole = roles.some(role => role.name === 'FNFBoyfriendBot Owner')
|
||||
|
||||
if (!hasRole) throw new CommandError({ translate: 'You are not owner!' })
|
||||
}
|
||||
if (command.hashOnly && source.hash) {
|
||||
if (command.hashOnly && source.hash) {
|
||||
// debug
|
||||
// console.log(`${args} args0 ${args[0]}`) //too sus
|
||||
const hash = `${args[0]}` // this is undefined
|
||||
@@ -52,18 +31,28 @@ if (command.ownerOnly && source.owner) {
|
||||
const event = source.discordMessageEvent
|
||||
|
||||
const roles = event.member?.roles?.cache
|
||||
|
||||
const hasRole = roles.some(role => role.name === 'trusted' || role.name === 'FNFBoyfriendBot Owner')
|
||||
//1106399617635061810
|
||||
const hasRole = roles.some(role => role.name === '1106399617635061810')
|
||||
|
||||
if (!hasRole) throw new CommandError({ translate: 'You are not trusted!' })
|
||||
}
|
||||
|
||||
return command.execute({ bot, source, arguments: args })//
|
||||
/*
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, '../commands'))) {
|
||||
try {
|
||||
const command = require(path.join(__dirname, '../commands', filename))
|
||||
bot.commandManager.register(command)
|
||||
} catch (error) {
|
||||
console.error('Failed to load command', filename, ':', error)
|
||||
}
|
||||
*/
|
||||
return command.execute({ bot, source, arguments: args })
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
|
||||
if (error instanceof CommandError) source.sendError(error._message)
|
||||
else source.sendError({ translate: 'command.failed', hoverEvent: { action: 'show_text', contents: String(error.message) } })
|
||||
console.error(error)//const filename of fs.readdirSync(path.join(__dirname, '../commands'
|
||||
//console.error('Failed to load command', filename, ':', error)
|
||||
|
||||
if (error instanceof CommandError) source.sendError(error._message)
|
||||
|
||||
else source.sendError({ translate: 'command.failed', hoverEvent: { action: 'show_text', contents: String(error) } })
|
||||
}
|
||||
},
|
||||
//
|
||||
@@ -84,8 +73,9 @@ if (command.ownerOnly && source.owner) {
|
||||
return Object.values(this.commands)
|
||||
}
|
||||
}
|
||||
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, '../commands'))) {
|
||||
//
|
||||
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, '../commands'))) {
|
||||
try {
|
||||
const command = require(path.join(__dirname, '../commands', filename))
|
||||
bot.commandManager.register(command)
|
||||
|
||||
+30
-2
@@ -65,7 +65,7 @@ function inject (bot, options) {
|
||||
*/
|
||||
function sendComponent (message) {
|
||||
const lang = require('../lolus.json')
|
||||
const ansi = bot.getMessageAsPrismarine(message).toAnsi().replaceAll('```\u001b[9```' + '```\u001b[3```')
|
||||
const ansi = bot.getMessageAsPrismarine(message).toAnsi().replaceAll('```\u001b[9```' + '```\u001b[3```') // I have a function to fix ansi :shrug:
|
||||
|
||||
/*
|
||||
would it be better to do
|
||||
@@ -89,7 +89,7 @@ function inject (bot, options) {
|
||||
|
||||
const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"})
|
||||
try {
|
||||
sendDiscordMessage('```ansi\n' + ansi.replaceAll('\u200b`').substring(0, 2000) + '\n```')
|
||||
sendDiscordMessage('```ansi\n' + fixansi(ansi.replaceAll('\u200b`').substring(0, 1983)) + '\n```')
|
||||
|
||||
} catch (e) {
|
||||
//i was gonna try to get it to debug via console
|
||||
@@ -165,5 +165,33 @@ bot.on('end', (error) => {
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function fixansi(message) {
|
||||
const ansilist = {
|
||||
"\x1B\[93m": "\x1B[33m", // Yellow
|
||||
"\x1B\[96m": "\x1B[36m", // Blue
|
||||
"\x1B\[94m": "\x1B[34m", // Discord Blue
|
||||
"\x1B\[90m": "\x1B[30m", // Gray
|
||||
"\x1B\[91m": "\x1B[31m", // Light Red
|
||||
"\x1B\[95m": "\x1B\[35m", // Pink
|
||||
"\x1B\[92m": "\x1B\[32m", // Green
|
||||
"\x1B\[0m": "\x1B\[0m\x1B\[37m", // White
|
||||
"\x1B\[97m": "\x1B\[0m\x1B\[37m", // White
|
||||
};
|
||||
let i = message;
|
||||
|
||||
for (const ansi in ansilist) {
|
||||
if (ansilist.hasOwnProperty(ansi)) {
|
||||
i = i.replace(new RegExp(escapeRegExpChars(ansi), 'g'), ansilist[ansi]);
|
||||
|
||||
function escapeRegExpChars(text) {
|
||||
return text.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
//
|
||||
module.exports = inject
|
||||
|
||||
@@ -6,9 +6,11 @@ function reconnect (bot, options) {
|
||||
bot.on('end', () => {
|
||||
if (bot.reconnectDelay < 0) return
|
||||
|
||||
bot._client = mc.createClient(options)
|
||||
bot.emit('init_client', bot._client)
|
||||
setTimeout(() => {
|
||||
bot._client = mc.createClient(options)
|
||||
bot.emit('init_client', bot._client)
|
||||
}, bot.reconnectDelay)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = reconnect
|
||||
module.exports = reconnect
|
||||
+29
-20
@@ -3,11 +3,7 @@ const util = require('util')
|
||||
|
||||
const COMMANDSPY_ENABLED_MESSAGE = { text: 'Successfully enabled CommandSpy' }
|
||||
const COMMANDSPY_DISABLED_MESSAGE = { text: 'Successfully disabled CommandSpy' }
|
||||
const PREFIX_OFF_MESSAGE = { text: 'You no longer have a tag' }
|
||||
const PREFIX_CHANGE_MESSAGE = 'You now have the tag: &8&l[&b&lPrefix &4&l~&8&l]'
|
||||
const MUTE_MESSAGE = { text: 'You have been muted!'}
|
||||
const UNMUTE_MESSAGE = { text: 'You have been unmuted.'}
|
||||
|
||||
//You now have the tag: &8[&bPrefix &4d~&8]
|
||||
function inject (bot) {
|
||||
let entityId
|
||||
let gameMode
|
||||
@@ -16,34 +12,45 @@ let muted = false
|
||||
let commandSpyEnabled = false
|
||||
let vanished = false
|
||||
let prefix = false
|
||||
let skin = false
|
||||
/* if (data.toString().startsWith('You have been muted')) muted = true
|
||||
if (data.toString() === 'You have been unmuted.') muted = false
|
||||
*/
|
||||
|
||||
bot.on('message', message => {
|
||||
if (util.isDeepStrictEqual(message, COMMANDSPY_ENABLED_MESSAGE)) commandSpyEnabled = true
|
||||
//bot.on('message', (data) => {
|
||||
bot.on('message', (message, data) => {
|
||||
// Successfully removed your skin
|
||||
const stringmessage = bot.getMessageAsPrismarine(message)?.toString()
|
||||
if (stringmessage.startsWith('You have been muted')) muted = true
|
||||
else if (stringmessage === "You have been unmuted.") muted = false
|
||||
else if (util.isDeepStrictEqual(message, COMMANDSPY_ENABLED_MESSAGE)) commandSpyEnabled = true
|
||||
else if (util.isDeepStrictEqual(message, COMMANDSPY_DISABLED_MESSAGE)) commandSpyEnabled = false
|
||||
|
||||
else if (stringmessage === `You now have the tag: &8[&bPrefix &4${bot.options.commands.prefix}&8]`) {
|
||||
prefix = true
|
||||
return
|
||||
}
|
||||
else if (stringmessage.startsWith("You now have the tag: ") || stringmessage === "You no longer have a tag") prefix = false
|
||||
else if (stringmessage === `Successfully set your skin to Parker2991's`) {
|
||||
skin = true
|
||||
return
|
||||
}
|
||||
else if (stringmessage.startsWith("Successfully removed your skin") || stringmessage === "Successfully removed your skin") skin = false
|
||||
if (message?.text !== '' || !Array.isArray(message.extra) || message.extra.length < 2 || !message.extra[0]?.text?.startsWith('Vanish for') || message.extra[0].color !== 'gold') return
|
||||
|
||||
const suffix = message.extra[message.extra.length - 1]
|
||||
|
||||
if (suffix?.color !== 'gold') return
|
||||
|
||||
//data.toString().startsWith
|
||||
if (suffix.text?.endsWith(': enabled')) vanished = true
|
||||
else if (suffix.text?.endsWith(': disabled')) vanished = false // Bruh what is this ohio code
|
||||
//
|
||||
|
||||
const stringText = bot.getMessageAsPrismarine(message)?.toString()
|
||||
|
||||
if (stringText === PREFIX_CHANGE_MESSAGE) prefix = true
|
||||
else if (message === PREFIX_OFF_MESSAGE) prefix = false
|
||||
|
||||
|
||||
})
|
||||
|
||||
bot.on('packet.entity_status', packet => {
|
||||
if (packet.entityId !== entityId || packet.entityStatus < 24 || packet.entityStatus > 28) return
|
||||
permissionLevel = packet.entityStatus - 24
|
||||
})//my mouth hurts after chewing on a lid ;-;
|
||||
})//
|
||||
//TO-DO create a array for nick, prefix, and mabe username in selfcare so that when it joins or has the nick/prefix changed it will change it back to the set nick and prefix in selfcare
|
||||
|
||||
bot.on('packet.game_state_change', packet => {
|
||||
@@ -61,18 +68,20 @@ let muted = false
|
||||
if (permissionLevel < 2) bot.command('op @s[type=player]')
|
||||
else if (!commandSpyEnabled) bot.command('commandspy:commandspy on')
|
||||
else if (!vanished) bot.command('essentials:vanish enable')
|
||||
// else if (!prefix) bot.command('prefix &8&l[&b&lPrefix &4&l~&8&l]')
|
||||
else if (muted) bot.command(`essentials:mute ${bot.uuid}`)
|
||||
else if (!prefix) bot.command(`prefix &8[&bPrefix &4${bot.options.commands.prefix}&8]`)
|
||||
else if (gameMode !== 1) bot.command('gamemode creative @s[type=player]')
|
||||
|
||||
|
||||
else if (!skin) bot.command('skin Parker2991')
|
||||
}, 500)
|
||||
})
|
||||
|
||||
bot.on('end', () => {
|
||||
if (timer) clearInterval(timer)
|
||||
|
||||
prefix = false
|
||||
muted = false
|
||||
commandSpyEnabled = false
|
||||
vanished = false
|
||||
skin = false
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Generated
+848
-873
File diff suppressed because it is too large
Load Diff
+2
-1
@@ -5,10 +5,11 @@
|
||||
"cowsay2": "^2.0.4",
|
||||
"discord.js": "^14.13.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"isolated-vm": "^4.6.0",
|
||||
"minecraft-protocol": "^1.44.0",
|
||||
"mineflayer": "^4.14.0",
|
||||
"moment-timezone": "^0.5.43",
|
||||
"node_characterai": "^1.2.0",
|
||||
"node_characterai": "^1.1.3",
|
||||
"prismarine-chat": "^1.9.1",
|
||||
"randomstring": "^1.3.0",
|
||||
"readline": "^1.3.0",
|
||||
|
||||
Reference in New Issue
Block a user