FNFBoyfriendBot v5.0.7c
This commit is contained in:
parent
5000abf90d
commit
dc7110af11
58 changed files with 1342 additions and 810 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,3 +4,5 @@ midis
|
|||
config.js
|
||||
.env
|
||||
amog
|
||||
src/commands/kick.js
|
||||
src/modules/exploits.js
|
||||
|
|
11
README.md
11
README.md
|
@ -0,0 +1,11 @@
|
|||
exploits module was gitignored to prevent exploit leaks so the bot will not being able to run some commands without it
|
||||
please make a file called exploits.js in modules and add this
|
||||
```js
|
||||
function exploits (bot, options, context) {
|
||||
bot.exploits = {
|
||||
hoe: ''
|
||||
}
|
||||
}
|
||||
module.exports = exploits;
|
||||
```
|
||||
also src/commands/kick.js was gitignored so exploits wont be leaked
|
2
main.sh
2
main.sh
|
@ -1,5 +1,5 @@
|
|||
while true; do
|
||||
echo "Starting FNFBoyfriendBot...."
|
||||
node --max-old-space-size=1000 --trace-warnings src/index.js
|
||||
node --max-old-space-size=1000 src/index.js
|
||||
sleep 1
|
||||
done
|
||||
|
|
16
package-lock.json
generated
16
package-lock.json
generated
|
@ -15,12 +15,14 @@
|
|||
"dotenv": "^16.4.5",
|
||||
"final-stream": "^2.0.4",
|
||||
"http-proxy-agent": "^7.0.2",
|
||||
"https": "^1.0.0",
|
||||
"isolated-vm": "^4.7.2",
|
||||
"matrix-js-sdk": "^31.6.1",
|
||||
"minecraft-protocol": "^1.47.0",
|
||||
"moment-timezone": "^0.5.45",
|
||||
"prismarine-chat": "^1.10.0",
|
||||
"prismarine-registry": "^1.7.0",
|
||||
"querystring": "^0.2.1",
|
||||
"readline": "^1.3.0",
|
||||
"stream": "^0.0.2",
|
||||
"urban-dictionary": "git+https://code.chipmunk.land/chipmunkMC/urban-dictionary.git",
|
||||
|
@ -1012,6 +1014,11 @@
|
|||
"npm": ">=1.3.7"
|
||||
}
|
||||
},
|
||||
"node_modules/https": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/https/-/https-1.0.0.tgz",
|
||||
"integrity": "sha512-4EC57ddXrkaF0x83Oj8sM6SLQHAWXw90Skqu2M4AEWENZ3F02dFJE/GARA8igO79tcgYqGrD7ae4f5L3um2lgg=="
|
||||
},
|
||||
"node_modules/ieee754": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||
|
@ -1710,6 +1717,15 @@
|
|||
"node": ">=0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/querystring": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.1.tgz",
|
||||
"integrity": "sha512-wkvS7mL/JMugcup3/rMitHmd9ecIGd2lhFhK9N3UUQ450h66d1r3Y9nvXzQAW1Lq+wyx61k/1pfKS5KuKiyEbg==",
|
||||
"deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.",
|
||||
"engines": {
|
||||
"node": ">=0.4.x"
|
||||
}
|
||||
},
|
||||
"node_modules/railroad-diagrams": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz",
|
||||
|
|
|
@ -10,12 +10,14 @@
|
|||
"dotenv": "^16.4.5",
|
||||
"final-stream": "^2.0.4",
|
||||
"http-proxy-agent": "^7.0.2",
|
||||
"https": "^1.0.0",
|
||||
"isolated-vm": "^4.7.2",
|
||||
"matrix-js-sdk": "^31.6.1",
|
||||
"minecraft-protocol": "^1.47.0",
|
||||
"moment-timezone": "^0.5.45",
|
||||
"prismarine-chat": "^1.10.0",
|
||||
"prismarine-registry": "^1.7.0",
|
||||
"querystring": "^0.2.1",
|
||||
"readline": "^1.3.0",
|
||||
"stream": "^0.0.2",
|
||||
"urban-dictionary": "git+https://code.chipmunk.land/chipmunkMC/urban-dictionary.git",
|
||||
|
|
102
prototyping-crap/default.yml
Normal file
102
prototyping-crap/default.yml
Normal file
|
@ -0,0 +1,102 @@
|
|||
# i bet theres gonna be some whiny assholes complaining about this because config is .yml and not .js since most java bots use .yml and no other
|
||||
# javascript bot uses .yml, all i got to say is go cry somewhere else about it you wont change my mind, you little shit,
|
||||
# it looks cleaner than config.js - Parker2991
|
||||
|
||||
|
||||
# FNFBoyfriendBot Config
|
||||
# commands
|
||||
Commands:
|
||||
prefixes:
|
||||
- '!'
|
||||
colors:
|
||||
discord:
|
||||
error: "#ff0000"
|
||||
embed: "#00ffff"
|
||||
help:
|
||||
pub_lickColor: "#00FFFF"
|
||||
t_rustedColor: "dark_purple"
|
||||
own_herColor: "dark_red"
|
||||
error: "#FF0000"
|
||||
|
||||
# core
|
||||
Core:
|
||||
JSON: ""
|
||||
area:
|
||||
start:
|
||||
x: 0
|
||||
y: 0
|
||||
z: 0
|
||||
end:
|
||||
x: 15
|
||||
y: 0
|
||||
z: 15
|
||||
|
||||
#validation
|
||||
validation:
|
||||
discord:
|
||||
roles:
|
||||
trusted: "trusted"
|
||||
owner: "owner"
|
||||
channelId: "channel validation here" # for sending hashes to discord if someone is too lazy to add validation for the bot to their client
|
||||
trustedKey: "trusted key here"
|
||||
ownerKey: "owner key here"
|
||||
|
||||
#discord
|
||||
Discord:
|
||||
enabled: false
|
||||
invite: "https://discord.gg/GCKtG4erux"
|
||||
commandPrefix: "!"
|
||||
presence:
|
||||
name: "amongus"
|
||||
type: 4
|
||||
status: "online"
|
||||
|
||||
# console
|
||||
console:
|
||||
filelogging: false
|
||||
prefix: "c."
|
||||
|
||||
# bots
|
||||
bots :
|
||||
# isKaboom = running the bot in kaboom
|
||||
# isCreayun = running the bot in creayun
|
||||
# useChat = running the bot in chat and not core
|
||||
# usernameGen = regenerating the bot's username every join
|
||||
# endcredits = the bot advertising
|
||||
# serverName = the name of the server ofc
|
||||
# Console.ratelimit = the number of messages that the bot can read in a few seconds before rejoining this is used to prevent spam, i do not recommend setting it to Infinity
|
||||
# selfcare.interval = selfcare interval duh
|
||||
- host: "localhost"
|
||||
useChat: false
|
||||
isKaboom: true
|
||||
isCreayun: false
|
||||
usernameGen: true
|
||||
username: "FNFBoyfriendBot"
|
||||
version: "1.20.2"
|
||||
serverName: "localhost"
|
||||
reconnectDelay: 6000
|
||||
endcredits: false
|
||||
Console:
|
||||
enabled: true
|
||||
ratelimit: 25
|
||||
Core:
|
||||
enabled: true
|
||||
interval: 180000
|
||||
discord:
|
||||
channelId: ""
|
||||
log: false
|
||||
matrix:
|
||||
roomId: ""
|
||||
selfcare:
|
||||
vanished: true
|
||||
unmuted: true
|
||||
prefix: true
|
||||
cspy: true
|
||||
tptoggle: true
|
||||
skin: true
|
||||
gmc: true
|
||||
op: true
|
||||
nickname: true
|
||||
username: true
|
||||
god: true
|
||||
interval: 500
|
94
prototyping-crap/index.js
Normal file
94
prototyping-crap/index.js
Normal file
|
@ -0,0 +1,94 @@
|
|||
const CommandError = require('./CommandModules/command_error.js');
|
||||
const util = require("util");
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const parseYaml = require('js-yaml')
|
||||
/* if (!fs.existsSync('config.js')) {
|
||||
console.log('Config not found creating config from default.js');
|
||||
fs.copyFileSync(
|
||||
path.join(__dirname, 'default.yml'),
|
||||
path.join(__dirname, 'config.js'),
|
||||
);
|
||||
}; */
|
||||
if (!fs.existsSync('config.yml')) {
|
||||
console.log('Config not found creating config from default.yml');
|
||||
fs.copyFileSync(
|
||||
path.join(__dirname, 'default.yml'),
|
||||
path.join(__dirname, 'config.yml'),
|
||||
);
|
||||
};
|
||||
// const config = require(`../config.js`);
|
||||
try {
|
||||
config = parseYaml.load(fs.readFileSync('config.yml', 'utf8'));
|
||||
console.log(config)
|
||||
} catch (e) {
|
||||
console.log(e.toString())
|
||||
}
|
||||
const { createBot } = require('./bot.js');
|
||||
const readline = require("readline");
|
||||
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
});
|
||||
|
||||
function load() {
|
||||
require("dotenv").config();
|
||||
const bots = [];
|
||||
const core = config.Core;
|
||||
const commands = config.Commands;
|
||||
const Console = config.console;
|
||||
const tellrawtag = config.tellrawTag;
|
||||
// const helptheme = config.helpTheme;
|
||||
const discord = config.Discord;
|
||||
const matrix = config.matrix;
|
||||
const validation = config.validation;
|
||||
for (const options of config.bots) {
|
||||
const bot = createBot(options);
|
||||
bots.push(bot);
|
||||
bot.bots = bots;
|
||||
bot.Core = core;
|
||||
bot.Commands = commands;
|
||||
bot.Console = Console;
|
||||
bot.Discord = discord;
|
||||
bot.tellrawTag = tellrawtag;
|
||||
// bot.helpTheme = helptheme;
|
||||
bot.matrix = matrix;
|
||||
bot.validation = validation;
|
||||
bot.options.username;
|
||||
bot.loadModule = (module) => module(bot, options);
|
||||
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, "modules"))) {
|
||||
try {
|
||||
const module = require(path.join(__dirname, "modules", filename));
|
||||
bot.loadModule(module);
|
||||
} catch (error) {
|
||||
console.log(
|
||||
"Failed to load module",
|
||||
filename,
|
||||
":",
|
||||
error,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bot.console.useReadlineInterface(rl);
|
||||
|
||||
|
||||
try {
|
||||
bot.on("error", error => {
|
||||
bot?.console?.warn(error.toString())
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error.stack);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
process.on("uncaughtException", (e) => {
|
||||
//console.log(e.stack)
|
||||
});
|
||||
|
||||
load()
|
100
src/bot.js
100
src/bot.js
|
@ -3,20 +3,19 @@ const { EventEmitter } = require("node:events");
|
|||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const util = require("node:util");
|
||||
|
||||
const usernameGen = require('./util/usernameGen');
|
||||
require("events").EventEmitter.defaultMaxListeners = Infinity;
|
||||
const ChatMessage = require('prismarine-chat')('1.20.2')
|
||||
function createBot(options = {}) {
|
||||
const bot = new EventEmitter();
|
||||
// const rs = require("randomstring");
|
||||
|
||||
// Set some default values in options
|
||||
bot.options = {
|
||||
host: options.host ??= "localhost",
|
||||
username: options.username ??= "FNFBoyfriendBot",
|
||||
hideErrors: options.hideErrors ??= true, // HACK: Hide errors by default as a lazy fix to console being spammed with the console
|
||||
version: options.version ??= '1.20.2',
|
||||
|
||||
},
|
||||
host: options.host ??= "localhost",
|
||||
username: options.username ??= usernameGen(),
|
||||
hideErrors: options.hideErrors ??= true, // HACK: Hide errors by default as a lazy fix to console being spammed with the console
|
||||
version: options.version ??= '1.20.2',
|
||||
},
|
||||
|
||||
bot.options = options;
|
||||
|
||||
|
@ -24,66 +23,57 @@ function createBot(options = {}) {
|
|||
bot.on("init_client", (client) => {
|
||||
client.on("packet", (data, meta) => {
|
||||
bot.emit("packet", data, meta);
|
||||
try{
|
||||
bot.emit('packet.' + meta.name, data)
|
||||
} catch(e) {
|
||||
if(e.toString() === 'RangeError: Invalid string length'){
|
||||
bot._client.chat('Leaving to prevent crashing')
|
||||
bot._client.end()
|
||||
} else {
|
||||
console.log(e)
|
||||
}
|
||||
bot.emit('packet.' + meta.name, data)
|
||||
});
|
||||
const timer = setInterval(() => {
|
||||
if (!bot.options.endcredits) {
|
||||
return
|
||||
} else {
|
||||
bot.chat(`Join the FNFBoyfriendBot discord ${bot.Discord.invite}`)
|
||||
}
|
||||
});
|
||||
const timer = setInterval(() => {
|
||||
if(!bot.options.endcredits){
|
||||
return
|
||||
}else{
|
||||
bot.chat(`Join the FNFBoyfriendBot discord ${bot.options.discord.invite}`)
|
||||
}
|
||||
}, 280000)
|
||||
|
||||
client.on("login", async function (data) {
|
||||
}, 280000)
|
||||
client.on("login", async function (data) {
|
||||
bot.uuid = client.uuid;
|
||||
bot.username = client.username;
|
||||
bot.port = bot.options.port;
|
||||
bot.version = bot.options.version;
|
||||
if (bot.options.isCreayun) {
|
||||
bot.command('server creative')
|
||||
}
|
||||
try {
|
||||
var day = new Date().getDay()
|
||||
if (day === 5) {
|
||||
bot.sendFeedback({text:"Gettin' freaky on a Friday Night!"})
|
||||
} else {
|
||||
bot.sendFeedback({text:`${process.env.buildstring}`})
|
||||
}
|
||||
}catch(e){
|
||||
}
|
||||
timer
|
||||
})
|
||||
if (!bot.options.isCreayun) {
|
||||
if (bot.options.isCreayun) {
|
||||
}
|
||||
var day = new Date().getDay()
|
||||
if (day === 5) {
|
||||
bot.chat("Gettin' freaky on a Friday Night!")
|
||||
} else {
|
||||
bot.chat(`${bot.getMessageAsPrismarine(process.env.buildstring)?.toMotd().replaceAll('§','&')}`)
|
||||
}
|
||||
timer
|
||||
}
|
||||
if (bot.options.useChat) {
|
||||
bot?.console?.warn(`useChat is active for ${bot.options.host} the bot will not be able to run commands in core`)
|
||||
} else if (bot.options.isCreayun) {
|
||||
bot?.console?.info(`Creayun mode is active for ${bot.options.host} please not that the bot will not read kaboom commands and messages when Creayun mode is active`)
|
||||
}
|
||||
})
|
||||
client.on("end", (reason) => {
|
||||
bot.emit("end", reason);
|
||||
bot.console.warn(`Disconnected: ${reason.toString()}`);
|
||||
bot.cloop.clear()
|
||||
bot.memusage.off()
|
||||
bot.tps.off()
|
||||
bot.bruhifyText = ''
|
||||
clearInterval(timer)
|
||||
bot?.discord?.channel?.send('``Disconnected:' + reason.toString() + '``' )
|
||||
|
||||
});
|
||||
bot.emit("end", reason);
|
||||
bot.console.warn(`Disconnected: ${reason.toString()}`);
|
||||
bot.cloop.clear()
|
||||
bot.memusage.off()
|
||||
bot.tps.off()
|
||||
bot.bruhifyText = ''
|
||||
clearInterval(timer)
|
||||
bot?.discord?.channel?.send('``Disconnected:' + JSON.stringify(reason) + '``' )
|
||||
});
|
||||
|
||||
client.on("disconnect", (reason) => {
|
||||
bot.emit("disconnect", reason);
|
||||
bot.console.warn(`Disconnected: ${reason.toString()}`);
|
||||
bot?.discord?.channel?.send('``Disconnected:' + reason.toString() + '``' )
|
||||
|
||||
bot.console.warn(`Disconnected: ${JSON.stringify(reason)}`);
|
||||
bot?.discord?.channel?.send('``Disconnected:' + reason.toString() + '``' )
|
||||
});
|
||||
|
||||
client.on("kick_disconnect", (reason) => {
|
||||
bot.emit("kick_disconnect", reason);
|
||||
bot.console.warn(`Disconnected: ${reason.toString()}`);
|
||||
bot.console.warn(`Disconnected: ${JSON.stringify(reason)}`);
|
||||
bot?.discord?.channel?.send('``Disconnected:' + reason.toString() + '``')
|
||||
});
|
||||
client.on("keep_alive", ({ keepAliveId }) => {
|
||||
|
|
|
@ -31,3 +31,4 @@ const stringify = message => new ChatMessage(message).toString()
|
|||
//k
|
||||
// getting the fake parker out of kaboom
|
||||
// pcrashed
|
||||
|
||||
|
|
|
@ -10,11 +10,13 @@ usage:["smexy text here"],
|
|||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
const message = context.arguments.join(' ')
|
||||
|
||||
if (bot.options.isCreayun) {
|
||||
throw new CommandError('isCreayun is active!')
|
||||
} else {
|
||||
bot.bruhifyText = args.join(' ')
|
||||
|
||||
bot.sendFeedback(JSON.stringify(bot.bruhifyText))
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,6 +70,13 @@ const bots = [
|
|||
foundation: '4/22/24',
|
||||
exclaimer:'a lot of clean up adding shit and more',
|
||||
},
|
||||
{//
|
||||
name: { text: 'v5.0.7c', color: 'gold', bold:false },
|
||||
authors: ['Ski'],
|
||||
|
||||
foundation: '5/1/24',
|
||||
exclaimer:'added discord execute, redone the website command, added attachments for discord',
|
||||
},
|
||||
]//
|
||||
//back
|
||||
|
||||
|
|
|
@ -181,6 +181,6 @@ break
|
|||
default:
|
||||
throw new CommandError('Invalid argument')
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ usage:[
|
|||
|
||||
const bot = context.bot
|
||||
|
||||
const player = context.source.player.profile.name
|
||||
const uuid = context.source.player.uuid
|
||||
const player = context?.source?.player?.profile?.name
|
||||
const uuid = context?.source?.player?.uuid
|
||||
const message = context.arguments.join(' ') // WHY SECTION SIGNS!!
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
|
@ -54,9 +54,9 @@ const component = {
|
|||
},
|
||||
|
||||
|
||||
context.source.player.displayName ?? context.source.player.profile.name,
|
||||
context?.source?.player?.displayName ?? context?.source?.player?.profile?.name,
|
||||
{
|
||||
text:`, uuid: ${uuid ?? context.source.player.uuid } , `
|
||||
text:`, uuid: ${uuid ?? context?.source?.player?.uuid } , `
|
||||
},
|
||||
//entry.displayName
|
||||
{text:`Argument: ${args.slice(1).join(' ')}`}
|
||||
|
@ -91,13 +91,13 @@ bot.tellraw([component])
|
|||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
default:
|
||||
if (bot.options.Core.CorelessMode){
|
||||
if (bot.options.isCreayun){
|
||||
bot.chat('&4Invalid action')
|
||||
sleep(500)
|
||||
bot.chat('the usages are msg and error')
|
||||
// bot.chat('the usages are msg and error')
|
||||
}else{
|
||||
bot.sendError([{ text: 'Invalid action', color: 'dark_red', bold:false }])
|
||||
bot.sendError([{ text: 'the usages are msg and error', color: 'gray', bold:false }])
|
||||
// bot.sendError([{ text: 'the usages are msg and error', color: 'gray', bold:false }])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,23 +2,20 @@ const CommandError = require('../CommandModules/command_error')
|
|||
|
||||
module.exports = {
|
||||
name: 'crash',
|
||||
description:['crashes a server'],
|
||||
trustLevel: 1,
|
||||
aliases:['crashserver', '69'],//69 cuz yes
|
||||
usage:["exe","give"],
|
||||
execute (context) {
|
||||
|
||||
description:['crashes a server'],
|
||||
trustLevel: 1,
|
||||
aliases:['crashserver', '69'],//69 cuz yes
|
||||
usage:["exe","give"],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
// throw new CommandError('temp disabled')
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
if (!args && !args[0] && !args[1] && !args[2]) return
|
||||
|
||||
if(!bot.options.Core.enabled){
|
||||
throw new CommandError('&4Coreless mode is active can not execute command!')
|
||||
}else {
|
||||
switch (args[1] ?? (!source.sources.console && args[0])) {
|
||||
case `exe`:
|
||||
if (bot.options.useChat ?? bot.options.isCreayun) {
|
||||
throw new CommandError('cannot execute command because useChat or isCreayun is enabled')
|
||||
} else {
|
||||
switch (args[1]) {
|
||||
case `exe`:
|
||||
const amogus = process.env['amogus']
|
||||
bot.core.run(`${amogus}`)
|
||||
break
|
||||
|
@ -26,31 +23,9 @@ const args = context.arguments
|
|||
const amogus2 = process.env['amogus2']
|
||||
bot.core.run(`${amogus2}`)
|
||||
break
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
default:
|
||||
const cmd = {//test.js
|
||||
translate: '[%s] ',
|
||||
bold: false,
|
||||
color: 'white',
|
||||
with: [
|
||||
{ color: 'gold', text: 'crash'},
|
||||
]
|
||||
}
|
||||
if(source.sources.console){
|
||||
bot.console.info([cmd, { text: 'Invalid action', color: 'dark_red', bold:false }])
|
||||
// bot.console.info([cmd, { text: 'the args are give, and exe', color: 'green', bold:false }])
|
||||
}else{
|
||||
bot.sendError([cmd, { text: 'Invalid action', color: 'dark_red', bold:false }])
|
||||
// bot.sendError([cmd, { text: 'the args are give, and exe', color: 'green', bold:false }])
|
||||
bot.sendError([{ text: 'Invalid action', color: 'dark_red', bold:false }])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//what is wi
|
||||
// IDK
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
module.exports = {
|
||||
name: 'echo',
|
||||
description:['make me say something in chat'],
|
||||
aliases:['chatsay'],
|
||||
trustLevel: 0,
|
||||
usage:[
|
||||
"<command/message>",
|
||||
],
|
||||
description:['make me say something in chat'],
|
||||
aliases:['chatsay'],
|
||||
trustLevel: 0,
|
||||
usage:[
|
||||
"<command/message>",
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
|
@ -16,10 +16,9 @@ usage:[
|
|||
}
|
||||
bot.chat(message)
|
||||
|
||||
},
|
||||
|
||||
discordExecute(context) {
|
||||
const bot = context.bot
|
||||
},
|
||||
discordExecute(context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
if (message.startsWith('/')) {
|
||||
bot.command(message.substring(1))
|
||||
|
@ -27,5 +26,5 @@ discordExecute(context) {
|
|||
}
|
||||
|
||||
bot.chat(message)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,56 +1,44 @@
|
|||
const CommandError = require('../CommandModules/command_error')
|
||||
const ivm = require('isolated-vm');
|
||||
const isolate = new ivm.Isolate({ memoryLimit: 128 });
|
||||
const { stylize } = require('../util/eval_colors')
|
||||
const util = require('util')
|
||||
const { stylize } = require('../util/eval_colors');
|
||||
const options = {
|
||||
timeout: 1000,
|
||||
}
|
||||
const util = require('util');
|
||||
module.exports = {
|
||||
name: 'eval',
|
||||
description:[''],
|
||||
aliases:[],
|
||||
trustLevel: 0,
|
||||
usage:[
|
||||
"<command/message>",
|
||||
],
|
||||
description:['run code via isolated vm, exclaimer: amcforum members had a shitfit over this command'],
|
||||
aliases:['ivm'],
|
||||
trustLevel: 0,
|
||||
usage:[
|
||||
"<code>",
|
||||
],
|
||||
async execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
|
||||
|
||||
// Create a new isolate limited to 128MB
|
||||
const ivm = require('isolated-vm');
|
||||
const isolate = new ivm.Isolate({ memoryLimit: 128 });
|
||||
|
||||
// Create a new context within this isolate. Each context has its own copy of all the builtin
|
||||
// Objects. So for instance if one context does Object.prototype.foo = 1 this would not affect any
|
||||
// other contexts.
|
||||
const cOntext = isolate.createContextSync();
|
||||
|
||||
// Get a Reference{} to the global object within the context.
|
||||
const jail = cOntext.global;
|
||||
|
||||
// This makes the global object available in the context as `global`. We use `derefInto()` here
|
||||
// because otherwise `global` would actually be a Reference{} object in the new isolate.
|
||||
jail.setSync('global', jail.derefInto());
|
||||
|
||||
// We will create a basic `log` function for the new isolate to use.
|
||||
jail.setSync('log', function(...args) {
|
||||
console.log(...args);
|
||||
});
|
||||
|
||||
// And let's test it out:
|
||||
cOntext.evalSync('let e');
|
||||
// > hello world
|
||||
|
||||
const hostile = isolate.compileScriptSync(`${args.join(' ')}`)
|
||||
//console.log(await hostile)
|
||||
console.log(hostile.run(`e`))
|
||||
|
||||
// Using the async version of `run` so that calls to `log` will get to the main node isolate
|
||||
|
||||
(`${hostile.run(context).catch(err => console.error(err))}`)
|
||||
const script = await args.join(' '); // Ensure script is a string
|
||||
//let isolate = new ivm.Isolate({ memoryLimit: 50, options, global, cachedData: true })
|
||||
//const evalcontext = await isolate.createContextSync({options});
|
||||
let isolate = new ivm.Isolate({ memoryLimit: 50, options, global, cachedData: true })
|
||||
const evalcontext = await isolate.createContextSync({options});
|
||||
(async () => {
|
||||
try {
|
||||
let result = await (await evalcontext).evalSync(script, options, {
|
||||
timeout: 1000
|
||||
})
|
||||
if (bot.options.useChat) {
|
||||
bot.chat(bot.getMessageAsPrismarine([{ text: util.inspect(result, { stylize }).substring(0, 256) }])?.toMotd().replaceAll('§','&'))
|
||||
} else {
|
||||
bot.sendFeedback([{ text: util.inspect(result, { stylize }) }]);
|
||||
}
|
||||
} catch (reason) {
|
||||
bot.sendError(`${reason.toString()}`)
|
||||
}
|
||||
})()
|
||||
|
||||
},
|
||||
discordExecute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
}
|
||||
discordExecute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ module.exports = {
|
|||
|
||||
const args = context.arguments
|
||||
|
||||
const key = process.env['FNFBoyfriendBot_Owner_key']
|
||||
const key = bot.validation.keys.ownerKey
|
||||
//al
|
||||
const time = Math.floor(Date.now() / 11000)
|
||||
|
||||
|
@ -34,7 +34,12 @@ module.exports = {
|
|||
clickevent: { action:"open_url", value: "https://doin-your.mom"}
|
||||
}
|
||||
|
||||
context.bot.tellraw(customchat)
|
||||
// context.bot.tellraw(customchat)
|
||||
if (bot.options.useChat ?? bot.options.isCreayun) {
|
||||
bot.chat(command)
|
||||
} else {
|
||||
bot.tellraw(customchat)
|
||||
}
|
||||
}
|
||||
}
|
||||
//const interval = setInterval(() => {
|
||||
|
@ -42,4 +47,4 @@ module.exports = {
|
|||
// bot.ownerHash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + config.keys.ownerHashKey).digest('hex').substring(0, 16)
|
||||
|
||||
|
||||
// Make a copy of this
|
||||
// Make a copy of this
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
const CommandError = require('../CommandModules/command_error')
|
||||
const {EmbedBuilder } = require('discord.js')
|
||||
const { EmbedBuilder } = require('discord.js')
|
||||
module.exports = {
|
||||
name: 'help',
|
||||
aliases:['heko', 'cmd', '?', 'commands', 'cmds' ],
|
||||
|
@ -8,23 +7,20 @@ module.exports = {
|
|||
usage:'[COMMAND]',
|
||||
async execute (context) {
|
||||
const bot = context.bot
|
||||
const commandList = []
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
|
||||
|
||||
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
const CommandManager = bot.commandManager
|
||||
const cmd = {
|
||||
translate: '[%s] ',
|
||||
const commandList = []
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const CommandManager = bot.commandManager
|
||||
const cmd = {
|
||||
translate: '[%s] ',
|
||||
bold: false,
|
||||
color: 'white',
|
||||
with: [
|
||||
{ color: 'blue', text: 'help cmd'},
|
||||
]
|
||||
]
|
||||
}
|
||||
const category = {
|
||||
translate: '(%s%s%s%s%s) \u203a ',
|
||||
translate: '(%s%s%s%s%s) \u203a ',
|
||||
bold: false,
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
|
@ -41,11 +37,10 @@ const CommandManager = bot.commandManager
|
|||
//if (command.aliases) { command.aliases.map((a) => (this.commands[a] = command)); }
|
||||
for (const commands in bot.commandManager.commandlist) { // i broke a key woops
|
||||
|
||||
const command = bot.commandManager.getCommand(`${args[0].toLowerCase()}`)
|
||||
const command = bot.commandManager.commandlist[commands]
|
||||
|
||||
if (args[0].toLowerCase() === command.name)
|
||||
|
||||
//bot.tellraw(`${bot.commandManager.commandlist['help'].aliases}`)
|
||||
|
||||
|
||||
{
|
||||
|
@ -54,47 +49,70 @@ const CommandManager = bot.commandManager
|
|||
}//bot.getMessageAsPrismarine([cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole])?.toAnsi()
|
||||
|
||||
valid = true
|
||||
if (bot.options.useChat) {
|
||||
bot.sendFeedback([{text:`Trust levels: -1 = disabled, 0 = public, 1 = trusted, 2 = owner, 3 = console`,color:'dark_purple'}])
|
||||
await bot.chatDelay(100)
|
||||
//bot.sendFeedback({text:`${bot.Commands.prefixes[0]}${command.name} `,color:'#00ffff'},{text:`(Aliases: ${command.aliases}) › ${command.description}`,color:'dark_purple'}])
|
||||
bot.sendFeedback({text: `${bot.Commands.prefixes[0]}${command.name} `,color:'#00ffff'})
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({text:`Aliases`,color:'dark_purple'})
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({text:`${command.aliases}`,color:'dark_purple'})
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({text:`${command.description}`})
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback([{text:`Trust Level: `,color:'#00ffff'},{text:`${command.trustLevel}`,color:'dark_purple'}])
|
||||
await bot.chatDelay(100)
|
||||
if (command.trustLevel === 2) {
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback([{text:`Usage: `,color:'#00ffff'},{text:`${bot.Commands.prefixes[0]}${command.name} <owner hash> `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])
|
||||
await bot.chatDelay(100)
|
||||
} else if (command.trustLevel === 1) {
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback([{text:`Usage: `,color:'#00ffff'},{text:`${bot.Commands.prefixes[0]}${command.name} <trusted/owner hash> `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])
|
||||
await bot.chatDelay(100)
|
||||
} else {
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback([{text:`Usage: `,color:'#00ffff'},{text:`${bot.Commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])
|
||||
await bot.chatDelay(100)
|
||||
}
|
||||
if (bot.options.useChat && !bot.options.isCreayun) {
|
||||
bot.sendFeedback([{text:`Trust levels: -1 = disabled, 0 = public, 1 = trusted, 2 = owner, 3 = console`,color:'dark_purple'}])
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({text: `${bot.Commands.prefixes[0]}${command.name} `,color:'#00ffff'})
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({text:`Aliases`,color:'dark_purple'})
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({text:`${command.aliases}`,color:'dark_purple'})
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({text:`${command.description}`})
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback([{text:`Trust Level: `,color:'#00ffff'},{text:`${command.trustLevel}`,color:'dark_purple'}])
|
||||
await bot.chatDelay(100)
|
||||
if (command.trustLevel === 2) {
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback([{text:`Usage: `,color:'#00ffff'},{text:`${bot.Commands.prefixes[0]}${command.name} <owner hash> `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])
|
||||
await bot.chatDelay(100)
|
||||
} else if (command.trustLevel === 1) {
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback([{text:`Usage: `,color:'#00ffff'},{text:`${bot.Commands.prefixes[0]}${command.name} <trusted/owner hash> `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])
|
||||
await bot.chatDelay(100)
|
||||
} else {
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback([{text:`Usage: `,color:'#00ffff'},{text:`${bot.Commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])
|
||||
await bot.chatDelay(100)
|
||||
}
|
||||
|
||||
} else {
|
||||
bot.sendFeedback([cmd,{text:`Trust levels: -1 = disabled, 0 = public, 1 = trusted, 2 = owner, 3 = console`,color:'dark_purple'}])
|
||||
bot.sendFeedback([cmd, {text:`${bot.Commands.prefixes[0]}${command.name} `,color:'#00ffff'},{text:`(Aliases: ${command.aliases}) › ${command.description}`,color:'dark_purple'}])
|
||||
bot.sendFeedback([cmd,{text:`Trust Level: `,color:'#00ffff'},{text:`${command.trustLevel}`,color:'dark_purple'}])
|
||||
} else if (bot.options.isCreayun) {
|
||||
bot.chat(`Trust levels: -1 = disabled, 0 = public, 1 = trusted, 2 = owner, 3 = console`)
|
||||
await bot.chatDelay(2000)
|
||||
bot.chat(`Aliases ↓↓↓`)
|
||||
await bot.chatDelay(2000)
|
||||
bot.chat(`${command.aliases}`)
|
||||
await bot.chatDelay(2000)
|
||||
bot.chat(`${command.description}`)
|
||||
await bot.chatDelay(2000)
|
||||
bot.chat(`Trust Level: ${command.trustLevel}`)
|
||||
await bot.chatDelay(2000)
|
||||
if (command.trustLevel === 2) {
|
||||
await bot.chatDelay(2000)
|
||||
bot.chat(`ඞ${bot.Commands.prefixes[0]}${command.name} <owner hash> ${command.usage}`)
|
||||
await bot.chatDelay(2000)
|
||||
} else if (command.trustLevel === 1) {
|
||||
await bot.chatDelay(2000)
|
||||
bot.chat(`ඞ${bot.Commands.prefixes[0]}${command.name} <owner/trusted hash> ${command.usage}`)
|
||||
await bot.chatDelay(2000)
|
||||
} else {
|
||||
await bot.chatDelay(2000)
|
||||
bot.chat(`ඞ${bot.Commands.prefixes[0]}${command.name} ${command.usage}`)
|
||||
await bot.chatDelay(2000)
|
||||
}
|
||||
} else {
|
||||
bot.sendFeedback([cmd,{text:`Trust levels: -1 = disabled, 0 = public, 1 = trusted, 2 = owner, 3 = console`,color:'dark_purple'}])
|
||||
bot.sendFeedback([cmd, {text:`${bot.Commands.prefixes[0]}${command.name} `,color:'#00ffff'},{text:`(Aliases: ${command.aliases}) › ${command.description}`,color:'dark_purple'}])
|
||||
bot.sendFeedback([cmd,{text:`Trust Level: `,color:'#00ffff'},{text:`${command.trustLevel}`,color:'dark_purple'}])
|
||||
|
||||
if (command.trustLevel === 2) {
|
||||
bot.sendFeedback([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.Commands.prefixes[0]}${command.name} <owner hash> `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])
|
||||
} else if (command.trustLevel === 1) {
|
||||
bot.sendFeedback([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.Commands.prefixes[0]}${command.name} <trusted/owner hash> `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])
|
||||
} else {
|
||||
bot.sendFeedback([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.Commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])
|
||||
}
|
||||
}
|
||||
if (command.trustLevel === 2) {
|
||||
bot.sendFeedback([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.Commands.prefixes[0]}${command.name} <owner hash> `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])
|
||||
} else if (command.trustLevel === 1) {
|
||||
bot.sendFeedback([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.Commands.prefixes[0]}${command.name} <trusted/owner hash> `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])
|
||||
} else {
|
||||
bot.sendFeedback([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.Commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])
|
||||
}
|
||||
}
|
||||
break
|
||||
// }
|
||||
} else valid = false
|
||||
|
@ -103,13 +121,16 @@ break
|
|||
|
||||
if (valid) {
|
||||
|
||||
} else {
|
||||
} else if (!valid) {
|
||||
const args = context.arguments
|
||||
|
||||
|
||||
bot.sendFeedback([cmd, {translate: `Unknown command %s. Type "${bot.options.commands.prefixes[0]}help" for help or click on this for the command`,color:'red', with: [args[0]], clickEvent: bot.options.Core.customName ? { action: 'suggest_command', value: `${bot.options.commands.prefixes[0]}help` } : undefined}])
|
||||
if (bot.options.isCreayun) {
|
||||
bot.chat(bot.getMessageAsPrismarine({ translate: "command.unknown.command", color: "dark_red" })?.toMotd(bot.registry.language).replaceAll("§","&"))
|
||||
await bot.chatDelay(1500)
|
||||
bot.chat(bot.getMessageAsPrismarine({ translate: "command.context.here", color: "dark_red" })?.toMotd(bot.registry.language).replaceAll("§","&"))
|
||||
} else {
|
||||
bot.sendFeedback([cmd, {translate: `Unknown command %s. Type "${bot.Commands.prefixes[0]}help" for help or click on this for the command`,color:'red', with: [args[0]], clickEvent: bot.options.Core.customName ? { action: 'suggest_command', value: `${bot.Commands.prefixes[0]}help` } : undefined}])
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let pub_lick = [];
|
||||
|
@ -263,21 +284,8 @@ break
|
|||
|
||||
if(source.sources.console && !source.sources.discord) {
|
||||
|
||||
bot.console.info(bot.getMessageAsPrismarine([cmd, 'Commands (', CommandManager.commandlist.length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole])?.toAnsi(), false)//[cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole]
|
||||
} /*else if(source.sources.discord&& !source.sources.console){
|
||||
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor('#00FFFF')
|
||||
.setTitle('help Command')
|
||||
.setDescription(bot.getMessageAsPrismarine(['Commands (',JSON.stringify(CommandManager.commandlist.filter(c => c.trustLevel != 3).length),')'])?.toString())
|
||||
.addFields(
|
||||
{ name: 'Public Commands', value:`${bot.getMessageAsPrismarine(pub_lick)?.toString()}`},
|
||||
{ name: 'Trusted Commands', value: `${bot.getMessageAsPrismarine(t_rust)?.toString()}`, inline: true },
|
||||
{ name: 'Owner Commands', value: `${bot.getMessageAsPrismarine(own_her)?.toString()}`, inline: true },
|
||||
)
|
||||
bot?.discord?.Message?.reply({ embeds: [Embed] })
|
||||
bot?.discord?.Message.react('♋')
|
||||
}*/ else if (bot.options.useChat) {
|
||||
bot.sendFeedback([cmd, 'Commands (', JSON.stringify(CommandManager.commandlist.length), ') ', category, ...pub_lick, t_rust, own_her, cons_ole], false)//[cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole]
|
||||
} else if (bot.options.useChat && !bot.options.isCreayun) {
|
||||
|
||||
const length = context.bot.commandManager.commandlist.filter(c => c.trustLevel != 3).length
|
||||
bot.chat('&8Commands &3(&6' + JSON.stringify(length) + '&3) (&bPublic &f| &5Trusted &f| &4Owner&f)')
|
||||
|
@ -289,7 +297,19 @@ const Embed = new EmbedBuilder()
|
|||
bot.chat(`${own_her}`)
|
||||
|
||||
|
||||
}else {
|
||||
} else if (bot.options.isCreayun) {
|
||||
|
||||
const length = context.bot.commandManager.commandlist.filter(c => c.trustLevel != 3).length
|
||||
bot.chat('Please note that the bot will not output all commands due the char limit')
|
||||
await bot.chatDelay(1500)
|
||||
bot.chat('&8Commands &3(&6' + JSON.stringify(length) + '&3) (&bPublic &f| &5Trusted &f| &4Owner&f)')
|
||||
await bot.chatDelay(1500)
|
||||
bot.chat(`${pub_lick}`)
|
||||
await bot.chatDelay(1500)
|
||||
bot.chat(`${t_rust}`)
|
||||
await bot.chatDelay(1500)
|
||||
bot.chat(`${own_her}`)
|
||||
} else {
|
||||
const length = context.bot.commandManager.commandlist.filter(c => c.trustLevel != 3).length
|
||||
/*
|
||||
bot.sendFeedback([
|
||||
|
@ -409,4 +429,4 @@ throw new CommandError(`Unknown command ${args[0]}. type "${bot.Discord.commandP
|
|||
bot?.discord?.Message.react('♋')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,7 +29,7 @@ module.exports = {
|
|||
"version",
|
||||
"invites",
|
||||
"server",
|
||||
"packages",
|
||||
"loaded",
|
||||
"login",
|
||||
"config",
|
||||
"uptime",
|
||||
|
@ -41,24 +41,36 @@ module.exports = {
|
|||
const source = context.source
|
||||
switch(args.join(' ').toLowerCase()) {
|
||||
case 'version':
|
||||
if (bot.options.useChat) {
|
||||
if (bot.options.useChat && !bot.options.isCreayun) {
|
||||
bot.chat(`${bot.getMessageAsPrismarine({text:`${process.env.buildstring}`})?.toMotd().replaceAll('§',"&")}`)
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({text:`${process.env.FoundationBuildString}`})
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({text:`11/22/2022 - ${date}`})
|
||||
bot.sendFeedback({text:`11/22/2022 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })}`})
|
||||
} else if (bot.options.isCreayun) {
|
||||
bot.chat(bot.getMessageAsPrismarine(process.env.buildstring)?.toMotd().replaceAll('§','&'))
|
||||
await bot.chatDelay(1500)
|
||||
bot.chat(process.env.FoundationBuildString)
|
||||
await bot.chatDelay(1500)
|
||||
bot.chat(`11/22/2022 ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })}`)
|
||||
} else {
|
||||
bot.sendFeedback({text:`${process.env.buildstring}`})
|
||||
bot.sendFeedback({text:`${process.env.FoundationBuildString}`})
|
||||
bot.sendFeedback({text:`11/22/2022 - ${date}`})
|
||||
bot.sendFeedback({text:`11/22/2022 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })}`})
|
||||
}
|
||||
break
|
||||
case 'invites':
|
||||
if (bot.options.isCreayun) {
|
||||
bot.chat(`Discord ${bot.discord.invite}`)
|
||||
await bot.chatDelay(1500)
|
||||
bot.chat(`Matrix ${bot.matrix.invite}`)
|
||||
} else {
|
||||
bot.sendFeedback({ text: 'Discord Invite', color: "dark_gray", translate: "", hoverEvent: { action: "show_text", value: [ { text: "click here to join!", color: "gray", }, ], }, clickEvent: { action: "open_url", value: `${bot.discord.invite}`, }, });
|
||||
bot.sendFeedback({ text: 'Matrix Invite', color: "dark_gray", translate: "", hoverEvent: { action: "show_text", value: [ { text: "click here to join!", color: "gray", }, ], }, clickEvent: { action: "open_url", value: `${bot.matrix.invite}`, }, });
|
||||
}
|
||||
break
|
||||
case 'server':
|
||||
if (bot.options.useChat) {
|
||||
if (bot.options.useChat && !bot.options.isCreayun) {
|
||||
bot.sendFeedback({ color: "dark_gray", text: `Hostname \u203a ${os.hostname()}`, })
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({ color: "dark_gray", text: `Working Directory \u203a ${process.mainModule.path}`, });
|
||||
|
@ -80,6 +92,28 @@ switch(args.join(' ').toLowerCase()) {
|
|||
bot.sendFeedback({text:`Device uptime \u203a ${format(os.uptime())}`,color:'dark_gray'})
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({text:`Node version \u203a ${process.version}`,color:'dark_gray'})
|
||||
} else if (bot.options.isCreayun) {
|
||||
bot.chat(`Host \u203a ${os.hostname()}`)
|
||||
await bot.chatDelay(1500)
|
||||
bot.chat(`Working Dir \u203a ${process.mainModule.path}`)
|
||||
await bot.chatDelay(1500)
|
||||
bot.chat(`${os.arch}`)
|
||||
await bot.chatDelay(1500)
|
||||
bot.chat(`OS \u203a ${os.platform()}`)
|
||||
await bot.chatDelay(1500)
|
||||
bot.chat(`OS Version \u203a ${os.version()}`)
|
||||
await bot.chatDelay(1500)
|
||||
bot.chat(`Kernal Version \u203a ${os.release()}`)
|
||||
await bot.chatDelay(1500)
|
||||
bot.chat(`cores \u203a ${os.cpus().length}`)
|
||||
await bot.chatDelay(1500)
|
||||
bot.chat(`CPU \u203a ${os.cpus()[0].model}`)
|
||||
await bot.chatDelay(1500)
|
||||
bot.chatDelay(`too lazy to put server free memory here rn`)
|
||||
await bot.chatDelay(1500)
|
||||
bot.chat(`Device uptime \u203a ${format(os.uptime())}`)
|
||||
await bot.chatDelay(1500)
|
||||
bot.chat(`Node version \u203a ${process.version}`)
|
||||
} else {
|
||||
bot.sendFeedback({ color: "dark_gray", text: `Hostname \u203a ${os.hostname()}`, });
|
||||
bot.sendFeedback({ color: "dark_gray", text: `Working Directory \u203a ${process.mainModule.path}`, });
|
||||
|
@ -111,9 +145,13 @@ switch(args.join(' ').toLowerCase()) {
|
|||
|
||||
// lazy file count :shrug:
|
||||
// source.sendFeedback([{text:'Package Count \u203a ',color:'dark_gray'},{text:`${Object.keys(packageJSON.dependencies).length}`,color:'gold'}])
|
||||
if (bot.options.useChat) {
|
||||
if (bot.options.useChat && !bot.options.isCreayun) {
|
||||
bot.sendFeedback([{text:'Package Count \u203a ', color:'dark_gray'},{text:`${Object.keys(packageJSON.dependencies).length}`,color:'gold'}])
|
||||
} else {
|
||||
} else if (bot.options.isCreayun) {
|
||||
bot.chat(`Package Count \u203a ${Object.keys(packageJSON.dependencies).length}`)
|
||||
await bot.chatDelay(1500)
|
||||
bot.chat(`File Could \u203a (${FileCount})`)
|
||||
} else {
|
||||
// bot.sendFeedback([{text:'Packages \u203a ',color:'dark_gray'},{text:`${Object.entries(packageJSON.dependencies).map((key, value) => key + ' ' + value).join(' ')}`}])
|
||||
bot.sendFeedback([{text:'Package Count \u203a ', color:'dark_gray'},{text:`${Object.keys(packageJSON.dependencies).length}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:'File count ',color:'dark_gray'},{text:'(',color:'dark_blue'},{text:`${FileCount}`,color:'gold'},{text:')',color:'dark_blue'}])
|
||||
|
@ -147,20 +185,12 @@ await bot.chatDelay(150)
|
|||
} else {
|
||||
bot.sendFeedback({text:`Minecraft Username \u203a ${bot.options.username}`,color:'dark_gray'})
|
||||
bot.sendFeedback({text: `uuid \u203a ${bot.uuid}`,color:'dark_gray'})
|
||||
if(bot.discord === undefined){
|
||||
bot.sendFeedback({text:'Currently not logged into discord',color:'dark_red'})
|
||||
}else{
|
||||
bot.sendFeedback({text:`Discord Username \u203a ${bot.discord.client.user.username + '#' + bot.discord.client.user.discriminator}`,color:'dark_gray'})
|
||||
}
|
||||
if (bot.matrix.client === undefined){
|
||||
bot.sendFeedback({text:'Currently not logged into matrix',color:'dark_red'})
|
||||
}else{
|
||||
bot.sendFeedback({text: `Matrix Username \u203a ${bot.matrix.client.credentials.userId}`,color:'dark_gray'})
|
||||
}
|
||||
bot.sendFeedback({text:`Server \u203a ${bot.options.serverName}`,color:'dark_gray'})
|
||||
bot.sendFeedback({text:`Server IP \u203a ${bot.options.host + ':' + bot.options.port}`,color:'dark_gray'})
|
||||
bot.sendFeedback({text:`Version \u203a ${bot.options.version}`,color:'dark_gray'})
|
||||
bot.sendFeedback({text:`Discord channel \u203a ${bot.discord.channel.name}`,color:'dark_gray'})
|
||||
bot.sendFeedback({text:`Discord Username \u203a ${bot.discord.client.user.username + '#' + bot.discord.client.user.discriminator}`,color:'dark_gray'})
|
||||
bot.sendFeedback({text: `Matrix Username \u203a ${bot.matrix.client.credentials.userId}`,color:'dark_gray'})
|
||||
}
|
||||
break
|
||||
case 'config':
|
||||
|
@ -181,15 +211,21 @@ case 'config':
|
|||
} else {
|
||||
bot.sendFeedback({text:`Prefixes \u203a ${bot.Commands.prefixes}`,color:'dark_gray'})
|
||||
bot.sendFeedback([{text:`Core enabled? `,color:'dark_gray'},{text:`${bot.options.Core.enabled}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:'Discord enabled? ',color:'dark_gray'},{text:`${bot.Discord.enabled}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:'Matrix enabled? ',color:'dark_gray'},{text:`${bot.matrix.enabled}`,color:'gold'}])
|
||||
// bot.sendFeedback([{text:'Discord enabled? ',color:'dark_gray'},{text:`${bot.Discord.enabled}`,color:'gold'}])
|
||||
//bot.sendFeedback([{text:'Matrix enabled? ',color:'dark_gray'},{text:`${bot.matrix.enabled}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:'Console logging enabled? ',color:'dark_gray'},{text:`${bot.options.Console.enabled}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:'Chat filelogging enabled? ',color:'dark_gray'},{text:`${bot.Console.filelogging}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:'Multiconnect Server count \u203a ',color:'dark_gray'},{text:`${Object.keys(bot.bots).length}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:'Discord enabled? ',color:'dark_gray'},{text:`${bot.Discord.enabled}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:'Matrix enabled? ',color:'dark_gray'},{text:`${bot.matrix.enabled}`,color:'gold'}])
|
||||
}
|
||||
break
|
||||
case 'uptime':
|
||||
if (bot.options.isCreayun) {
|
||||
bot.chat(`${format(process.uptime())}`)
|
||||
} else {
|
||||
bot.sendFeedback([{text:`${format(process.uptime())}`,color:'dark_gray'}])
|
||||
}
|
||||
break
|
||||
case 'contributors':
|
||||
if (bot.options.useChat) {
|
||||
|
@ -221,8 +257,12 @@ var prefix = "&8&l&m[&4&mParker2991&8]&8&m[&b&mBOYFRIEND&8]&8&m[&b&mCONSOLE&8]&r
|
|||
bot.core.run( "bcraw " + prefix + "Thank you for all that helped and contributed with the bot, it has been one hell of a ride with the bot hasnt it? From November 22, 2022 to now, 0.1 beta to 4.0 alpha, Mineflayer to Node-Minecraft-Protocol. I have enjoyed all the new people i have met throughout the development of the bot back to the days when the bot used mineflayer for most of its lifespan to the present as it now uses node-minecraft-protocol. Its about time for me to tell how development went in the bot well here it is, back in 0.1 beta of the bot it was skidded off of menbot 1.0 reason why? Well because LoginTimedout gave me the bot when ayunboom was still a thing and he helped throughout that time period bot and when 1.0 beta came around he he just stopped helping me on it why? because he had servers to run so yeah but anyway back then i didnt know what skidded like i do now so i thought i could get away with but i was wrong 💀. Early names considered for the bot were &6&lParkerBot &4&lDEMONBot &b&lWoomyBot &b&lBoyfriendBot,&r i kept the name &b&lBoyfriendBot&r throughout most of the early development but i got sick and tired of being harassed about the name being told it was gay but people really didnt know what it meant did they? It was referenced to Boyfriend from Friday Night Funkin’ so right around 1.0 released i renamed it to &b&lFNFBoyfriend&4&lBot &rand around 2.0 changed it to &5&lFNF&b&lBoyfriend&4&lBot &rand luckily avoided the harassment when i changed it i love coding and i want to learn how to code more thank you all!",)
|
||||
break
|
||||
default:
|
||||
if (bot.options.isCreayun) {
|
||||
bot.chat(`&4Invalid argument`)
|
||||
} else {
|
||||
bot.sendError({text:'Invalid Argument!!'})
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
discordExecute(context) {
|
||||
|
@ -230,15 +270,8 @@ const bot = context.bot
|
|||
const source = context.source
|
||||
const args = context.arguments
|
||||
switch(args.join(' ').toLowerCase()) {
|
||||
/*
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor('#00FFFF')
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`${bot.getMessageAsPrismarine({ text: util.inspect(eval(args.slice(0).join(' ')), { stylize }) })?.toString()}`)
|
||||
bot.discord.Message.reply({embeds: [Embed]})
|
||||
*/
|
||||
case 'version':
|
||||
var Embed = new EmbedBuilder()
|
||||
case 'version':
|
||||
let Embed = new EmbedBuilder()
|
||||
.setColor('#00FFFF')
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription('\u200b')
|
||||
|
@ -248,10 +281,10 @@ var Embed = new EmbedBuilder()
|
|||
{name: `11/22/2022 - ${date}`,value:'\u200b'},
|
||||
|
||||
)
|
||||
bot.discord.Message.reply({embeds: [Embed]})
|
||||
break
|
||||
case 'invites':
|
||||
var Embed = new EmbedBuilder()
|
||||
bot.discord.Message.reply({embeds: [Embed]})
|
||||
break
|
||||
case 'invites':
|
||||
let Embed1 = new EmbedBuilder()
|
||||
.setColor('#00FFFF')
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription('\u200b')
|
||||
|
@ -259,31 +292,53 @@ var Embed = new EmbedBuilder()
|
|||
{name:`${bot.Discord.invite}`,value:'\u200b'},
|
||||
{name:`${bot.matrix.invite}`,value:'\u200b'},
|
||||
)
|
||||
bot.discord.Message.reply({embeds: [Embed]})
|
||||
break
|
||||
case 'server':
|
||||
bot.discord.Message.reply(`Hostname \u203a ${os.hostname()}\nWorking Directory \u203a ${process.mainModule.path}\nOS \u203a ${os.platform()}\nKernal Version \u203a ${os.release()}\ncores \u203a ${os.cpus().length}\nCPU \u203a ${os.cpus()[0].model}\nServer Free memory ${Math.floor( os.freemem() / 1048576 )} MiB / ${Math.floor(os.totalmem() / 1048576)} MiB\nDevice uptime \u203a ${format(os.uptime())}\nNode version \u203a ${process.version}`)
|
||||
bot.discord.Message.reply({embeds: [Embed1]})
|
||||
break
|
||||
case 'server':
|
||||
bot.discord.Message.reply(`Hostname \u203a ${os.hostname()}\nWorking Directory \u203a ${process.mainModule.path}\nOS \u203a ${os.platform()}\nKernal Version \u203a ${os.release()}\ncores \u203a ${os.cpus().length}\nCPU \u203a ${os.cpus()[0].model}\nServer Free memory ${Math.floor( os.freemem() / 1048576 )} MiB / ${Math.floor(os.totalmem() / 1048576)} MiB\nDevice uptime \u203a ${format(os.uptime())}\nNode version \u203a ${process.version}`)
|
||||
|
||||
|
||||
break
|
||||
case 'packages':
|
||||
let packages = Object.entries(packageJSON.dependencies).map((key, value) => key + ' ' + value).join(' ')
|
||||
var Embed = new EmbedBuilder()
|
||||
break
|
||||
case 'loaded':
|
||||
let packages = Object.entries(packageJSON.dependencies).map((key, value) => key + ' ' + value).join(' ')
|
||||
let Embed2 = new EmbedBuilder()
|
||||
.setColor('#00FFFF')
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription('\u200b')
|
||||
.addFields(
|
||||
{name:`Packages \u203a ${JSON.stringify(packages)}`,value:'\u200b'},
|
||||
{name:`Package Count \u203a ${Object.keys(packageJSON.dependencies).length}`,value:'\u200b'},
|
||||
{ name: `Package Count \u203a ${Object.keys(packageJSON.dependencies).length}`, value: '\u200b' },
|
||||
)
|
||||
bot.discord.Message.reply({embeds: [Embed]})
|
||||
break
|
||||
/*
|
||||
case 'packages':
|
||||
// source.sendFeedback([{text:'Package Count \u203a ',color:'dark_gray'},{text:`${Object.keys(packageJSON.dependencies).length}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:'Packages \u203a ',color:'dark_gray'},{text:`${Object.entries(packageJSON.dependencies).map((key, value) => key + ' ' + value).join(' ')}`}])
|
||||
bot.sendFeedback([{text:'Package Count \u203a ', color:'dark_gray'},{text:`${Object.keys(packageJSON.dependencies).length}`,color:'gold'}])
|
||||
*/
|
||||
bot.discord.Message.reply({ embeds: [Embed2] })
|
||||
break
|
||||
case 'login':
|
||||
let Embed3 = new EmbedBuilder()
|
||||
.setColor('#00FFFF')
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`Server ${bot.options.serverName}\nIP ${bot.options.host}\nVersion ${bot.options.version}\nMinecraft Username ${bot.options.username}\nUUID ${bot._client.uuid}\nDiscord Username ${bot.discord.client.user.username}'#'${bot.discord.client.user.discriminator}\nDiscord Channel ${bot.discord.channel.name}`)
|
||||
|
||||
bot.discord.Message.reply({ embeds: [Embed3] })
|
||||
break
|
||||
case 'config':
|
||||
let Embed4 = new EmbedBuilder()
|
||||
.setColor('#00FFFF')
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`Prefixes ${bot.Commands.prefixes}\nCore Enabled? ${bot.options.Core.enabled}\nConsole logging enabled? ${bot.options.Console.enabled}\nChat filelogging enabled? ${bot.Console.filelogging}\nMulticonnect Server count ${(bot.bots).length}`)
|
||||
bot.discord.Message.reply({ embeds: [Embed4] })
|
||||
break
|
||||
case 'uptime':
|
||||
let Embed5 = new EmbedBuilder()
|
||||
.setColor('#00FFFF')
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`${format(process.uptime())}`)
|
||||
bot.discord.Message.reply({ embeds: [Embed5] })
|
||||
break
|
||||
case 'contributors':
|
||||
let Embed6 = new EmbedBuilder()
|
||||
.setColor('#00FFFF')
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`Parker2991\n_ChipMC_\nchayapak\n_yfd\naaa\nMorganAnkan\nTurtleKid`)
|
||||
bot.discord.Message.reply({ embeds: [Embed6] })
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,18 +4,25 @@ const timer = null
|
|||
|
||||
module.exports = {
|
||||
name: 'kick',
|
||||
|
||||
description: ['kicks a player'],
|
||||
|
||||
trustLevel: 1,
|
||||
aliases: [],
|
||||
usage: ['sussy <player>', 'invalidstring <player>'],
|
||||
usage: [
|
||||
'sussy <player>',
|
||||
'invalidstring <player>',
|
||||
'msg <player> <integer>',
|
||||
'kick <player> <integer>',
|
||||
'me <integer>',
|
||||
'whisper <player> <integer>',
|
||||
],
|
||||
execute (context) {
|
||||
// throw new CommandError('temp disabled')
|
||||
// throw new CommandError('command temporarily disabled until hashing is implemented')
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
if (!args && !args[0] && !args[1] && !args[2]) return
|
||||
//if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
if (bot.options.useChat ?? bot.options.isCreayun) {
|
||||
throw new CommandError('Cannot execute command make sure useChat and isCreayun options are not enabled')
|
||||
// bot.chat('e')
|
||||
} else {
|
||||
switch (args[1]) {
|
||||
case 'sussy':
|
||||
if (args[2] === 'clear' || args[2] === 'stop') {
|
||||
|
@ -31,12 +38,8 @@ module.exports = {
|
|||
|
||||
const target = context.player// let me hashonly it rq
|
||||
this.timer = setInterval(function () { // Wait, is this command public?
|
||||
repeat(context.bot, 400, `tellraw ${args[2]} {"text":"${'ඞ'.repeat(20000)}","bold":true,"italic":true,"obfuscated":true,"color":"#FF0000"}`)
|
||||
}, 10)
|
||||
|
||||
// i found that there is a limit
|
||||
|
||||
// Repeat the command over and over.
|
||||
repeat(bot, 400, `minecraft:tellraw ${args[2]} ${JSON.stringify(bot.exploits.sussy)}`)
|
||||
}, 80)
|
||||
function repeat (bot, repetitions, cmd) {
|
||||
for (let i = 0; i < repetitions; i++) {
|
||||
bot.core.run(cmd)
|
||||
|
@ -44,8 +47,37 @@ module.exports = {
|
|||
}
|
||||
break
|
||||
case 'invalidstring':
|
||||
bot.core.run(`minecraft:tellraw ${args[2]} ${process.env.invalidstring}`)
|
||||
bot.core.run(`minecraft:tellraw ${args[2]} ${JSON.stringify(bot.exploits.invalidstring)}`)
|
||||
break
|
||||
case 'msg':
|
||||
if (isNaN(args[3]) === true) {
|
||||
bot.sendError('Argument is not a integer!')
|
||||
} else {
|
||||
bot.core.run(`msg ${args[2]} ` + `@e `.repeat(`${args[3]}`))
|
||||
}
|
||||
break
|
||||
case 'kick':
|
||||
if (isNaN(`${args[3]}`)) {
|
||||
bot.sendError('Arguments is not a integer!')
|
||||
} else {
|
||||
bot.command(`minecraft:kick ${args[2]} ` + `@e `.repeat(`${args[3]}`))
|
||||
}
|
||||
break
|
||||
case 'me':
|
||||
bot.core.run(`me ` + '@e '.repeat(`${args[2]}`))
|
||||
break
|
||||
case 'item':
|
||||
bot.core.run(`minecraft:give ${args[2]} ${bot.exploits.item}`)
|
||||
break
|
||||
case 'whisper':
|
||||
if (isNaN(args[3])) {
|
||||
bot.sendError('Argument is not a integer!')
|
||||
} else {
|
||||
bot.core.run(`minecraft:w ${args[2]} ` + `${bot.exploits.EntitySelector} `.repeat(`${args[3]}`))
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,9 @@ const source = context.source
|
|||
throw new CommandError({translate:"Too many Arguments!", color:"red"})
|
||||
}
|
||||
|
||||
|
||||
if (bot.options.isCreayun) {
|
||||
bot.chat('&4Cannot execute command because isCreayun is active in the config!')
|
||||
} else {
|
||||
for (const player of players) {
|
||||
component.push({
|
||||
translate: `%s \u203a %s [%s %s %s %s %s]`,
|
||||
|
@ -78,6 +80,7 @@ bot.tellraw([{text:`Players: `,color:'dark_gray',},{text:'(',color:'blue'},{text
|
|||
bot.tellraw(component)
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
discordExecute(context) {
|
||||
const bot = context.bot
|
||||
|
@ -133,4 +136,5 @@ const Embed = new EmbedBuilder()
|
|||
}
|
||||
}
|
||||
//what is wi
|
||||
// IDK
|
||||
// IDK
|
||||
|
||||
|
|
|
@ -254,3 +254,4 @@ if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,46 +13,44 @@ module.exports = {
|
|||
|
||||
//throw new CommandError('ohio')
|
||||
const component = {
|
||||
translate: '[%s] [%s] %s \u203a %s',
|
||||
with: [
|
||||
{
|
||||
translate: '%s%s%s',
|
||||
bold:false,
|
||||
with: [
|
||||
{
|
||||
text: 'FNF',
|
||||
bold: true,
|
||||
color: 'dark_purple'
|
||||
},
|
||||
{
|
||||
text: 'Boyfriend',
|
||||
bold: true,
|
||||
color: 'aqua'
|
||||
},
|
||||
{
|
||||
text: 'Bot',
|
||||
bold: true,
|
||||
color: 'dark_red'
|
||||
},
|
||||
],
|
||||
},
|
||||
bot.options.serverName,
|
||||
translate: '%s [%s] %s \u203a %s',
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
{
|
||||
translate: '%s%s%s',
|
||||
with: [
|
||||
{
|
||||
text: 'FNF',
|
||||
color: 'dark_purple'
|
||||
},
|
||||
{
|
||||
text: 'Boyfriend',
|
||||
color: 'aqua'
|
||||
},
|
||||
{
|
||||
text: 'Bot',
|
||||
color: 'dark_red'
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
bot.options.serverName,
|
||||
|
||||
context.source.player.displayName ?? context.source.player.profile.name,
|
||||
message
|
||||
]//command.split(' ')[0]
|
||||
}//string.replace()
|
||||
context?.source?.player?.displayName ?? context?.source?.player?.profile?.name,
|
||||
message
|
||||
]
|
||||
}
|
||||
if (!message[0]) {
|
||||
bot.sendFeedback({text:'Message is empty', color:'red'}, false)
|
||||
} else {
|
||||
for (const eachBot of bot.bots)
|
||||
if(!bot.options.Core.enabled){
|
||||
eachBot.chat(`[${bot.options.serverName}] ${bot.getMessageAsPrismarine(context.source.player.displayName ?? context.source.player.profile.name)?.toMotd().replaceAll('§','&')} \u203a ${message}`)
|
||||
}else{
|
||||
eachBot.tellraw(component)
|
||||
if (bot.options.isCreayun) {
|
||||
eachBot.chat(`[${bot.options.serverName}] ${bot.getMessageAsPrismarine(context?.source?.player?.displayName ?? context?.source?.player?.profile?.name)?.toMotd().replaceAll('§','&')} \u203a ${message}`)
|
||||
} else {
|
||||
eachBot?.tellraw(component)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
bot.options.host + ':' + bot.options.port,
|
||||
|
|
20
src/commands/ping.js
Normal file
20
src/commands/ping.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
const CommandError = require('../CommandModules/command_error')
|
||||
module.exports = {
|
||||
name: 'ping', // command name here
|
||||
description: [''], // command desc here
|
||||
aliases: [], // command aliases here if there is any
|
||||
trustLevel: 0, // 0 = public, 1 = trusted, 2 = owner, 3 = console
|
||||
usages: [], // command usage here
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
const player = source.player
|
||||
|
||||
if (args.join(' ') === null) {
|
||||
bot.sendFeedback([{ text: 'Pong!', color: 'dark_gray' }, { text: ' 🏓\n', color: 'dark_gray' }, { text: `${bot.getMessageAsPrismarine(player.displayName)?.toMotd()}`, color: 'dark_gray' },{ text: '\nPing: ', color: 'dark_gray' },{ text: `${player.latency}`, color: 'green' }])
|
||||
} else if (args.join(' ') !== null) {
|
||||
bot.sendFeedback([{ text: `${args.join(' ')} 🏓\n`, color: 'dark_gray' }, { text: `${bot.getMessageAsPrismarine(player.displayName)?.toMotd()}`, color: 'dark_gray' }, { text: '\nPing: ', color: 'dark_gray' },{ text: `${player.latency}`, color: 'green' }])
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,35 +2,41 @@ const { EmbedBuilder } = require('discord.js')
|
|||
const CommandError = require('../CommandModules/command_error')
|
||||
module.exports = {
|
||||
name: 'reload',
|
||||
description:['Reload the bots files'],
|
||||
aliases:[],
|
||||
trustLevel: 0,
|
||||
usage:["reload"],
|
||||
description:['Reload the bots files'],
|
||||
aliases:[],
|
||||
trustLevel: 0,
|
||||
usage:["reload"],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
try {
|
||||
bot.sendFeedback({text:'Reloading crap'});
|
||||
for (const eachBot of bot.bots)
|
||||
eachBot.reload()
|
||||
}catch(e){
|
||||
bot.sendFeedback(e.stack)
|
||||
}
|
||||
const source = context.source
|
||||
try {
|
||||
|
||||
// bot.sendFeedback({text:'Reloading crap'});
|
||||
for (const eachBot of bot.bots)
|
||||
eachBot.reload()
|
||||
} catch(e) {
|
||||
bot.sendFeedback(e.stack)
|
||||
}
|
||||
if (bot.options.isCreayun) {
|
||||
bot.chat('Reloading shit')
|
||||
} else {
|
||||
bot.sendFeedback({text:'Reloading Shit'})
|
||||
}
|
||||
},
|
||||
discordExecute(context) {
|
||||
const bot = context.bot
|
||||
const source = context.source
|
||||
try {
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor('#00FFFF')
|
||||
const bot = context.bot
|
||||
const source = context.source
|
||||
try {
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor('#00FFFF')
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`reloading commands`)
|
||||
bot.discord.Message.reply({embeds: [Embed]})
|
||||
for (const eachBot of bot.bots)
|
||||
eachBot.reload()
|
||||
}catch(e) {
|
||||
throw new CommandError(e.stack)
|
||||
}
|
||||
.setDescription(`reloading crap`)
|
||||
bot.discord.Message.reply({ embeds: [Embed] })
|
||||
for (const eachBot of bot.bots)
|
||||
eachBot.reload()
|
||||
}catch(e) {
|
||||
throw new CommandError(e.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
const CommandError = require("../CommandModules/command_error");
|
||||
const buildstring = process.env["buildstring"];
|
||||
const foundation = process.env["FoundationBuildString"];
|
||||
module.exports = {
|
||||
name: "say",
|
||||
//<< this one line of code broke it lmao
|
||||
description: ["make me say something in custom chat"],
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"tellrawsay",
|
||||
"tellrawmsg",
|
||||
"trmessage",
|
||||
"tellrawmessage",
|
||||
"sourcesendfeedbacksay",
|
||||
"sourcesendfeedbackmsg",
|
||||
"sourcesendfeedbackmessage",
|
||||
"ssfbmsg",
|
||||
"ssfmessage",
|
||||
],
|
||||
usage:["<message>"],
|
||||
execute(context) {
|
||||
const message = context.arguments.join(" ");
|
||||
const bot = context.bot;
|
||||
|
||||
const prefix = {
|
||||
translate: "[%s%s%s] \u203a %s",
|
||||
bold: false,
|
||||
color: "white",
|
||||
with: [
|
||||
{
|
||||
color: "dark_purple",
|
||||
text: "FNF",
|
||||
bold: true,
|
||||
},
|
||||
{
|
||||
color: "#00FFFF",
|
||||
text: "Boyfriend",
|
||||
bold: true,
|
||||
},
|
||||
{ color: "dark_red", text: "Bot", bold: true },
|
||||
|
||||
{ color: "green", text: `${message}` },
|
||||
],
|
||||
};
|
||||
//if(!bot.options.Core.enabled){
|
||||
// throw new CommandError('&4Will not work because the core is not enabled please use the echo command')
|
||||
//}else{
|
||||
bot.tellraw([prefix]);
|
||||
}
|
||||
// },
|
||||
};
|
||||
|
||||
//[%s] %s › %s
|
||||
//was it showing like that before?
|
||||
// just do text bc too sus rn ig
|
||||
// You should remove the with thing and the translate and replace
|
||||
|
||||
// Parker, why is hashing just random characters???
|
||||
//wdym
|
|
@ -16,7 +16,7 @@ usage:[""],
|
|||
|
||||
//ima just connect to your server to work on the bot ig
|
||||
// idk
|
||||
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
|
||||
if (args[1] === 'clear' || args[1] === 'stop') {
|
||||
|
@ -28,7 +28,9 @@ usage:[""],
|
|||
}
|
||||
|
||||
|
||||
|
||||
if (bot.options.isCreayun || bot.options.useChat) {
|
||||
throw new CommandError(`Cannot execute command because isCreayun or useChat is enabled!`)
|
||||
} else {
|
||||
if (this.timer !== null) return
|
||||
this.timer = setInterval(function () {
|
||||
bot.core.run('day')
|
||||
|
@ -62,3 +64,4 @@ clearInterval(this.timer)
|
|||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,11 @@ module.exports = {
|
|||
bot.sendFeedback({ text: `Script input: ${script}` })
|
||||
}
|
||||
} catch (err) {
|
||||
if (bot.options.isCreayun) {
|
||||
bot.chat(`&4${err.message}`)
|
||||
} else {
|
||||
bot.sendFeedback({ text: err.message, color: 'red' })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,10 @@ trustLevel:1,
|
|||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
bot.core.run('sudo * execute at @a run playsound entity.ender_dragon.death master @a ~ ~ ~ 10000 0.1 1')
|
||||
if (bot.options.isCreayun || bot.options.useChat) {
|
||||
throw new CommandError('Cannot execute command because isCreayun or useChat is enabled!')
|
||||
} else {
|
||||
bot.core.run('sudo * execute at @a run playsound entity.ender_dragon.death master @a ~ ~ ~ 10000 0.1 1')
|
||||
bot.core.run('sudo * execute at @a run playsound entity.wither.death master @a ~ ~ ~ 10000 0.1 1')
|
||||
bot.core.run('sudo * execute at @a run playsound entity.ender_dragon.death master @a ~ ~ ~ 10000 0.1 1')
|
||||
bot.core.run('sudo * execute at @a run playsound entity.wither.death master @a ~ ~ ~ 10000 0.1 1')
|
||||
|
@ -16,5 +19,6 @@ bot.core.run('sudo * execute at @a run playsound entity.ender_dragon.death maste
|
|||
bot.core.run('sudo * execute at @a run playsound entity.wither.death master @a ~ ~ ~ 10000 0.1 1')
|
||||
bot.core.run('sudo * execute at @a run playsound entity.ender_dragon.death master @a ~ ~ ~ 10000 0.1 1')
|
||||
bot.core.run('sudo * execute at @a run playsound entity.wither.death master @a ~ ~ ~ 10000 0.1 1')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,38 +6,34 @@ const finalStream = require('final-stream')
|
|||
module.exports = {
|
||||
name: 'terminal', // command name here
|
||||
description: ['run terminal commands in a docker image'], // command desc here
|
||||
aliases: [], // command aliases here if there is any
|
||||
trustLevel: 0, // 0 = public, 1 = trusted, 2 = owner, 3 = console
|
||||
aliases: ["exec"], // command aliases here if there is any
|
||||
trustLevel: 0, // -1 = disabled, 0 = public, 1 = trusted, 2 = owner, 3 = console
|
||||
usage: [], // command usage here
|
||||
async execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
var id = null
|
||||
const docker = new Docker()
|
||||
if(!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
|
||||
switch(args[0].toLowerCase()){
|
||||
case 'run':
|
||||
try {
|
||||
const finalStream = require('final-stream');
|
||||
|
||||
const stdout = new stream.PassThrough();
|
||||
const docker = new Docker({ socketPath: '/var/run/docker.sock' });
|
||||
|
||||
const container = await docker.run('alpine', ['sh', '-c', `${args.slice(1).join(' ')}`], stdout);
|
||||
const data = await finalStream(stdout).then(buffer => buffer.toString());
|
||||
|
||||
bot.tellraw(data);
|
||||
|
||||
|
||||
}catch(e) {
|
||||
bot.sendFeedback({text:`${e.stack}`})
|
||||
}
|
||||
try {
|
||||
const stdout = new stream.PassThrough();
|
||||
const docker = new Docker({ socketPath: '/var/run/docker.sock' });
|
||||
const container = await docker.run('alpine', ['sh', '-c', `${args.slice(1).join(' ')}`], stdout);
|
||||
const data = await finalStream(stdout).then(buffer => buffer.toString());
|
||||
bot.tellraw(data);
|
||||
} catch(e) {
|
||||
if (e.toString() === "Error: connect ENOENT /var/run/docker.sock" || e.toString() === "Error: connect EACCES /var/run/docker.sock") {
|
||||
bot.sendError("The bot isnt running as root or docker daemon isnt started!")
|
||||
} else {
|
||||
bot.sendFeedback({text:`${e.toString()}`})
|
||||
}
|
||||
}
|
||||
break
|
||||
case "rebuild":
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,11 +10,18 @@ module.exports = {
|
|||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
bot.Commands.help.pub_lickColor = args[0]
|
||||
bot.Commands.help.t_rustedColor = args[1]
|
||||
bot.Comands.help.own_herColor = args[2]
|
||||
bot.sendFeedback({text:`Set Help theme colors to ${bot.helpTheme.pub_lickColor} ${bot.helpTheme.t_rustedColor} ${bot.helpTheme.own_herColor}`})
|
||||
if (args[0] === undefined || args[1] === undefined || args[2] === undefined) {
|
||||
bot.Commands.colors.help.pub_lickColor = '#00FFFF'
|
||||
bot.Commands.colors.help.t_rustedColor = 'dark_purple'
|
||||
bot.Commands.colors.help.own_herColor = 'dark_red'
|
||||
bot.sendFeedback(`Reseting theme colors,.,.,..`)
|
||||
} else {
|
||||
bot.Commands.colors.help.pub_lickColor = args[0]
|
||||
bot.Commands.colors.help.t_rustedColor = args[1]
|
||||
bot.Commands.colors.help.own_herColor = args[2]
|
||||
bot.sendFeedback({text:`Set Help theme colors to ${bot.Commands.colors.help.pub_lickColor} ${bot.Commands.colors.help.t_rustedColor} ${bot.Commands.colors.help.own_herColor}`})
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
helpTheme:{
|
||||
|
|
|
@ -2,25 +2,28 @@ const CommandError = require('../CommandModules/command_error')
|
|||
|
||||
module.exports = {
|
||||
name: 'time',
|
||||
description:['check the time'],
|
||||
aliases:['clock', 'timezone'],
|
||||
trustLevel:0,
|
||||
usage:["timezone"],
|
||||
description:['check the time'],
|
||||
aliases:['clock', 'timezone'],
|
||||
trustLevel:0,
|
||||
usage:["timezone"],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
const moment = require('moment-timezone')
|
||||
const source = context.source
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const timezone = args.join(' ')
|
||||
|
||||
|
||||
if (!moment.tz.names().map((zone) => zone.toLowerCase()).includes(timezone.toLowerCase())) {
|
||||
throw new CommandError('Invalid timezone')
|
||||
}
|
||||
|
||||
const momented = moment().tz(timezone).format('dddd, MMMM Do, YYYY, hh:mm:ss A')
|
||||
const component = [{ text: 'The current date and time for the timezone ', color: 'white' }, { text: timezone, color: 'aqua' }, { text: ' is: ', color: 'white' }, { text: momented, color: 'green' }]
|
||||
|
||||
const component = [{ text: 'date and time for the timezone ', color: 'dark_gray' }, { text: timezone, color: 'aqua' }, { text: ' is: ', color: 'dark_gray' }, { text: momented, color: 'green' }]
|
||||
if (bot.options.isCreayun) {
|
||||
bot.chat(bot.getMessageAsPrismarine(component)?.toMotd().replaceAll('§','&'))
|
||||
} else {
|
||||
bot.sendFeedback(component)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,9 +11,12 @@ usage:["on","off"],
|
|||
const bot = context.bot
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
if (bot.options.isCreayun) {
|
||||
throw new CommandError('Cannot execute command because isCreayun is active!')
|
||||
} else {
|
||||
switch (args[0]) {
|
||||
case 'on':
|
||||
bot.tps.on()
|
||||
bot.tps.on()
|
||||
|
||||
bot.sendFeedback({text: 'TPSBar is now enabled', color:'green'})
|
||||
|
||||
|
@ -27,10 +30,10 @@ bot.tps.on()
|
|||
default:
|
||||
throw new CommandError('Invalid argument')
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//[%s] %s › %s
|
||||
//was it showing like that before?
|
||||
// just do text bc too sus rn ig
|
||||
|
|
|
@ -4,20 +4,20 @@ let timer = null
|
|||
|
||||
module.exports = {
|
||||
name: 'troll',
|
||||
trustLevel:1,
|
||||
usage:[""],
|
||||
trustLevel:1,
|
||||
usage:[""],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const source = context.source
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
if(source.sources.console){
|
||||
if (args[0] === 'clear'||args[0] === 'stop'){
|
||||
clearInterval(this.timer)
|
||||
this.time= undefined
|
||||
bot.console.info('Cloop stopped')
|
||||
return
|
||||
}
|
||||
}else if(!source.sources.console){
|
||||
if (source.sources.console) {
|
||||
if (args[0] === 'clear'||args[0] === 'stop') {
|
||||
clearInterval(this.timer)
|
||||
this.time= undefined
|
||||
bot.console.info('Cloop stopped')
|
||||
return
|
||||
}
|
||||
} else if (!source.sources.console) {
|
||||
|
||||
if (args[1] === 'clear' || args[1] === 'stop') {
|
||||
clearInterval(this.timer)
|
||||
|
@ -27,7 +27,9 @@ return
|
|||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (bot.options.isCreayun || bot.options.useChat) {
|
||||
throw new CommandError(`Cannot execute command because isCreayun or useChat is enabled!`)
|
||||
} else {
|
||||
if (this.timer !== null)
|
||||
this.timer = setInterval(function () {
|
||||
bot.core.run('day')
|
||||
|
@ -57,3 +59,4 @@ clearInterval(this.timer)
|
|||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,98 +1,59 @@
|
|||
const urban = require('urban-dictionary')
|
||||
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
const ud = require('../util/urban')
|
||||
module.exports = {
|
||||
name: 'urban',
|
||||
description:['urban dictionary'],
|
||||
aliases:['urbandictionary'],
|
||||
trustLevel: 0,
|
||||
usage:["re fucking doing"],
|
||||
aliases:['urbandictionary'],
|
||||
trustLevel: 0,
|
||||
usage:[
|
||||
"all <definition>",
|
||||
"single <definition>",
|
||||
],
|
||||
async execute (context) {
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
const cmd = {
|
||||
translate: '[%s] ',
|
||||
bold: false,
|
||||
color: 'white',
|
||||
with: [
|
||||
{ color: 'dark_red', text: 'Urban Cmd'},
|
||||
]
|
||||
}
|
||||
const example = {
|
||||
translate: '%s - ',
|
||||
bold: false,
|
||||
color: 'white',
|
||||
with: [
|
||||
{ color: 'dark_gray', text: 'Example text'},
|
||||
]
|
||||
}
|
||||
const definition5 = {
|
||||
translate: '%s - ',
|
||||
bold: false,
|
||||
color: 'white',
|
||||
with: [
|
||||
{ color: 'dark_gray', text: 'Definition text'},
|
||||
]
|
||||
const bot = context.bot
|
||||
const cmdPrefix = [
|
||||
{ text: '[', color: 'dark_gray' },
|
||||
{ text: 'Urban', color: '#B72A00' },
|
||||
{ text: '] ', color: 'dark_gray'}
|
||||
]
|
||||
/* for (const def of definitions) {
|
||||
bot.tellraw([cmdPrefix, { text: def.example.replaceAll('\r',''), color: 'dark_gray' }])
|
||||
bot.tellraw([cmdPrefix, { text: def.definition.replaceAll("\r", ""), color: 'dark_gray' }])
|
||||
}*/
|
||||
switch(args[0]) {
|
||||
case 'all':
|
||||
try {
|
||||
let definitions = await ud.define(args.slice(1).join(' '))
|
||||
for (const def of definitions) {
|
||||
bot.tellraw([cmdPrefix, { text: def.example.replaceAll('\r',''), color: 'dark_gray' }])
|
||||
bot.tellraw([cmdPrefix, { text: def.definition.replaceAll("\r", ""), color: 'dark_gray' }])
|
||||
}
|
||||
async function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
try {
|
||||
const definitions = await urban.define(args.join(' '))
|
||||
const definitions2 = await urban.define(args.join(' '))
|
||||
//const definitions2 = await urban.example(args.join(' '))
|
||||
//ChatMessage.fromNotch(await sleep(500) ?? player.displayName ?? player.profile.name ).toMotd().replaceAll('§', '&')
|
||||
if(!bot.options.Core.enabled){
|
||||
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
for (const definition of definitions) {
|
||||
|
||||
|
||||
bot.chat(ChatMessage.fromNotch(await sleep(2300)
|
||||
?? [cmd, example, { text: definition.example.replaceAll("\r", ""), color: 'gray' }, { text: ' - ', color: 'white' }]).toMotd().replaceAll('§', '&'))
|
||||
await sleep(500)
|
||||
bot.chat(ChatMessage.fromNotch(await sleep(2300) ?? [cmd, definition5,{ text: definition.definition.replaceAll("\r", ""), color: 'gray' } ]).toMotd().replaceAll('§', '&'))
|
||||
}//oh
|
||||
}else{//??
|
||||
|
||||
for (const definition of definitions) {
|
||||
|
||||
bot.sendFeedback([cmd, example, { text: definition.example.replaceAll("\r", ""), color: 'gray' }, { text: ' - ', color: 'white' }])
|
||||
bot.sendFeedback([cmd, definition5,{ text: definition.definition.replaceAll("\r", ""), color: 'gray' } ])
|
||||
}
|
||||
|
||||
|
||||
|
||||
urban.define(args.join(' ')).then((results) => {
|
||||
bot.sendFeedback([cmd,{text:`Definition: ${results[0].word}`, color:'dark_gray'}])
|
||||
bot.sendFeedback([cmd,{text:`Author: ${results[0].author}`, color:'dark_gray'}])
|
||||
bot.tellraw([cmdPrefix,{text:`Definition: ${definitions[0].word}`, color:'dark_gray'}])
|
||||
bot.tellraw([cmdPrefix,{text:`Author: ${definitions[0].author}`, color:'dark_gray'}])
|
||||
//source.sendFeedback(results[0].thumbs_down)
|
||||
bot.sendFeedback([cmd,{text:`👍 ${results[0].thumbs_up} | 👎 ${results[0].thumbs_down}`, color:'gray'}])
|
||||
bot.tellraw([cmdPrefix,{text:`👍 ${definitions[0].thumbs_up} | 👎 ${definitions[0].thumbs_down}`, color:'gray'}])
|
||||
} catch (e) {
|
||||
bot.sendError(`${e.toString()}`)
|
||||
}
|
||||
break
|
||||
case 'single':
|
||||
ud.define(args.slice(1).join(' '), (error, results) => {
|
||||
if (error) {
|
||||
bot.tellraw([cmdPrefix,`${error.message}`])
|
||||
return
|
||||
}
|
||||
bot.tellraw('define (callback)')
|
||||
|
||||
|
||||
//source.sendFeedback(results[0].written_on)
|
||||
|
||||
//thumbs_down
|
||||
|
||||
|
||||
//source.sendFeedback(results[0].data)
|
||||
}).catch((error) => {
|
||||
console.error(error.message)
|
||||
})
|
||||
//source.sendFeedback(results[0].data)
|
||||
}
|
||||
// source.sendFeedback([cmd, { text: definitions2.replaceAll("\r", ""), color: 'white' }, { text: ' - ', color: 'white' }, { text: definition.definition.replaceAll("\r", ""), color: 'white' }])
|
||||
//console.log(urban.define.definition.example(args.join(' ')))
|
||||
|
||||
|
||||
//text: definition.word text: definition.definition
|
||||
|
||||
} catch (e) {
|
||||
if (!bot.options.Core.enabled){
|
||||
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
bot.chat(ChatMessage.fromNotch([cmd,{ text: e.toString(), color: 'red' }]).toMotd().replaceAll('§', '&'))
|
||||
}else {
|
||||
bot.sendFeedback([cmd,{ text: e.toString(), color: 'red' }])
|
||||
}
|
||||
Object.entries(results[0]).forEach(([key, prop]) => {
|
||||
bot.tellraw([cmdPrefix,`${key}: ${prop}`])
|
||||
})
|
||||
})
|
||||
break
|
||||
default:
|
||||
bot.sendError('invalid argument')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,30 +1,27 @@
|
|||
const CommandError = require('../CommandModules/command_error')
|
||||
|
||||
//const fetch = import("node-fetch");
|
||||
const CommandError = require('../CommandModules/command_error');
|
||||
const https = require('https');
|
||||
const util = require('util');
|
||||
module.exports = {
|
||||
name: 'website',
|
||||
trustLevel:0,
|
||||
aliases:['web','websitedata','webdata'],
|
||||
description:['check website data'],
|
||||
usage:["<url"],
|
||||
trustLevel:0,
|
||||
aliases:['web','websitedata','webdata'],
|
||||
description:['check website data'],
|
||||
usage:["<url>"],
|
||||
async execute (context) {
|
||||
try{
|
||||
const fetch = require("node-fetch");
|
||||
const source = context.source
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
const args = context.arguments
|
||||
if (!args && !args[0] && !args[1] && !args[2]) return
|
||||
const response = await fetch(args[0]);
|
||||
const body = await response.text();
|
||||
|
||||
bot.tellraw({text:body,color:'green'})
|
||||
|
||||
} catch(e) {
|
||||
const bot = context.bot
|
||||
const source = context.source
|
||||
// source.sendFeedback({text:e.stack, color:'dark_red'})
|
||||
source.sendFeedback({text:e.toString(), color:'dark_red'})
|
||||
}
|
||||
}
|
||||
const bot = context.bot;
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
try {
|
||||
https.get(`${args.join(' ')}`, (res) => {
|
||||
res.setEncoding('utf8');
|
||||
res.on('data', (data) => {
|
||||
bot.tellraw({ text: data, color: 'dark_gray' })
|
||||
});
|
||||
}).on('error', (e) => {
|
||||
bot.sendError(`${e}`);
|
||||
});
|
||||
} catch (e) {
|
||||
bot.sendError(`${e.toString()}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,24 +3,24 @@ const CommandError = require('../CommandModules/command_error')
|
|||
module.exports = {
|
||||
name: 'wiki',
|
||||
description:['wikipedia'],
|
||||
trustLevel: 0,
|
||||
aliases:['wikipedia'],
|
||||
usage:["<definition"],
|
||||
async execute (context) {
|
||||
const source = context.source
|
||||
trustLevel: 0,
|
||||
aliases:['wikipedia'],
|
||||
usage:["<definition>"],
|
||||
async execute (context) {
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
|
||||
try {
|
||||
const page = await wiki.page(args.join(' '))
|
||||
const bot = context.bot
|
||||
try {
|
||||
const page = await wiki.page(args.join(' '))
|
||||
// source.sendFeedback({text:`${page.html()}`,color:'dark_gray'})
|
||||
const summary = await page.intro();
|
||||
source.sendFeedback({text:`${summary}`,color:'dark_gray'});
|
||||
|
||||
const summary = await page.intro();
|
||||
bot.sendFeedback({text:`${summary}`,color:'dark_gray'});
|
||||
} catch (error) {
|
||||
if(error.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')"){
|
||||
bot.sendFeedback({text:'Definition not found!',color:'dark_red'})
|
||||
}
|
||||
if(error.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')"){
|
||||
bot.sendFeedback({text:'Definition not found!',color:'dark_red'})
|
||||
} else {
|
||||
bot.sendFeedback(`${error.toString()}`)
|
||||
}
|
||||
// source.sendFeedback(error.toString());
|
||||
}
|
||||
|
||||
|
|
15
src/index.js
15
src/index.js
|
@ -22,7 +22,6 @@ const rl = readline.createInterface({
|
|||
|
||||
//const config = require('./config.js')
|
||||
|
||||
|
||||
function load() {
|
||||
require("dotenv").config();
|
||||
const bots = [];
|
||||
|
@ -41,7 +40,7 @@ for (const options of config.bots) {
|
|||
bot.Core = core;
|
||||
bot.Commands = commands;
|
||||
bot.Console = Console;
|
||||
bot.Discord = discord;
|
||||
bot.discord = discord;
|
||||
bot.tellrawTag = tellrawtag;
|
||||
// bot.helpTheme = helptheme;
|
||||
bot.matrix = matrix;
|
||||
|
@ -51,7 +50,7 @@ for (const options of config.bots) {
|
|||
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, "modules"))) {
|
||||
try {
|
||||
const module = require(path.join(__dirname, "modules", filename));
|
||||
const module = require(path.join(__dirname, 'modules', filename))
|
||||
bot.loadModule(module);
|
||||
} catch (error) {
|
||||
console.log(
|
||||
|
@ -61,7 +60,7 @@ for (const options of config.bots) {
|
|||
error,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bot.console.useReadlineInterface(rl);
|
||||
|
@ -69,8 +68,8 @@ for (const options of config.bots) {
|
|||
|
||||
try {
|
||||
bot.on("error", error => {
|
||||
bot?.console?.warn(error.toString())
|
||||
});
|
||||
bot.console?.warn(error.toString())
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error.stack);
|
||||
}
|
||||
|
@ -79,7 +78,7 @@ bot?.console?.warn(error.toString())
|
|||
}
|
||||
|
||||
process.on("uncaughtException", (e) => {
|
||||
//console.log(e.stack)
|
||||
console?.warn(e.stack)
|
||||
});
|
||||
|
||||
load()
|
||||
load()
|
||||
|
|
|
@ -144,4 +144,4 @@ function inject (bot) {
|
|||
bot.tellraw = (message, selector = '@a') => bot.core.run('minecraft:tellraw @a ' + JSON.stringify(message)) // ? Should this be here?
|
||||
}
|
||||
|
||||
module.exports = inject
|
||||
module.exports = inject
|
||||
|
|
|
@ -81,7 +81,7 @@ try{
|
|||
setTimeout(() => {
|
||||
ratelimit--
|
||||
}, 1000)
|
||||
if (ratelimit > 3) { // ,.
|
||||
if (ratelimit > 1) { // ,.
|
||||
bot.sendFeedback({text:'You are using commands to fast!',color:'dark_red'})
|
||||
// this isn't blocking running the command you know that right?
|
||||
} else {
|
||||
|
@ -96,4 +96,4 @@ try{
|
|||
});
|
||||
})//
|
||||
}
|
||||
module.exports = chat_command_handler;
|
||||
module.exports = chat_command_handler;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
const nbt = require('prismarine-nbt');
|
||||
async function command_core (bot, options) {
|
||||
bot.core = {
|
||||
// what you think im doing? look at line 17
|
||||
|
@ -15,7 +14,7 @@ async function command_core (bot, options) {
|
|||
|
||||
if (!pos) return
|
||||
|
||||
bot.command(`fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block${bot.Core.JSON} destroy`)
|
||||
bot.command(`fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block${bot.Core.JSON} destroy`)
|
||||
|
||||
},
|
||||
|
||||
|
@ -62,9 +61,13 @@ async function command_core (bot, options) {
|
|||
run (command) {
|
||||
const location = bot.core.currentBlock()
|
||||
if (!location) return
|
||||
if (bot.options.useChat) {
|
||||
bot.command(command)
|
||||
}else{
|
||||
if (bot.options.useChat ?? bot.options.isCreayun) {
|
||||
if (command.startsWith('/')) {
|
||||
bot.command(command.substring(1))
|
||||
return
|
||||
}
|
||||
bot.chat(command)
|
||||
} else {
|
||||
bot._client.write('update_command_block', { command: command.substring(0, 32767), location, mode: 1, flags: 0b100 })
|
||||
|
||||
bot.core.incrementCurrentBlock()
|
||||
|
@ -73,29 +76,20 @@ async function command_core (bot, options) {
|
|||
}
|
||||
},
|
||||
}
|
||||
/*
|
||||
bot.on('parsed_message', data => {
|
||||
if (data.type !== 'minecraft:chat') return
|
||||
|
||||
const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString()
|
||||
if (plainMessage.startsWith(':3')) {
|
||||
bot.chat(' :3')
|
||||
} return
|
||||
})
|
||||
*/
|
||||
if (bot.options.useChat) return
|
||||
if (bot.options.useChat ?? bot.options.isCreayun) return
|
||||
bot.on('move', () => {
|
||||
bot.core.move(bot.position)
|
||||
|
||||
//setTimeout(() => bot.core.run('say hi'), 100)
|
||||
})
|
||||
bot.on('packet.login', (data) =>{
|
||||
const timer = setInterval(() => {
|
||||
bot.core.refill()
|
||||
}, bot.options.Core.interval)
|
||||
bot.on('end', (bot) => {
|
||||
clearInterval(timer)
|
||||
bot.on('packet.login', (data) => {
|
||||
const timer = setInterval(() => {
|
||||
bot.core.refill()
|
||||
}, bot.options.Core.interval)
|
||||
bot.on('end', (bot) => {
|
||||
clearInterval(timer)
|
||||
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
module.exports = command_core
|
||||
|
|
|
@ -8,12 +8,12 @@ const {EmbedBuilder } = require('discord.js')
|
|||
bot.commandManager = {
|
||||
commands: {},
|
||||
commandlist: [],
|
||||
execute(source, commandName, args, message) {
|
||||
const command = this.getCommand(commandName.toLowerCase());
|
||||
const player = source?.player?.profile?.name;
|
||||
execute(source, commandName, args, message, options) {
|
||||
const command = this.getCommand(commandName.toLowerCase());
|
||||
const player = source?.player?.profile?.name;
|
||||
const uuid = source?.player?.uuid;
|
||||
try {
|
||||
if(source.sources.console && !source?.sources?.discord){
|
||||
if (source.sources.console && !source?.sources?.discord) {
|
||||
if (!command || !command.execute) {
|
||||
bot.console.warn({text:`Unknown Command ${commandName}. type "${bot.Console.prefix}help" for help`,color:'dark_red'})
|
||||
}
|
||||
|
@ -25,12 +25,21 @@ bot.console.warn({text:`Unknown Command ${commandName}. type "${bot.Console.pref
|
|||
.setDescription(`Unknown Command ${commandName}. type "${bot.Discord.commandPrefix}help" for help`)
|
||||
bot.discord.Message.reply({ embeds: [Embed] })
|
||||
}
|
||||
}else if(!source?.sources?.discord && !source.sources.console) {
|
||||
|
||||
} else if (!source?.sources?.discord && !source.sources.console) {
|
||||
if (bot.options.isCreayun) {
|
||||
if (!command || !command.execute) {
|
||||
throw new CommandError(`Unknown command ${commandName} type "${bot.Commands.prefixes[0]}help" for help`)
|
||||
}
|
||||
} else {
|
||||
if (!command || !command.execute) { // bot.options.command.prefixes[0]
|
||||
throw new CommandError(bot.getMessageAsPrismarine([{ // sus
|
||||
translate: `command.unknown.command`},{text:'\n'},{text:`${commandName} `},{translate:"command.context.here"}])?.toMotd(require('../util/language/lolus.json')));
|
||||
}
|
||||
}
|
||||
} else if (bot.options.isCreayun) {
|
||||
if (!command || !command.execute) {
|
||||
bot.chat(`Unknown command ${command.name} type "${bot.Commands.prefixes[0]}help" for help`)
|
||||
}
|
||||
}
|
||||
|
||||
const event = bot?.discord?.Message
|
||||
|
@ -82,14 +91,14 @@ if (owner !== bot.owner) throw new CommandError([{text:"Invalid ",color:'gray'},
|
|||
|
||||
throw new CommandError({translate: "This command can only be executed via console",color: "blue",});
|
||||
}
|
||||
if(source?.sources?.discord && !source?.sources?.matrix && !source.sources.console){
|
||||
if (!command?.discordExecute && command) {
|
||||
bot.discord.Message.reply('This command is not supported in discord!')
|
||||
if(source?.sources?.discord && !source?.sources?.matrix && !source.sources.console){
|
||||
if (!command?.discordExecute && command) {
|
||||
bot.discord.Message.reply('This command is not supported in discord!')
|
||||
}else{
|
||||
return command?.discordExecute({bot, source,arguments: args})
|
||||
return command?.discordExecute({bot, source, arguments: args, args})
|
||||
}
|
||||
}else{
|
||||
return command?.execute({ bot, source, arguments: args });
|
||||
return command?.execute({ bot, source, arguments: args, options });
|
||||
}
|
||||
} catch (error) {
|
||||
/* if (source.sources.discord) {
|
||||
|
@ -113,20 +122,34 @@ return command?.discordExecute({bot, source,arguments: args})
|
|||
console.warn(error.stack)
|
||||
}*/
|
||||
if (!source.sources.discord && !source.sources.console) {
|
||||
if (error instanceof CommandError)
|
||||
bot.sendError(error._message)
|
||||
else bot.sendError({
|
||||
translate: "An Error has occured because the bot shot itself 🔫",
|
||||
color: `${bot.Commands.colors.error}`,
|
||||
hoverEvent: { action: "show_text", contents: String(error.stack) },
|
||||
|
||||
});
|
||||
bot.console.warn(error.stack)
|
||||
} else if (source.source.discord && !source.sources.console) {
|
||||
// if (error instanceof CommandError)
|
||||
/*if (bot.options.useChat) {
|
||||
|
||||
bot.sendError(error._message)
|
||||
else bot.sendError(bot.getMessageAsPrismarine({ translate: 'command.failed' })?.toMotd(bot.registry.language))
|
||||
}*/
|
||||
// if (error instanceof CommandError)
|
||||
// bot.sendError(error._message)
|
||||
// if (error instanceof CommandError)
|
||||
if (bot.options.isCreayun) {
|
||||
if (error instanceof CommandError)
|
||||
bot.chat(bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&'))
|
||||
else bot.chat(bot.getMessageAsPrismarine({ translate: 'command.failed', color: 'dark_red' })?.toMotd(bot.registry.language).replaceAll('§','&'))
|
||||
} else {
|
||||
if (error instanceof CommandError)
|
||||
bot.sendError(error._message)
|
||||
else bot.sendError({
|
||||
translate: "An Error has occured because the bot shot itself 🔫",
|
||||
color: `${bot.Commands.colors.error}`,
|
||||
hoverEvent: { action: "show_text", contents: String(error.stack) },
|
||||
});
|
||||
}
|
||||
bot.console.warn(error.stack)
|
||||
} else if (source.sources.discord && !source.sources.console) {
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${bot.Commands.colors.discord.error}`)
|
||||
.setTitle(`${command.name} Command`)
|
||||
.setDescription(`\`\`\`${error._message}\`\`\``)
|
||||
.setDescription(`\`\`\`${error}\`\`\``)
|
||||
bot.discord.Message.reply({ embeds: [Embed] })
|
||||
}
|
||||
}
|
||||
|
@ -178,4 +201,4 @@ return command?.discordExecute({bot, source,arguments: args})
|
|||
}
|
||||
}
|
||||
}
|
||||
module.exports = command_manager;
|
||||
module.exports = command_manager;
|
|
@ -1,6 +1,5 @@
|
|||
const CommandSource = require("../CommandModules/command_source");
|
||||
const prismarine = require('prismarine-chat')('1.20.2')
|
||||
const moment = require('moment-timezone');
|
||||
//const time = moment().tz('america/chicago').format('hh:mm:ss a');
|
||||
//const date = moment().tz('america/chicago').format('MM/DD/YY')
|
||||
function Console(bot, options, context, source) {
|
||||
|
@ -62,17 +61,17 @@ function Console(bot, options, context, source) {
|
|||
}
|
||||
|
||||
bot.console.warn = function (error) {
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${moment().tz('america/chicago').format('hh:mm:ss a')} `,color:'dark_purple'},{text:`${moment().tz('america/chicago').format('MM/DD/YY')}`,color:'#00FFFF'},{text:' WARN',color:'yellow'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(error)?.toAnsi());
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} `,color:'dark_purple'},{text:`${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })}`,color:'#00FFFF'},{text:' WARN',color:'yellow'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(error)?.toAnsi());
|
||||
};
|
||||
bot.console.error = function (error) {
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${moment().tz('america/chicago').format('hh:mm:ss a')} `,color:'dark_purple'},{text:`${moment().tz('america/chicago').format('MM/DD/YY')}`,color:'#00FFFF'},{text:' ERROR',color:'dark_red'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(error)?.toAnsi());
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text: `${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} `,color:'dark_purple'},{text:`${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })}`,color:'#00FFFF'},{text:' ERROR',color:'dark_red'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(error)?.toAnsi());
|
||||
};
|
||||
|
||||
bot.console.info = function (message) {
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${moment().tz('america/chicago').format('hh:mm:ss a')} `,color:'dark_purple'},{text:`${moment().tz('america/chicago').format('MM/DD/YY')}`,color:'#00FFFF'},{text:' INFO',color:'green'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(message)?.toAnsi());
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} `,color:'dark_purple'},{text:`${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`,color:'#00FFFF'},{text:' INFO',color:'green'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(message)?.toAnsi());
|
||||
};
|
||||
bot.console.log = function (message, ansi) {
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${ moment().tz('america/chicago').format('hh:mm:ss a')} `,color:'dark_purple'},{text:`${moment().tz('america/chicago').format('MM/DD/YY')}`,color:'#00FFFF'},{text:' LOGS',color:'gold'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + message);
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO"})} `,color:'dark_purple'},{text:`${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO"})}`,color:'#00FFFF'},{text:' LOGS',color:'gold'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + message);
|
||||
};
|
||||
|
||||
|
||||
|
@ -118,7 +117,7 @@ log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${moment().tz('ame
|
|||
const plainMessage = bot
|
||||
.getMessageAsPrismarine(data.contents)
|
||||
?.toString();
|
||||
if (plainMessage.includes("frog")) {
|
||||
if (plainMessage.includes("frog") || plainMessage.includes("🐸")) {
|
||||
bot.chat("frok :3");
|
||||
}
|
||||
return;
|
||||
|
@ -135,7 +134,7 @@ log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${moment().tz('ame
|
|||
|
||||
|
||||
const lang = require(`../util/language/lolus.json`);
|
||||
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(lang);
|
||||
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(bot.registry.language);
|
||||
const string = bot.getMessageAsPrismarine(message)?.toString(lang);
|
||||
|
||||
// if (!bot.options.Console.input) return;
|
||||
|
@ -158,8 +157,8 @@ bot._client.end("Anti spam :3")
|
|||
bot.console.log(`${ansi}`);
|
||||
|
||||
// logger(`<${time} ${date}> [${bot.options.host}:${bot.options.port}] [LOGS]: ${string}`)
|
||||
if (bot.console && bot.Console.filelogging) {
|
||||
bot.console.filelogger(`${prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${moment().tz('america/chicago').format('hh:mm:ss a')} `,color:'dark_purple'},{text:`${moment().tz('america/chicago').format('MM/DD/YY')}`,color:'#00FFFF'},{text:' LOGS',color:'gold'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toString()} ${string}`)
|
||||
if (bot.Console.filelogging) {
|
||||
bot.console.filelogger(`${prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} `,color:'dark_purple'},{text:`${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO"})}`,color:'#00FFFF'},{text:' LOGS',color:'gold'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toString()} ${string}`)
|
||||
|
||||
}//nothing is logging to the file
|
||||
|
||||
|
|
|
@ -10,46 +10,35 @@ const util = require('util')
|
|||
client.login(process.env.discordtoken)
|
||||
|
||||
function discord (bot, options) {
|
||||
if(!bot.Discord.enabled) return
|
||||
if(!bot.discord.enabled) return
|
||||
if (!options.discord?.channelId) {
|
||||
bot.discord = { invite: options.discord?.invite }
|
||||
bot.discord = { invite: bot.discord?.invite }
|
||||
return
|
||||
}
|
||||
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
bot.discord = {
|
||||
client,
|
||||
channel: undefined,
|
||||
invite: bot.Discord.invite || undefined,
|
||||
commandPrefix: bot.Discord.commandPrefix
|
||||
|
||||
invite: bot.discord.invite || undefined,
|
||||
commandPrefix: bot.discord.commandPrefix,
|
||||
presence: bot.discord.presence,
|
||||
}
|
||||
//
|
||||
|
||||
client.on('ready', (context) => {
|
||||
//setMaxListeners(Infinity)
|
||||
// client.setMaxListeners(25)
|
||||
|
||||
bot.discord.channel = client.channels.cache.get(options.discord.channelId)
|
||||
//bot.discord.channel.send(`\`\`\`\nStarting ${process.env["buildstring"]}......\n\`\`\``)
|
||||
// bot.discord.channel.send(`\`\`\`\nFoundation: ${process.env["FoundationBuildString"]}\n\`\`\``)
|
||||
// bot.discord.channel.send(`\`\`\`\nSuccessfully logged into discord as ${bot.discord.client.user.username}#${bot.discord.client.user.discriminator}\n\`\`\``)
|
||||
|
||||
//bot.discord.channel.send('``Server: '+ bot.options.host + ':'+ bot.options.port + '``')
|
||||
//bot.discord.channel.send('``Version:' + bot.options.version +'``')
|
||||
//bot.discord.channel.send('``Username:' + bot.options.username + '``')
|
||||
// bot.console.info(`Successfully logged into discord as ${bot.discord.client.user.username}#${bot.discord.client.user.discriminator}`)
|
||||
client.on('ready', (context) => {
|
||||
bot.discord.channel = client.channels.cache.get(options.discord.channelId)
|
||||
client.user.setPresence({
|
||||
activities: [{ name: `${bot.Discord.presence.name}`, type: bot.Discord.presence.type }],
|
||||
status: `${bot.Discord.presence.status}`
|
||||
activities: [{ name: `${bot.discord.presence.name}`, type: bot.discord.presence.type }],
|
||||
status: `${bot.discord.presence.status}`
|
||||
});
|
||||
})
|
||||
|
||||
// I feel like this is a modified version of ChomeNS Bot's discord plugin (the js one ofc) lol - chayapak
|
||||
})
|
||||
// I feel like this is a modified version of ChomeNS Bot's discord plugin (the js one ofc) lol - chayapak
|
||||
|
||||
let discordQueue = []
|
||||
setInterval(() => {
|
||||
if (discordQueue.length === 0) return
|
||||
try {
|
||||
bot?.discord?.channel?.send(`\`\`\`ansi\n${discordQueue.join('\n').substring(0, 1984)}\n\`\`\``)
|
||||
bot.discord.channel.send(`\`\`\`ansi\n${discordQueue.join('\n').substring(0, 1984)}\n\`\`\``)
|
||||
} catch (error) {
|
||||
//ansi real
|
||||
bot.console.error(error.stack)
|
||||
|
@ -114,7 +103,7 @@ if(!bot.options.discord.log) return
|
|||
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.channel.id !== bot.discord.channel.id) return
|
||||
//
|
||||
if (message.content.startsWith(bot.discord.commandPrefix)) { // TODO: Don't hardcode this
|
||||
const source = new CommandSource({ profile: { name: message?.member?.displayName } }, { discord: true, console: false }, false, message)
|
||||
|
|
|
@ -33,15 +33,7 @@ function hashgen (bot) {
|
|||
if (interval) clearInterval(interval)
|
||||
})
|
||||
*/
|
||||
}
|
||||
bot.on('parsed_message', data => {
|
||||
if (data.type !== 'minecraft:chat') return
|
||||
|
||||
const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString()
|
||||
if (plainMessage.startsWith('fnf sky')) {
|
||||
bot.chat('sky the fangirl!?!? i simp for her :)')
|
||||
} return
|
||||
})
|
||||
}
|
||||
let _hash = generateHash()
|
||||
const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"})
|
||||
const time = new Date().toLocaleTimeString("en-US", {timeZone:"America/CHICAGO"})
|
||||
|
|
|
@ -19,10 +19,11 @@ function consolefilelogger(bot, options, message) {
|
|||
fs.mkdirSync(logFolder);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn(`Unable to create log folder: ${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);
|
||||
|
@ -54,7 +55,7 @@ function consolefilelogger(bot, options, message) {
|
|||
// }
|
||||
}
|
||||
|
||||
console.log(
|
||||
console?.info(
|
||||
`File logging: ${bot.Console.filelogging ? "enabled" : "disabled"}`
|
||||
);
|
||||
if (!bot.Console.filelogging) return; // instead of using bot why not just use options cause you already defined it
|
||||
|
|
|
@ -14,8 +14,8 @@ function inject (bot, options) {
|
|||
//client:options.matrix.client ?? matrix.createClient({baseUrl: "https://matrix.chipmunk.land:", accessToken: process.env["matrixtoken"], userId:'@fnfboyfriendbot:chipmunk.land'}),
|
||||
client,
|
||||
roomId: options.matrix.roomId,
|
||||
commandPrefix: options.matrix.commandPrefix || undefined,
|
||||
inviteUrl: String(options.matrix.inviteUrl) || undefined
|
||||
commandPrefix: bot.matrix.commandPrefix || undefined,
|
||||
inviteUrl: String(bot.matrix.invite) || undefined
|
||||
}
|
||||
|
||||
const startTime = Date.now()
|
||||
|
@ -155,4 +155,4 @@ sendMessage(html)
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = inject
|
||||
module.exports = inject
|
||||
|
|
|
@ -11,22 +11,12 @@ function memusage(bot, options) {
|
|||
},
|
||||
off() {
|
||||
enabled = false;
|
||||
bot.core.run(`minecraft:bossbar remove ${bossbarName}`);
|
||||
},
|
||||
};//
|
||||
};
|
||||
|
||||
|
||||
const interval = setInterval(() => {
|
||||
if (!enabled) return;
|
||||
|
||||
/* const component = {
|
||||
text: `Mem used ${Math.floor(
|
||||
process.memoryUsage().heapUsed / 1000 / 1000,
|
||||
)} MiB / ${Math.floor(
|
||||
process.memoryUsage().heapTotal / 1000 / 1000,
|
||||
)} MiB. `,
|
||||
color: "dark_gray",
|
||||
};*/
|
||||
const component = {
|
||||
translate: `%s`,
|
||||
color: "gray",
|
||||
|
@ -37,18 +27,7 @@ function memusage(bot, options) {
|
|||
process.memoryUsage().heapTotal / 1048576,
|
||||
)} MiB`, color: "green" }],
|
||||
};
|
||||
//process.cpuUsage
|
||||
// bot.core.run(`minecraft:bossbar add ${bossbarName} ""`);
|
||||
// bot.core.run(`minecraft:bossbar set ${bossbarName} players @a`);
|
||||
// bot.core.run(`minecraft:bossbar set ${bossbarName} color yellow`);
|
||||
// bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`);
|
||||
// bot.core.run(`minecraft:bossbar set ${bossbarName} style progress`);
|
||||
// bot.core.run(
|
||||
// `minecraft:bossbar set ${bossbarName} name ${JSON.stringify(component)}`,
|
||||
// );
|
||||
// bot.core.run(`minecraft:bossbar set ${bossbarName} max 20`);
|
||||
//bot.tellraw(component)
|
||||
bot.core.run(`minecraft:title @a actionbar ${component}`)
|
||||
}, 100); //process.memoryUsage().heapUsed /1024 / 1024
|
||||
bot.core.run(`minecraft:title @a actionbar ${JSON.stringify(component)}`)
|
||||
}, 100); //process.memoryUsage().heapUsed /1024 / 1024
|
||||
}
|
||||
module.exports = memusage;
|
||||
|
|
|
@ -5,7 +5,7 @@ const { convertMidi } = require('../util/music/midi_converter')
|
|||
const convertNBS = require('../util/music/nbs_converter')
|
||||
const parseTXTSong = require('../util/music/txt_song_parser')
|
||||
const midiproxy = require('../util/music/midi-proxy')
|
||||
midiproxy()
|
||||
//midiproxy()
|
||||
const soundNames = {
|
||||
harp: 'minecraft:block.note_block.harp',
|
||||
basedrum: 'minecraft:block.note_block.basedrum',
|
||||
|
@ -163,6 +163,7 @@ bot.core.run(`minecraft:execute as ${selector} at @s run playsound ${soundNames[
|
|||
bot.music.song = null
|
||||
bot.music.loop = 0
|
||||
bot.music.queue = []
|
||||
bot.core.run('bossbar remove minecraft:music')
|
||||
resetTime()
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
const createRegistry = require('prismarine-registry')
|
||||
const createRegistry = require('prismarine-registry');
|
||||
|
||||
function registry (bot) {
|
||||
bot.on('packet.login', packet => {
|
||||
bot.registry = createRegistry(bot._client.version)
|
||||
// bot.registry.loadDimensionCodec(packet.dimensionCodec)
|
||||
//bot.registry.language = 'lolcats_us'
|
||||
bot.emit('registry_ready', bot.registry)
|
||||
bot.registry = createRegistry(bot._client.version);
|
||||
|
||||
bot.registry.language = require('../util/language/lolus.json');
|
||||
|
||||
bot.emit('registry_ready', bot.registry);
|
||||
})
|
||||
}
|
||||
//1.20.2 support wooooooo
|
||||
module.exports = registry
|
||||
module.exports = registry;
|
||||
|
|
|
@ -17,92 +17,139 @@ function selfcare (bot) {
|
|||
let god = false
|
||||
let tptoggle = false
|
||||
let jail = false
|
||||
let creayunJoin = false
|
||||
/* if (data.toString().startsWith('You have been muted')) muted = true
|
||||
if (data.toString() === 'You have been unmuted.') muted = false
|
||||
*/
|
||||
/* tptoggle creayun
|
||||
Teleportation enabled.
|
||||
Teleportation disabled.
|
||||
*/
|
||||
/* creayun vanish
|
||||
You are now completely invisible to normal users, and hidden from in-game commands.
|
||||
You are once again visible.
|
||||
You do not have access to that command.
|
||||
*/
|
||||
//Welcome to survivayun! Welcome to ayunami2000's boxes server!
|
||||
//bot.on('message', (data) => {
|
||||
bot.on('message', (message, data) => {
|
||||
// Successfully removed your skin
|
||||
stringmessage = bot.getMessageAsPrismarine(message)?.toString()
|
||||
if (bot.options.isCreayun) {
|
||||
if (stringmessage === `Your prefix has been set to: [Prefix: ~]` || stringmessage === 'Something went wrong while saving the prefix. Please check console.' || stringmessage === 'Unknown command. Type /help for help' || stringmessage === '[SuffEx] Your prefix has been set to: [Prefix: ~]') {
|
||||
|
||||
if (stringmessage === 'Welcome to creayun!' || stringmessage === 'Already connecting to this server!') {
|
||||
creayunJoin = true
|
||||
return
|
||||
}
|
||||
|
||||
else if (stringmessage.startsWith('Welcome ') || stringmessage === "Welcome to ayunami's boxes server") creayunJoin = false
|
||||
|
||||
else if (stringmessage.startsWith('Welcome ') || stringmessage === 'Welcome to survivayun!') creayunJoin = false
|
||||
|
||||
if (stringmessage === `Your prefix has been set to: [Prefix: ~]` || stringmessage === 'Something went wrong while saving the prefix. Please check console.' || stringmessage === 'Unknown command. Type /help for help' || stringmessage === '[SuffEx] Your prefix has been set to: [Prefix: ~]' || stringmessage === 'Unknown command. Type /help for help.') {
|
||||
prefix = true
|
||||
return
|
||||
} else if (stringmessage.startsWith("Your prefix has been set to: ") || stringmessage === '[SuffEx] Your prefix has been set to: ' || stringmessage === '[SuffEx] Your prefix has been reset' || stringmessage === "Your prefix has been reset.") prefix = false
|
||||
}
|
||||
|
||||
else if (stringmessage.startsWith("Your prefix has been set to: ") || stringmessage.startsWith('[SuffEx] Your prefix has been set to: ') || stringmessage === '[SuffEx] Your prefix has been reset' || stringmessage === "Your prefix has been reset.") prefix = false
|
||||
|
||||
else if (stringmessage === 'You no longer have a nickname.' || stringmessage === '[SuffEx] Your nick has been reset!') {
|
||||
nickname = true
|
||||
return
|
||||
}
|
||||
|
||||
else if (stringmessage.startsWith("Your nick has been set to: ") || stringmessage.startsWith("[SuffEx] Your nick has been set to: ")) nickname = false
|
||||
|
||||
else if (stringmessage === "You are now completely invisible to normal users, and hidden from in-game commands." || stringmessage === "You do not have access to that command." || stringmessage === "Unknown command. Type /help for help.") {
|
||||
vanished = true
|
||||
return
|
||||
}
|
||||
|
||||
else if (stringmessage === "You are once again visible.") vanished = false
|
||||
|
||||
else if (stringmessage === "Teleportation enabled.") {
|
||||
tptoggle = false
|
||||
return
|
||||
}
|
||||
|
||||
else if (stringmessage === "Teleportation disabled.") tptoggle = true
|
||||
|
||||
} if (bot.options.isKaboom) { //Your prefix has been reset.
|
||||
|
||||
if (stringmessage.startsWith('You have been muted')) unmuted = true
|
||||
|
||||
else if (stringmessage.startsWith('You have been unmuted')) unmuted = false
|
||||
|
||||
else if (util.isDeepStrictEqual(message, COMMANDSPY_ENABLED_MESSAGE)) commandSpyEnabled = true
|
||||
|
||||
else if (util.isDeepStrictEqual(message, COMMANDSPY_DISABLED_MESSAGE)) commandSpyEnabled = false
|
||||
|
||||
else if (stringmessage === `You now have the tag: &8[&bPrefix: &4${bot.Commands.prefixes[0]}&8]` || stringmessage === 'Something went wrong while saving the prefix. Please check console.') {
|
||||
prefix = true
|
||||
return
|
||||
}
|
||||
|
||||
else if (stringmessage.startsWith("You now have the tag: ") || stringmessage === "You no longer have a tag") prefix = false
|
||||
|
||||
else if (stringmessage === `Successfully set your skin to ${bot.options.selfcare.skin.player}'s`) {
|
||||
else if (stringmessage === `Successfully set your skin to Parker2991's` || stringmessage === "A player with that username doesn't exist") {
|
||||
skin = true
|
||||
return
|
||||
}
|
||||
else if (stringmessage === 'You have been released!') jail = true
|
||||
else if (stringmessage === 'Jails/Unjails a player, TPs them to the jail specified.') jail = true
|
||||
else if(stringmessage === `You have been jailed!`){
|
||||
jail = false
|
||||
return
|
||||
}
|
||||
|
||||
else if (stringmessage.startsWith("Successfully set your skin to ") || stringmessage === "Successfully removed your skin") skin = false
|
||||
|
||||
|
||||
else if (stringmessage === 'You have been released!') jail = true
|
||||
|
||||
else if (stringmessage === 'Jails/Unjails a player, TPs them to the jail specified.') jail = true
|
||||
|
||||
else if(stringmessage === `You have been jailed!`){
|
||||
jail = false
|
||||
return
|
||||
}
|
||||
|
||||
else if (stringmessage === `Successfully set your username to "${bot.username}"`) {
|
||||
username = true
|
||||
return
|
||||
}//"Successfully set your username to "${bot.username}"""
|
||||
}
|
||||
|
||||
else if (stringmessage.startsWith("Successfully set your username to ")) username = false
|
||||
|
||||
else if (stringmessage === `You already have the username "${bot.username}"`) username = true
|
||||
else if (stringmessage === `You no longer have a nickname.`) {
|
||||
nickname = true
|
||||
|
||||
else if (stringmessage === `You no longer have a nickname.`) {
|
||||
nickname = true
|
||||
return
|
||||
}
|
||||
|
||||
else if (stringmessage.startsWith("Your nickname is now ")) nickname = false
|
||||
// else if (stringmessage === `Error: Nicknames must be alphanumeric.`) nickname = false
|
||||
|
||||
else if (stringmessage === `You no longer have a nickname.`) nickname = false
|
||||
//else if (stringmessage === `That name is already in use.`) nickname = false
|
||||
|
||||
else if (stringmessage === `God mode enabled.`) {
|
||||
god = true
|
||||
return
|
||||
}
|
||||
else if (stringmessage === 'God mode disabled.') god = false
|
||||
else if (stringmessage === `Teleportation enabled.`) {
|
||||
return
|
||||
}
|
||||
|
||||
else if (stringmessage === 'God mode disabled.') god = false
|
||||
else if (stringmessage === `Teleportation enabled.`) {
|
||||
tptoggle = false
|
||||
return
|
||||
}
|
||||
else if (stringmessage === 'Teleportation disabled.') tptoggle = true
|
||||
|
||||
else if(stringmessage === `Vanish for ${bot.options.username}: disabled`) {
|
||||
vanished = false
|
||||
return
|
||||
}
|
||||
else if (stringmessage === `Vanish for ${bot.options.username}: enabled`) vanished = true
|
||||
}
|
||||
/*
|
||||
else if (message?.text !== '' || !Array.isArray(message.extra) || message.extra.length < 2 || !message.extra[0]?.text?.startsWith('Vanish for') || message.extra[0].color !== 'gold') return
|
||||
|
||||
const suffix = message.extra[message.extra.length - 1]
|
||||
|
||||
if (suffix?.color !== 'gold') return
|
||||
//data.toString().startsWith
|
||||
if (suffix.text?.endsWith(': enabled')) vanished = true
|
||||
else if (suffix.text?.endsWith(': disabled')) vanished = false // Bruh what is this ohio code
|
||||
//
|
||||
|
||||
*/
|
||||
else if(stringmessage === `Vanish for ${bot.options.username}: disabled`) {
|
||||
vanished = false
|
||||
return
|
||||
}
|
||||
else if (stringmessage === `Vanish for ${bot.options.username}: enabled`) vanished = true
|
||||
}
|
||||
})
|
||||
|
||||
bot.on('packet.entity_status', packet => {
|
||||
if (packet.entityId !== entityId || packet.entityStatus < 24 || packet.entityStatus > 28) return
|
||||
permissionLevel = packet.entityStatus - 24
|
||||
})//
|
||||
//TO-DO create a array for nick, prefix, and mabe username in selfcare so that when it joins or has the nick/prefix changed it will change it back to the set nick and prefix in selfcare
|
||||
|
||||
})
|
||||
|
||||
bot.on('packet.game_state_change', packet => {
|
||||
if (packet.reason !== 3) return // Reason 3 = Change Game Mode
|
||||
|
||||
|
@ -115,26 +162,49 @@ else if (message?.text !== '' || !Array.isArray(message.extra) || message.extra.
|
|||
gameMode = packet.gameMode
|
||||
|
||||
timer = setInterval(() => {
|
||||
if (permissionLevel < 2 && bot.options.selfcare.op) bot.command('op @s[type=player]')
|
||||
else if (!commandSpyEnabled && bot.options.selfcare.cspy) bot.command('commandspy:commandspy on')
|
||||
else if (unmuted && bot.options.selfcare.unmuted) bot.core.run(`essentials:mute ${bot.uuid}`)
|
||||
else if (!prefix && bot.options.selfcare.prefix) bot.command(`prefix &8[&bPrefix: &4${bot.Commands.prefixes[0]}&8]`)
|
||||
else if (gameMode !== 1 && bot.options.selfcare.gmc) bot.command('gamemode creative @s[type=player]')
|
||||
else if (!skin && bot.options.selfcare.skin.enabled) bot.command(`skin ${bot.options.selfcare.skin.player}`)
|
||||
else if (!username && bot.options.selfcare.username) bot.command(`username ${bot.username}`)
|
||||
else if (!nickname && bot.options.selfcare.nickname) bot.core.run(`nick ${bot.options.username} off`)
|
||||
else if (!god && bot.options.selfcare.god) bot.core.run(`god ${bot.username} on`)
|
||||
else if (!tptoggle && bot.options.selfcare.tptoggle) bot.core.run(`tptoggle ${bot.options.username} off`)
|
||||
else if (!vanished && bot.options.selfcare.vanished) bot.core.run(`essentials:vanish ${bot.username} enable`)
|
||||
//else if (!jail) bot.command(`unjail ${bot.username}`)
|
||||
if (bot.options.isCreayun) {
|
||||
if (!creayunJoin) bot.command(`server creative`)
|
||||
else if (!prefix && bot.options.selfcare.prefix) bot.command(`prefix &8[&bPrefix: &4${bot.Commands.prefixes[0]}&8]`)
|
||||
|
||||
else if (!nickname && bot.options.selfcare.nickname) bot.command(`nick off`)
|
||||
|
||||
else if (!vanished && bot.options.selfcare.vanished) bot.command(`v on`)
|
||||
|
||||
else if (!tptoggle && bot.options.selfcare.tptoggle) bot.command(`tptoggle off`)
|
||||
|
||||
} else if (bot.options.isKaboom) {
|
||||
|
||||
if (permissionLevel < 2 && bot.options.selfcare.op) bot.command('op @s[type=player]')
|
||||
|
||||
else if (!commandSpyEnabled && bot.options.selfcare.cspy) bot.command('commandspy:commandspy on')
|
||||
|
||||
else if (unmuted && bot.options.selfcare.unmuted) bot.core.run(`/essentials:mute ${bot.uuid}`)
|
||||
|
||||
else if (!prefix && bot.options.selfcare.prefix) bot.command(`prefix &8[&bPrefix: &4${bot.Commands.prefixes[0]}&8]`)
|
||||
|
||||
else if (gameMode !== 1 && bot.options.selfcare.gmc) bot.command('gamemode creative @s[type=player]')
|
||||
|
||||
else if (!skin && bot.options.selfcare.skin) bot.command(`skin Parker2991`)
|
||||
|
||||
else if (!username && bot.options.selfcare.username) bot.command(`username ${bot.username}`)
|
||||
|
||||
else if (!nickname && bot.options.selfcare.nickname) bot.core.run(`/nick ${bot.options.username} off`)
|
||||
|
||||
else if (!god && bot.options.selfcare.god) bot.core.run(`/god ${bot.username} on`)
|
||||
|
||||
else if (!tptoggle && bot.options.selfcare.tptoggle) bot.core.run(`/tptoggle ${bot.options.username} off`)
|
||||
|
||||
else if (!vanished && bot.options.selfcare.vanished) bot.core.run(`/essentials:vanish ${bot.username} enable`)
|
||||
//else if (!jail) bot.command(`unjail ${bot.username}`)
|
||||
}
|
||||
}, bot.options.selfcare.interval)
|
||||
})
|
||||
})
|
||||
|
||||
bot.on('end', () => {
|
||||
if (timer) clearInterval(timer)
|
||||
prefix = false
|
||||
muted = false
|
||||
commandSpyEnabled = false
|
||||
commandSpyEnabled = false
|
||||
vanished = false
|
||||
skin = false
|
||||
username = false
|
||||
|
@ -153,4 +223,4 @@ await bot.discord.channel.send(`Starting ${buildstring}`)
|
|||
await sendChat(buildstring)
|
||||
await sendChat('Prefix ~')
|
||||
})
|
||||
}*/
|
||||
}*/
|
||||
|
|
3
src/util/eval/eval.js
Normal file
3
src/util/eval/eval.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
const { Worker } = require('node:worker_threads');
|
||||
const ivm = require('isolated-vm');
|
||||
const { stylize } = require('./eval_colors')
|
|
@ -1,16 +1,16 @@
|
|||
const styles = {
|
||||
bigint: '\xa76',
|
||||
boolean: '\xa76',
|
||||
date: '\xa75',
|
||||
module: '\xa7n',
|
||||
name: undefined,//undefined
|
||||
null: '\xa7l',
|
||||
number: '\xa76',
|
||||
regexp: '\xa74',
|
||||
special: '\xa73',
|
||||
string: '\xa72',
|
||||
symbol: '\xa72',
|
||||
undefined: '\xa78'
|
||||
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) {
|
||||
|
|
220
src/util/urban.js
Normal file
220
src/util/urban.js
Normal file
|
@ -0,0 +1,220 @@
|
|||
'use strict'
|
||||
|
||||
const https = require('https')
|
||||
const querystring = require('querystring')
|
||||
const utilities = require('util')
|
||||
|
||||
const promises = {}
|
||||
const callbacks = {}
|
||||
const methods = {}
|
||||
// ported from the now deleted urban package
|
||||
/**
|
||||
*
|
||||
* @param {string} pathname The API pathname to use.
|
||||
* @param {object} query Optional. An object containing the query data.
|
||||
*/
|
||||
const get = (pathname, query) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const options = {
|
||||
host: 'api.urbandictionary.com',
|
||||
path: (!query ? `/v0/${pathname}` : `/v0/${pathname}?${querystring.stringify(query)}`)
|
||||
}
|
||||
|
||||
const request = https.get(options, (response) => {
|
||||
let data = ''
|
||||
|
||||
response.on('data', (chunk) => {
|
||||
data += chunk
|
||||
})
|
||||
|
||||
response.on('end', () => {
|
||||
let result = null
|
||||
|
||||
try {
|
||||
result = JSON.parse(data)
|
||||
resolve(result)
|
||||
} catch (error) {
|
||||
result = null
|
||||
reject(new Error('Failed to parse retrieved Urban Dictionary JSON.'))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
request.on('error', (error) => {
|
||||
const statusCode = error.status
|
||||
|
||||
if (statusCode === 500) {
|
||||
reject(new Error('Unable to connect to Urban Dictionary API. Their servers may be temporary offline.'))
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const noResults = () => {
|
||||
return new Error('No results found.')
|
||||
}
|
||||
|
||||
promises.autocompleteExtra = async (term) => {
|
||||
if (typeof term !== 'string') {
|
||||
throw new TypeError('term has to be a string.')
|
||||
}
|
||||
|
||||
return get('autocomplete-extra', { term: term }).then((result) => {
|
||||
if (!result.results[0]) {
|
||||
throw noResults()
|
||||
}
|
||||
return result.results
|
||||
}).catch((error) => {
|
||||
throw error
|
||||
})
|
||||
}
|
||||
|
||||
promises.autocomplete = async (term) => {
|
||||
if (typeof term !== 'string') {
|
||||
throw new TypeError('term has to be a string.')
|
||||
}
|
||||
|
||||
return get('autocomplete', { term: term }).then((result) => {
|
||||
if (!result[0]) {
|
||||
throw noResults()
|
||||
}
|
||||
return result
|
||||
}).catch((error) => {
|
||||
throw error
|
||||
})
|
||||
}
|
||||
|
||||
promises.define = async (term) => {
|
||||
if (typeof term !== 'string') {
|
||||
throw new TypeError('term has to be a string.')
|
||||
}
|
||||
|
||||
return get('define', { term: term }).then((result) => {
|
||||
if (!result.list[0]) {
|
||||
throw noResults()
|
||||
}
|
||||
return result.list
|
||||
}).catch((error) => {
|
||||
throw error
|
||||
})
|
||||
}
|
||||
|
||||
promises.getDefinitionByDefid = async (id) => {
|
||||
if (typeof id !== 'number') {
|
||||
throw new TypeError('id has to be a number')
|
||||
}
|
||||
|
||||
return get('define', { defid: id }).then((result) => {
|
||||
if (!result.list[0]) {
|
||||
throw noResults()
|
||||
}
|
||||
return result.list[0]
|
||||
}).catch((error) => {
|
||||
throw error
|
||||
})
|
||||
}
|
||||
|
||||
promises.random = async () => {
|
||||
return get('random').then((result) => {
|
||||
if (!result.list[0]) {
|
||||
throw noResults()
|
||||
}
|
||||
return result.list
|
||||
}).catch((error) => {
|
||||
throw error
|
||||
})
|
||||
}
|
||||
|
||||
promises.wordsOfTheDay = async () => {
|
||||
return get('words_of_the_day').then((result) => {
|
||||
if (!result.list[0]) {
|
||||
throw noResults()
|
||||
}
|
||||
return result.list
|
||||
}).catch((error) => {
|
||||
throw error
|
||||
})
|
||||
}
|
||||
|
||||
// Create callback versions of the promise methods
|
||||
Object.keys(promises).forEach((property) => {
|
||||
callbacks[property] = utilities.callbackify(promises[property])
|
||||
})
|
||||
|
||||
/**
|
||||
* @typedef {object} DefinitionObject
|
||||
* @property {string} author
|
||||
* @property {string} current_vote
|
||||
* @property {string} date
|
||||
* @property {number} defid
|
||||
* @property {string} definition
|
||||
* @property {string} example
|
||||
* @property {string} permalink
|
||||
* @property {string[]} sound_urls
|
||||
* @property {number} thumbs_down
|
||||
* @property {number} thumbs_up
|
||||
* @property {string} word
|
||||
* @property {string} written_on
|
||||
* @param {DefinitionObject}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get an array up to 20 autocomplete extra objects.
|
||||
* @param {string} term
|
||||
* @param {function(error, array):void} callback
|
||||
* @return {promise}
|
||||
*/
|
||||
methods.autocompleteExtra = (term, callback) => {
|
||||
return (!callback ? promises.autocompleteExtra(term) : callbacks.autocompleteExtra(term, callback))
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array up to 20 suggested words by term.
|
||||
* @param {string} term
|
||||
* @param {function(error, array):void} callback
|
||||
* @return {promise}
|
||||
*/
|
||||
methods.autocomplete = (term, callback) => {
|
||||
return (!callback ? promises.autocomplete(term) : callbacks.autocomplete(term, callback))
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array up to 10 definition objects by term.
|
||||
* @param {string} term
|
||||
* @param {function(error, DefinitionObject[]):void} callback
|
||||
* @return {promise}
|
||||
*/
|
||||
methods.define = (term, callback) => {
|
||||
return (!callback ? promises.define(term) : callbacks.define(term, callback))
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a definition object by its defid.
|
||||
* @param {number} defid
|
||||
* @param {function} callback
|
||||
* @return {promise}
|
||||
*/
|
||||
methods.getDefinitionByDefid = (defid, callback) => {
|
||||
return (!callback ? promises.getDefinitionByDefid(defid) : callbacks.getDefinitionByDefid(defid, callback))
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array up to 10 random definition objects.
|
||||
* @param {function(error, DefinitionObject):void} callback
|
||||
* @return {promise}
|
||||
*/
|
||||
methods.random = (callback) => {
|
||||
return (!callback ? promises.random() : callbacks.random(callback))
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of 10 daily definition objects by Words of the Day.
|
||||
* @param {function(error, DefinitionObject):void} callback
|
||||
* @return {promise}
|
||||
*/
|
||||
methods.wordsOfTheDay = (callback) => {
|
||||
return (!callback ? promises.wordsOfTheDay() : callbacks.wordsOfTheDay(callback))
|
||||
}
|
||||
|
||||
module.exports = methods
|
||||
|
10
src/util/usernameGen.js
Normal file
10
src/util/usernameGen.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
function usernameGen () {
|
||||
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\\!@#$%^*(){}[]|\;:,<.>/?§';
|
||||
let username = '';
|
||||
for (let i = 0; i < 9; i++ ) {
|
||||
const randomIndex = Math.floor(Math.random() * characters.length);
|
||||
username += characters[randomIndex];
|
||||
}
|
||||
return username;
|
||||
}
|
||||
module.exports = usernameGen
|
Loading…
Reference in a new issue