v5.0.8
This commit is contained in:
parent
43be2bf86a
commit
6c52e1ec6d
41 changed files with 418 additions and 750 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,7 +6,6 @@ config.yml
|
|||
amog
|
||||
src/commands/kick.js
|
||||
src/modules/exploits.js
|
||||
old
|
||||
src/commands/kick.js
|
||||
prototyping-crap/java/build/
|
||||
prototying-crap/java/.gradle/
|
||||
|
|
14
src/bot.js
14
src/bot.js
|
@ -31,21 +31,14 @@ function createBot(options = {}) {
|
|||
bot.uuid = client.uuid;
|
||||
bot.username = client.username;
|
||||
bot.port = bot.options.port;
|
||||
bot.version = bot.options.version;
|
||||
if (bot.options.isSavage) {
|
||||
await bot.chatDelay(500)
|
||||
bot.command(`register ${bot.savage.password} ${bot.savage.password}`)
|
||||
bot.command(`login ${bot.savage.password}`)
|
||||
}
|
||||
bot.version = bot.options.version;
|
||||
if (bot.options.isCreayun) {
|
||||
}
|
||||
var day = new Date().getDay()
|
||||
if (day === 5) {
|
||||
bot.chat("Gettin' freaky on a Friday Night!")
|
||||
} else if (bot.options.debug.enabled) {
|
||||
bot.chat(`${bot.getMessageAsPrismarine(process.env.buildstring)?.toMotd().replaceAll('§','&')}}&6Debug`)
|
||||
} else {
|
||||
bot.chat(`${bot.getMessageAsPrismarine(process.env.buildstring)?.toMotd().replaceAll('§','&')}`)
|
||||
bot.chat(`&5FNF&bBoyfriend&4Bot &f- &4Parker&02991`)
|
||||
}
|
||||
timer;
|
||||
if (bot.options.useChat) {
|
||||
|
@ -93,7 +86,8 @@ function createBot(options = {}) {
|
|||
|
||||
client.on("error", (error) => {
|
||||
bot?.discord?.channel?.send('Disconnected: ' + '``' + JSON.stringify(error.toString()) + '``')
|
||||
bot.emit("error", error)
|
||||
bot.console.warn(error.toString())
|
||||
// bot.emit("error", error)
|
||||
})
|
||||
});
|
||||
|
||||
|
|
|
@ -35,8 +35,13 @@ function savage (message, data) {
|
|||
}
|
||||
|
||||
function isSeparatorAt (children, start) {
|
||||
return (children[start]?.text === '»' || children[start]?.text === '\xa71»') && children[start + 1]?.text === ' '
|
||||
return (children[start]?.text === '»' || children[start]?.text === '\xa79»\xa7r') && children[start + 1]?.text === ' '
|
||||
}
|
||||
|
||||
module.exports = savage
|
||||
// [prefix]&r [name] [suffix] &9»&r
|
||||
// {DISPLAYNAME} &9»&r {MESSAGE}
|
||||
/*
|
||||
{"extra":[{"text":"e e"},{"text":" "},{"color":"dark_red","text":"Parker"},{"color":"black","text":"2991"},{"text":" "},
|
||||
{"color":"blue","text":"»"},{"text":" "},{"color":"white","text":"duping fucking rank"}],"text":""}
|
||||
*/
|
||||
module.exports = savage;
|
||||
|
||||
|
|
|
@ -7,6 +7,20 @@ const bots = [
|
|||
foundation: "java/mcprotocollib",
|
||||
prefixes: ["#"],
|
||||
},
|
||||
{
|
||||
name: { text: "CddehhBot", color: "red", bold: false },
|
||||
authors: ["CaydennO1","spyingcreeper09"],
|
||||
exclaimer: "WHAT IS THIS GOOFY AAAH FUCKING BOT",
|
||||
foundation: "nodejs/mineflayer",
|
||||
prefixes: [","],
|
||||
},
|
||||
{
|
||||
name: { text: "TurtleBot", color: "green", bold: false },
|
||||
authors: ["TurtleKid"],
|
||||
exclaimer: "nmp when?",
|
||||
foundation: "nodejs/mineflayer",
|
||||
prefixes: ["\\"],
|
||||
},
|
||||
{
|
||||
name: { text: "NothingBot", color: "dark_red", bold: false },
|
||||
authors: ["Yaode_owo"],
|
||||
|
@ -157,7 +171,7 @@ const bots = [
|
|||
{
|
||||
name: { text: "ChomeNS Bot Java", color: "yellow", bold: false },
|
||||
authors: ["chayapak"],
|
||||
exclaimer: "wow its my bot !! ! 4374621q43567%^&#%67868-- chayapak",
|
||||
exclaimer: "wow its my bot !! ! 4374621q43567%^&#%67868-- chayapak \n rip ChomeNS bot i wonder what chayapak is currently doing -- Parker2991",
|
||||
foundation: "Java/MCProtocolLib",
|
||||
prefixes: ["*", "cbot ", "/cbot "],
|
||||
},
|
||||
|
|
|
@ -77,6 +77,12 @@ const bots = [
|
|||
foundation: '5/1/24',
|
||||
exclaimer:'added discord execute, redone the website command, added attachments for discord ported the urban package to the bot added ping',
|
||||
},
|
||||
{//
|
||||
name: { text: 'v5.0.8', color: 'dark_red', bold:false },
|
||||
authors: ['Censory Overload'],
|
||||
foundation: '6/4/24',
|
||||
exclaimer:'rewritten the urban command to use undici removed the music command changed the colors for the help command and more',
|
||||
},
|
||||
]//
|
||||
//back
|
||||
|
||||
|
|
|
@ -20,59 +20,25 @@ module.exports = {
|
|||
switch (args[0]) {
|
||||
case "message":
|
||||
case 'msg':
|
||||
const component = {
|
||||
translate: '[%s] %s %s %s %s %s',
|
||||
with: [
|
||||
{
|
||||
translate: '%s%s%s',
|
||||
bold:false,
|
||||
with: [
|
||||
{
|
||||
text: 'FNF',
|
||||
bold: true,
|
||||
color: 'dark_purple'
|
||||
|
||||
},
|
||||
{
|
||||
text: 'Boyfriend',
|
||||
bold: true,
|
||||
color: 'aqua'
|
||||
},
|
||||
{
|
||||
text: 'Bot',
|
||||
bold: true,
|
||||
color: 'dark_red'
|
||||
},
|
||||
],
|
||||
clickEvent: bot.options.Core.customName ? { action: 'open_url', value: bot.options.Core.customName } : undefined,
|
||||
hoverEvent: { action: 'show_text', contents: `idfk what to put here` }
|
||||
},
|
||||
{
|
||||
text:'Hello, World!,'
|
||||
},{
|
||||
text:'Player:'
|
||||
},
|
||||
|
||||
|
||||
context?.source?.player?.displayName ?? context?.source?.player?.profile?.name,
|
||||
{
|
||||
text:`, uuid: ${uuid ?? context?.source?.player?.uuid } , `
|
||||
},
|
||||
//entry.displayName
|
||||
{text:`Argument: ${args.slice(1).join(' ')}`}
|
||||
]//command.split(' ')[0]
|
||||
}//context.source.player.displayName ?? context.source.player.profile.name
|
||||
|
||||
//ChatMessage.fromNotch(`${process.env["buildstring"]}`).toMotd().replaceAll('§', '&')
|
||||
|
||||
if (bot.options.isCreayun || bot.options.useChat) {
|
||||
bot.chat(`Hello, World!, Player: ${bot.getMessageAsPrismarine(context.source.player.displayName ?? context.source.player.profile.name).toMotd().replaceAll('§', '&')}, uuid: ${context.source.player.uuid}, Argument: ${args.slice(1).join(' ')}`)
|
||||
|
||||
if (bot.options.isCreayun || bot.options.useChat || bot.options.isSavage) {
|
||||
bot.chat(`Hello, World!, Player: ${bot.getMessageAsPrismarine(context.source.player.displayName ?? context.source.player.profile.name).toMotd().replaceAll('§', '&')}, uuid: ${context.source.player.uuid}, Argument: ${args.slice(1).join(' ')}`)
|
||||
} else {
|
||||
bot.tellraw([component])
|
||||
bot.tellraw([
|
||||
{
|
||||
text: `Hello, World!, Player: ${bot.getMessageAsPrismarine(context.source.player.displayName ?? context.source.player.profile.name)?.toMotd()}§r`,
|
||||
color: 'gray',
|
||||
bold: false
|
||||
},
|
||||
{
|
||||
text: ` Args: ${args.slice(1).join(' ')}`,
|
||||
color: 'gray',
|
||||
bold: false,
|
||||
}
|
||||
])
|
||||
}
|
||||
break
|
||||
case 'error':
|
||||
case 'err':
|
||||
throw new Error(args.slice(1).join(' '))
|
||||
break
|
||||
default:
|
||||
|
|
|
@ -2,7 +2,7 @@ const CommandError = require('../CommandModules/command_error');
|
|||
module.exports = {
|
||||
name: 'echo',
|
||||
description:['make me say something in chat'],
|
||||
aliases:['chatsay'],
|
||||
aliases:['chatsay', 'say', 'botsay'],
|
||||
trustLevel: 0,
|
||||
usage:[
|
||||
"<command/message>",
|
||||
|
@ -31,4 +31,4 @@ module.exports = {
|
|||
|
||||
bot.chat(message)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ module.exports = {
|
|||
name: 'eval',
|
||||
description:['run code via isolated vm, exclaimer: amcforum members had a shitfit over this command'],
|
||||
aliases:['ivm'],
|
||||
trustLevel: 0,
|
||||
trustLevel: -1,
|
||||
usage:[
|
||||
"<code>",
|
||||
],
|
||||
|
|
|
@ -39,40 +39,34 @@ module.exports = {
|
|||
|
||||
const command = bot.commandManager.commandlist[commands]
|
||||
|
||||
if (args[0].toLowerCase() === command.name)
|
||||
|
||||
|
||||
|
||||
{
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}//bot.getMessageAsPrismarine([cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole])?.toAnsi()
|
||||
if (args[0].toLowerCase() === command.name) {
|
||||
//}//bot.getMessageAsPrismarine([cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole])?.toAnsi()
|
||||
|
||||
valid = true
|
||||
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'}])
|
||||
bot.sendFeedback([{text:`Trust levels: -1 = disabled, 0 = public, 1 = trusted, 2 = owner, 3 = console`,color:`${bot.Commands.colors.help.t_rustedColor}`}])
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({text: `${bot.Commands.prefixes[0]}${command.name} `,color:'#00ffff'})
|
||||
bot.sendFeedback({text: `${bot.Commands.prefixes[0]}${command.name} `,color:`${bot.Commands.colors.help.pub_lickColor}`})
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({text:`Aliases`,color:'dark_purple'})
|
||||
bot.sendFeedback({text:`Aliases`,color:`${bot.Commands.colors.help.t_rustedColor}`})
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({text:`${command.aliases}`,color:'dark_purple'})
|
||||
bot.sendFeedback({text:`${command.aliases}`,color:`${bot.Commands.colors.help.t_rustedColor}`})
|
||||
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'}])
|
||||
bot.sendFeedback([{text:`Trust Level: `,color:`${bot.Commands.colors.help.pub_lickColor}`},{text:`${command.trustLevel}`,color:`${bot.Commands.colors.help.t_rustedColor}`}])
|
||||
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'}])
|
||||
bot.sendFeedback([{text:`Usage: `,color:`${bot.Commands.colors.help.pub_lickColor}`},{text:`${bot.Commands.prefixes[0]}${command.name} <owner hash> `,color:`${bot.Commands.colors.help.t_rustedColor}`},{text:`${command.usage}`,color:`${bot.Commands.colors.help.own_herColor}`}])
|
||||
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'}])
|
||||
bot.sendFeedback([{text:`Usage: `,color:`${bot.Commands.colors.help.pub_lickColor}`},{text:`${bot.Commands.prefixes[0]}${command.name} <trusted/owner hash> `,color:`${bot.Commands.colors.help.t_rustedColor}`},{text:`${command.usage}`,color:`${bot.Commands.colors.help.own_herColor}`}])
|
||||
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'}])
|
||||
bot.sendFeedback([{text:`Usage: `,color:`${bot.Commands.colors.help.pub_lickTheme}`},{text:`${bot.Commands.prefixes[0]}${command.name} `,color:`${bot.Commands.colors.help.t_rustedColor}`},{text:`${command.usage}`,color:`${bot.Commands.colors.help.own_herColor}`}])
|
||||
await bot.chatDelay(100)
|
||||
}
|
||||
|
||||
|
@ -101,16 +95,16 @@ const command = bot.commandManager.commandlist[commands]
|
|||
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'}])
|
||||
bot.sendFeedback([cmd,{text:`Trust levels: -1 = disabled, 0 = public, 1 = trusted, 2 = owner, 3 = console`,color:`${bot.Commands.colors.help.t_rustedColor}`}])
|
||||
bot.sendFeedback([cmd, {text:`${bot.Commands.prefixes[0]}${command.name} `,color:`${bot.Commands.colors.help.pub_lickColor}`},{text:`(Aliases: ${command.aliases}) › ${command.description}`,color:`${bot.Commands.colors.help.t_rustedColor}`}])
|
||||
bot.sendFeedback([cmd,{text:`Trust Level: `,color:`${bot.Commands.colors.help.pub_lickColor}`},{text:`${command.trustLevel}`,color:`${bot.Commands.colors.help.t_rustedColor}`}])
|
||||
|
||||
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'}])
|
||||
bot.sendFeedback([cmd,{text:`Usage: `,color:`${bot.Commands.colors.help.pub_lickColor}`},{text:`${bot.Commands.prefixes[0]}${command.name} <owner hash> `,color:`${bot.Commands.colors.help.t_rustedColor}`},{text:`${command.usage}`,color:`${bot.Commands.colors.help.own_herColor}`}])
|
||||
} 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'}])
|
||||
bot.sendFeedback([cmd,{text:`Usage: `,color:`${bot.Commands.colors.help.pub_lickColor}`},{text:`${bot.Commands.prefixes[0]}${command.name} <trusted/owner hash> `,color:`${bot.Commands.colors.help.t_rustedColor}`},{text:`${command.usage}`,color:`${bot.Commands.colors.help.own_herColor}`}])
|
||||
} else {
|
||||
bot.sendFeedback([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.Commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])
|
||||
bot.sendFeedback([cmd,{text:`Usage: `,color:`${bot.Commands.colors.help.pub_lickColor}`},{text:`${bot.Commands.prefixes[0]}${command.name} `,color:`${bot.Commands.colors.help.t_rustedColor}`},{text:`${command.usage}`,color:`${bot.Commands.colors.help.own_herColor}`}])
|
||||
}
|
||||
}
|
||||
break
|
||||
|
@ -287,11 +281,11 @@ bot.console.info([cmd, 'Commands (', JSON.stringify(CommandManager.commandlist.l
|
|||
|
||||
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)')
|
||||
await bot.chatDelay(100)
|
||||
await bot.chatDelay(200)
|
||||
bot.chat(`${bot.getMessageAsPrismarine(pub_lick)?.toMotd().replaceAll(',','')}`)
|
||||
await bot.chatDelay(100)
|
||||
await bot.chatDelay(200)
|
||||
bot.chat(`${bot.getMessageAsPrismarine(t_rust)?.toMotd().replaceAll(',','')}`)
|
||||
await bot.chatDelay(100)
|
||||
await bot.chatDelay(200)
|
||||
bot.chat(`${bot.getMessageAsPrismarine(own_her)?.toMotd().replaceAll(',','')}`)
|
||||
|
||||
|
||||
|
@ -428,5 +422,4 @@ throw new CommandError(`Unknown command ${args[0]}. type "${bot.Discord.commandP
|
|||
bot?.discord?.Message.react('♋')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -65,32 +65,32 @@ switch(args.join(' ').toLowerCase()) {
|
|||
bot.chat(`Discord ${bot.discord.invite}`)
|
||||
await bot.chatDelay(1500)
|
||||
} 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: 'Discord Invite', color: "gray", translate: "", hoverEvent: { action: "show_text", value: [ { text: "click here to join!", color: "gray", }, ], }, clickEvent: { action: "open_url", value: `${bot.discord.invite}`, }, });
|
||||
}
|
||||
break
|
||||
case 'server':
|
||||
if (bot.options.useChat && !bot.options.isCreayun) {
|
||||
bot.sendFeedback({ color: "dark_gray", text: `Hostname \u203a ${os.hostname()}`, })
|
||||
bot.sendFeedback({ color: "gray", text: `Hostname \u203a ${os.hostname()}`, })
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({ color: "dark_gray", text: `Working Directory \u203a ${process.mainModule.path}`, });
|
||||
bot.sendFeedback({ color: "gray", text: `Working Directory \u203a ${process.mainModule.path}`, });
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({ color: "dark_gray", text: `${os.arch()}`})
|
||||
bot.sendFeedback({ color: "gray", text: `${os.arch()}`})
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({ color: "dark_gray", text:`OS \u203a ${os.platform()}`})
|
||||
bot.sendFeedback({ color: "gray", text:`OS \u203a ${os.platform()}`})
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({ color: "dark_gray", text: `OS Version/distro \u203a ${os.version()}`, });
|
||||
bot.sendFeedback({ color: "gray", text: `OS Version/distro \u203a ${os.version()}`, });
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({ color: "dark_gray", text: `Kernal Version \u203a ${os.release()}`, });
|
||||
bot.sendFeedback({ color: "gray", text: `Kernal Version \u203a ${os.release()}`, });
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({ color: "dark_gray", text: `cores \u203a ${os.cpus().length}`, });
|
||||
bot.sendFeedback({ color: "gray", text: `cores \u203a ${os.cpus().length}`, });
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({ color: "dark_gray", text: `CPU \u203a ${os.cpus()[0].model}`, });
|
||||
bot.sendFeedback({ color: "gray", text: `CPU \u203a ${os.cpus()[0].model}`, });
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback([{text:`Server Free memory `, color:'dark_gray'},{text:`${Math.floor( os.freemem() / 1048576, )} `,color:'dark_gray'},{text: `MiB / ${Math.floor(os.totalmem() / 1048576)} MiB`, color:'dark_gray'}]);
|
||||
bot.sendFeedback([{text:`Server Free memory `, color:'gray'},{text:`${Math.floor( os.freemem() / 1048576, )} `,color:'gray'},{text: `MiB / ${Math.floor(os.totalmem() / 1048576)} MiB`, color:'gray'}]);
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({text:`Device uptime \u203a ${format(os.uptime())}`,color:'dark_gray'})
|
||||
bot.sendFeedback({text:`Device uptime \u203a ${format(os.uptime())}`,color:'gray'})
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback({text:`Node version \u203a ${process.version}`,color:'dark_gray'})
|
||||
bot.sendFeedback({text:`Node version \u203a ${process.version}`,color:'gray'})
|
||||
} else if (bot.options.isCreayun) {
|
||||
bot.chat(`Host \u203a ${os.hostname()}`)
|
||||
await bot.chatDelay(1500)
|
||||
|
@ -114,17 +114,17 @@ switch(args.join(' ').toLowerCase()) {
|
|||
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}`, });
|
||||
bot.sendFeedback({ color: "dark_gray", text: `${os.arch()}`})
|
||||
bot.sendFeedback({ color: "dark_gray", text:`OS \u203a ${os.platform()}`})
|
||||
bot.sendFeedback({ color: "dark_gray", text: `OS Version/distro \u203a ${os.version()}`, });
|
||||
bot.sendFeedback({ color: "dark_gray", text: `Kernal Version \u203a ${os.release()}`, });
|
||||
bot.sendFeedback({ color: "dark_gray", text: `cores \u203a ${os.cpus().length}`, });
|
||||
bot.sendFeedback({ color: "dark_gray", text: `CPU \u203a ${os.cpus()[0].model}`, });
|
||||
bot.sendFeedback([{text:`Server Free memory `, color:'dark_gray'},{text:`${Math.floor( os.freemem() / 1048576, )} `,color:'dark_gray'},{text: `MiB / ${Math.floor(os.totalmem() / 1048576)} MiB`, color:'dark_gray'}]);
|
||||
bot.sendFeedback({text:`Device uptime \u203a ${format(os.uptime())}`,color:'dark_gray'})
|
||||
bot.sendFeedback({text:`Node version \u203a ${process.version}`,color:'dark_gray'})
|
||||
bot.sendFeedback({ color: "gray", text: `Hostname \u203a ${os.hostname()}`, });
|
||||
bot.sendFeedback({ color: "gray", text: `Working Directory \u203a ${process.mainModule.path}`, });
|
||||
bot.sendFeedback({ color: "gray", text: `${os.arch()}`})
|
||||
bot.sendFeedback({ color: "gray", text:`OS \u203a ${os.platform()}`})
|
||||
bot.sendFeedback({ color: "gray", text: `OS Version/distro \u203a ${os.version()}`, });
|
||||
bot.sendFeedback({ color: "gray", text: `Kernal Version \u203a ${os.release()}`, });
|
||||
bot.sendFeedback({ color: "gray", text: `cores \u203a ${os.cpus().length}`, });
|
||||
bot.sendFeedback({ color: "gray", text: `CPU \u203a ${os.cpus()[0].model}`, });
|
||||
bot.sendFeedback([{text:`Server Free memory `, color:'gray'},{text:`${Math.floor( os.freemem() / 1048576, )} `,color:'gray'},{text: `MiB / ${Math.floor(os.totalmem() / 1048576)} MiB`, color:'gray'}]);
|
||||
bot.sendFeedback({text:`Device uptime \u203a ${format(os.uptime())}`,color:'gray'})
|
||||
bot.sendFeedback({text:`Node version \u203a ${process.version}`,color:'gray'})
|
||||
}
|
||||
break
|
||||
case 'loaded':
|
||||
|
@ -143,17 +143,17 @@ 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'}])
|
||||
// source.sendFeedback([{text:'Package Count \u203a ',color:'gray'},{text:`${Object.keys(packageJSON.dependencies).length}`,color:'gold'}])
|
||||
if (bot.options.useChat && !bot.options.isCreayun) {
|
||||
bot.sendFeedback([{text:'Package Count \u203a ', color:'dark_gray'},{text:`${Object.keys(packageJSON.dependencies).length}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:'Package Count \u203a ', color:'gray'},{text:`${Object.keys(packageJSON.dependencies).length}`,color:'gold'}])
|
||||
} 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'}])
|
||||
// bot.sendFeedback([{text:'Packages \u203a ',color:'gray'},{text:`${Object.entries(packageJSON.dependencies).map((key, value) => key + ' ' + value).join(' ')}`}])
|
||||
bot.sendFeedback([{text:'Package Count \u203a ', color:'gray'},{text:`${Object.keys(packageJSON.dependencies).length}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:'File count ',color:'gray'},{text:'(',color:'dark_blue'},{text:`${FileCount}`,color:'gold'},{text:')',color:'dark_blue'}])
|
||||
}
|
||||
break
|
||||
case 'time':
|
||||
|
@ -165,62 +165,62 @@ if (bot.options.isCreayun) {
|
|||
break
|
||||
case 'login':
|
||||
if (bot.options.useChat) {
|
||||
bot.sendFeedback({text:`Minecraft Username \u203a ${bot.options.username}`,color:'dark_gray'})
|
||||
bot.sendFeedback({text:`Minecraft Username \u203a ${bot.options.username}`,color:'gray'})
|
||||
await bot.chatDelay(150)
|
||||
bot.sendFeedback({text: `uuid \u203a ${bot.uuid}`,color:'dark_gray'})
|
||||
bot.sendFeedback({text: `uuid \u203a ${bot.uuid}`,color:'gray'})
|
||||
await bot.chatDelay(150)
|
||||
/*if(bot.discord === undefined){
|
||||
bot.sendFeedback({text:'Currently not logged into discord',color:'dark_red'})
|
||||
await bot.chatDelay(150)
|
||||
}else{
|
||||
bot.sendFeedback({text:`Discord Username \u203a ${bot.discord.client.user.username + '#' + bot.discord.client.user.discriminator}`,color:'dark_gray'})
|
||||
bot.sendFeedback({text:`Discord Username \u203a ${bot.discord.client.user.username + '#' + bot.discord.client.user.discriminator}`,color:'gray'})
|
||||
await bot.chatDelay(150)
|
||||
} */
|
||||
await bot.chatDelay(150)
|
||||
await bot.chatDelay(150)
|
||||
bot.sendFeedback({text:`Server \u203a ${bot.options.serverName}`,color:'dark_gray'})
|
||||
bot.sendFeedback({text:`Server \u203a ${bot.options.serverName}`,color:'gray'})
|
||||
await bot.chatDelay(150)
|
||||
bot.sendFeedback({text:`Server IP \u203a ${bot.options.host + ':' + bot.options.port}`,color:'dark_gray'})
|
||||
bot.sendFeedback({text:`Server IP \u203a ${bot.options.host + ':' + bot.options.port}`,color:'gray'})
|
||||
await bot.chatDelay(150)
|
||||
source.sendFeedback({text:`Version \u203a ${bot.options.version}`,color:'dark_gray'})
|
||||
source.sendFeedback({text:`Version \u203a ${bot.options.version}`,color:'gray'})
|
||||
} else {
|
||||
bot.sendFeedback({text:`Minecraft Username \u203a ${bot.options.username}`,color:'dark_gray'})
|
||||
bot.sendFeedback({text: `uuid \u203a ${bot.uuid}`,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:`Minecraft Username \u203a ${bot.options.username}`,color:'gray'})
|
||||
bot.sendFeedback({text: `uuid \u203a ${bot.uuid}`,color:'gray'})
|
||||
bot.sendFeedback({text:`Server \u203a ${bot.options.serverName}`,color:'gray'})
|
||||
bot.sendFeedback({text:`Server IP \u203a ${bot.options.host + ':' + bot.options.port}`,color:'gray'})
|
||||
bot.sendFeedback({text:`Version \u203a ${bot.options.version}`,color:'gray'})
|
||||
bot.sendFeedback({text:`Discord channel \u203a ${bot.discord.channel.name}`,color:'gray'})
|
||||
bot.sendFeedback({text:`Discord Username \u203a ${bot.discord.client.user.username + '#' + bot.discord.client.user.discriminator}`,color:'gray'})
|
||||
}
|
||||
break
|
||||
case 'config':
|
||||
if (bot.options.useChat) {
|
||||
bot.sendFeedback({text:`Prefixes \u203a ${bot.Commands.prefixes}`,color:'dark_gray'})
|
||||
bot.sendFeedback({text:`Prefixes \u203a ${bot.Commands.prefixes}`,color:'gray'})
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback([{text:`Core enabled? `,color:'dark_gray'},{text:`${bot.options.Core.enabled}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:`Core enabled? `,color:'gray'},{text:`${bot.options.Core.enabled}`,color:'gold'}])
|
||||
await bot.chatDelay(100)
|
||||
//bot.sendFeedback([{text:'Discord enabled? ',color:'dark_gray'},{text:`${bot.Discord.enabled}`,color:'gold'}])
|
||||
//bot.sendFeedback([{text:'Discord enabled? ',color:'gray'},{text:`${bot.Discord.enabled}`,color:'gold'}])
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback([{text:'Console logging enabled? ',color:'dark_gray'},{text:`${bot.options.Console.enabled}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:'Console logging enabled? ',color:'gray'},{text:`${bot.options.Console.enabled}`,color:'gold'}])
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback([{text:'Chat filelogging enabled? ',color:'dark_gray'},{text:`${bot.Console.filelogging}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:'Chat filelogging enabled? ',color:'gray'},{text:`${bot.Console.filelogging}`,color:'gold'}])
|
||||
await bot.chatDelay(100)
|
||||
bot.sendFeedback([{text:'Multiconnect Server count \u203a ',color:'dark_gray'},{text:`${Object.keys(bot.bots).length}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:'Multiconnect Server count \u203a ',color:'gray'},{text:`${Object.keys(bot.bots).length}`,color:'gold'}])
|
||||
} 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:'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:`Prefixes \u203a ${bot.Commands.prefixes}`,color:'gray'})
|
||||
bot.sendFeedback([{text:`Core enabled? `,color:'gray'},{text:`${bot.options.Core.enabled}`,color:'gold'}])
|
||||
// bot.sendFeedback([{text:'Discord enabled? ',color:'gray'},{text:`${bot.Discord.enabled}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:'Console logging enabled? ',color:'gray'},{text:`${bot.options.Console.enabled}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:'Chat filelogging enabled? ',color:'gray'},{text:`${bot.Console.filelogging}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:'Multiconnect Server count \u203a ',color:'gray'},{text:`${Object.keys(bot.bots).length}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:'Discord enabled? ',color:'gray'},{text:`${bot.Discord.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'}])
|
||||
bot.sendFeedback([{text:`${format(process.uptime())}`,color:'gray'}])
|
||||
}
|
||||
break
|
||||
case 'contributors':
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
const CommandError = require('../CommandModules/command_error')
|
||||
module.exports = {
|
||||
name: 'end',
|
||||
description:['end the bots process'],
|
||||
trustLevel: 1,
|
||||
aliases:['kys','kill','suicide'],
|
||||
name: 'kill',
|
||||
description:['kills the bots process'],
|
||||
trustLevel: 2,
|
||||
aliases:['stop','kill','suicide'],
|
||||
usage:[""],
|
||||
async execute (context) {
|
||||
const bot = context.bot
|
|
@ -6,36 +6,15 @@ module.exports = {
|
|||
aliases:['networkmessage'],
|
||||
usage:["<message>"],
|
||||
execute (context) {
|
||||
|
||||
const message = context.arguments.join(' ')
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
const source = context.source
|
||||
//throw new CommandError('ohio')
|
||||
const component = {
|
||||
translate: '%s [%s] %s \u203a %s',
|
||||
color: 'dark_gray',
|
||||
translate: '[%s] %s \u203a %s',
|
||||
color: '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.bot.options.serverName,
|
||||
context?.source?.player?.displayName ?? context?.source?.player?.profile?.name,
|
||||
message
|
||||
]
|
||||
|
@ -57,4 +36,4 @@ module.exports = {
|
|||
context.source.player.displayName ?? context.source.player.profile.name,
|
||||
message
|
||||
[%s%s%s] [%s] %s \u203a %s
|
||||
*/
|
||||
*/
|
|
@ -1,39 +1,58 @@
|
|||
const CommandError = require('../CommandModules/command_error')
|
||||
const util = require('util')
|
||||
const { stylize } = require('../util/eval_colors')
|
||||
const CommandError = require('../CommandModules/command_error');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const util = require('util');
|
||||
const { stylize } = require('../util/eval_colors');
|
||||
module.exports = {
|
||||
name: 'playerinfo',
|
||||
description:[''],
|
||||
aliases:[],
|
||||
trustLevel: 0,
|
||||
usage:[
|
||||
"",
|
||||
],
|
||||
description:['check player info'],
|
||||
aliases:[],
|
||||
trustLevel: 0,
|
||||
usage:[
|
||||
"<player>",
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
try{
|
||||
//const player = bot.players.find(player => player.profile.name === `${args.join(' ')}`)
|
||||
const player = bot.players.find(player => player.profile.name === `${args.join(' ')}`)
|
||||
//bot.players.map(pl => pl.profile.name).filter((name) => name == "Ski")
|
||||
if(player === undefined) {
|
||||
|
||||
bot.tellraw('Unknown Player')
|
||||
}else{
|
||||
bot.sendFeedback([{text:`Player Name: `,color:'dark_gray'},{text:`${player.profile.name}`}])
|
||||
bot.sendFeedback([{text:`Player UUID: `,color:'dark_gray'},{text:`${player.uuid}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:`Player Gamemode: `,color:'dark_gray'},{text:`${player.gamemode}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:`Player Latency: `,color:'dark_gray'},{text:`${player.latency}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:`Player DisplayName: `,color:'dark_gray'},{text:`${bot.getMessageAsPrismarine(player.displayName ?? player.profile.name)?.toMotd().replaceAll('§','§')}`}])
|
||||
}
|
||||
}catch(e){
|
||||
bot.tellraw(`${e}`)
|
||||
}//bot.players.find(player => player.profile.name === `Ski`); bot.getMessageAsPrismarine(e.displayName)?.toMotd().replaceAll('§','§')
|
||||
},
|
||||
discordExecute(context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
}
|
||||
}
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const player = bot.players.find(player => player.profile.name === `${args.join(' ')}`);
|
||||
try {
|
||||
if (player === undefined) {
|
||||
bot.tellraw('Unknown Player')
|
||||
} else {
|
||||
bot.sendFeedback([{text:`Player Name: `,color:'gray'},{text:`${player.profile.name}`}])
|
||||
bot.sendFeedback([{text:`Player UUID: `,color:'gray'},{text:`${player.uuid}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:`Player Gamemode: `,color:'gray'},{text:`${player.gamemode}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:`Player Latency: `,color:'gray'},{text:`${player.latency}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:`Player DisplayName: `,color:'gray'},{text:`${bot.getMessageAsPrismarine(player.displayName ?? player.profile.name)?.toMotd().replaceAll('§','§')}`}])
|
||||
}
|
||||
} catch(e) {
|
||||
bot.tellraw(`${e}`)
|
||||
}
|
||||
},
|
||||
discordExecute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const player = bot.players.find(player => player.profile.name === `${args.join(' ')}`);
|
||||
/*
|
||||
bot.sendFeedback([{text:`Player Name: `,color:'dark_gray'},{text:`${player.profile.name}`}])
|
||||
bot.sendFeedback([{text:`Player UUID: `,color:'dark_gray'},{text:`${player.uuid}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:`Player Gamemode: `,color:'dark_gray'},{text:`${player.gamemode}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:`Player Latency: `,color:'dark_gray'},{text:`${player.latency}`,color:'gold'}])
|
||||
bot.sendFeedback([{text:`Player DisplayName: `,color:'dark_gray'},{text:`${bot.getMessageAsPrismarine(player.displayName ?? player.profile.name)?.toMotd().replaceAll('§','§')}`}])
|
||||
*/
|
||||
try {
|
||||
if (player === undefined) {
|
||||
throw new CommandError('Player not found')
|
||||
} else {
|
||||
let Embed = new EmbedBuilder()
|
||||
.setColor(`${bot.Commands.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription('```ansi\n' + bot.getMessageAsPrismarine([{text:`Player Name: `,color:'gray'},{text:`${player.profile.name}`},{text:`\nPlayer UUID: `,color:'gray'},{text:`${player.uuid}`,color:'gold'},{text:`\nPlayer Gamemode: `,color:'gray'},{text:`${player.gamemode}`,color:'gold'},{text:`\nPlayer Latency: `,color:'gray'},{text:`${player.latency}`,color:'gold'},{text:`\nPlayer DisplayName: `,color:'gray'},{text:`${bot.getMessageAsPrismarine(player.displayName ?? player.profile.name)?.toMotd().replaceAll('§','§')}`}])?.toAnsi().replaceAll('`', '`\u200b') + '```')
|
||||
bot.discord.Message.reply({ embeds: [Embed] })
|
||||
}
|
||||
} catch (e) {
|
||||
bot.discord.Message.reply(e.toString())
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ module.exports = {
|
|||
name: 'reconnect',
|
||||
description:['reconnect the bot when?'],
|
||||
trustLevel: 1,
|
||||
aliases:['rec'],
|
||||
aliases:['rec', 'end', 'reconnect-client'],
|
||||
usage:[""],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
|
|
|
@ -13,8 +13,9 @@ module.exports = {
|
|||
try {
|
||||
|
||||
// bot.sendFeedback({text:'Reloading crap'});
|
||||
for (const eachBot of bot.bots)
|
||||
eachBot.reload()
|
||||
for (const eachBot of bot.bots) {
|
||||
eachBot.commandReload()
|
||||
}
|
||||
} catch(e) {
|
||||
bot.sendFeedback(e.stack)
|
||||
}
|
||||
|
@ -33,8 +34,9 @@ discordExecute(context) {
|
|||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`reloading crap`)
|
||||
bot.discord.Message.reply({ embeds: [Embed] })
|
||||
for (const eachBot of bot.bots)
|
||||
eachBot.reload()
|
||||
for (const eachBot of bot.bots) {
|
||||
eachBot.commandReload()
|
||||
}
|
||||
} catch(e) {
|
||||
throw new CommandError(e.stack)
|
||||
}
|
||||
|
|
|
@ -10,26 +10,24 @@ module.exports = {
|
|||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
const ls = spawn('sh' , ['-c', `${args.slice(1).join(' ')}`]);
|
||||
const command = spawn('sh' , ['-c', `${args.slice(1).join(' ')}`]);
|
||||
try {
|
||||
ls.stdout.on('data', (data, err) => {
|
||||
command.stdout.on('data', (data, err) => {
|
||||
bot.tellraw(`${bot.getMessageAsPrismarine(`${data}`)?.toMotd().replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '')}`);
|
||||
console.log(err)
|
||||
});
|
||||
|
||||
ls.on('close', (data) => {
|
||||
command.on('close', (data) => {
|
||||
console.log(`child process close all stdio with code ${data}`);
|
||||
});
|
||||
|
||||
ls.on('err', (err) => {
|
||||
console.log(err);
|
||||
})
|
||||
|
||||
ls.on('exit', (code) => {
|
||||
command.stderr.on('data', (data) => {
|
||||
bot.tellraw(data.toString());
|
||||
});
|
||||
command.on('exit', (code) => {
|
||||
console.log(`child process exited with code ${code}`);
|
||||
});
|
||||
} catch (e) {
|
||||
bot.tellraw(e.toString())
|
||||
bot.sendError(e.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,9 +11,9 @@ module.exports = {
|
|||
const source = context.source;
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
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.Commands.colors.help.pub_lickColor = 'white'
|
||||
bot.Commands.colors.help.t_rustedColor = 'white'
|
||||
bot.Commands.colors.help.own_herColor = 'white'
|
||||
bot.sendFeedback(`Reseting theme colors,.,.,..`)
|
||||
} else {
|
||||
bot.Commands.colors.help.pub_lickColor = args[0]
|
||||
|
@ -29,4 +29,4 @@ pub_lickColor:"#00FFFF",
|
|||
t_rustedColor:"dark_purple",
|
||||
own_herColor:"dark_red",
|
||||
},
|
||||
*/
|
||||
*/
|
|
@ -1,6 +1,6 @@
|
|||
const CommandError = require('../CommandModules/command_error')
|
||||
const ud = require('../util/urban')
|
||||
const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, SlashCommandBuilder } = require('discord.js')
|
||||
const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, SlashCommandBuilder } = require('discord.js');
|
||||
const { request } = require('undici');
|
||||
module.exports = {
|
||||
name: 'urban',
|
||||
description:['urban dictionary'],
|
||||
|
@ -14,60 +14,77 @@ module.exports = {
|
|||
const source = context.source
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
const cmdPrefix = [
|
||||
const prefix = [
|
||||
{ text: '[', color: 'dark_gray' },
|
||||
{ text: 'Urban', color: '#B72A00' },
|
||||
{ text: '] ', color: 'dark_gray'}
|
||||
]
|
||||
try {
|
||||
let definitions = await ud.define(args.join(' '))
|
||||
for (const def of definitions) {
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat(bot.getMessageAsPrismarine([{text: '[Example] ',color:'dark_gray'},{ text: def.example.replaceAll('\r',''), color: 'dark_gray' }])?.toMotd().replaceAll('§','&'))
|
||||
await bot.chatDelay(100)
|
||||
bot.chat(bot.getMessageAsPrismarine([{text:'[Definition] ',color:'dark_gray'},{text: def.definition.replaceAll("\r", ""), color: 'dark_gray' }])?.toMotd().replaceAll('§','&'))
|
||||
} else {
|
||||
bot.tellraw([cmdPrefix, { text: def.example.replaceAll('\r',''), color: 'dark_gray' }])
|
||||
bot.tellraw([cmdPrefix, { text: def.definition.replaceAll("\r", ""), 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'}])
|
||||
bot.tellraw([cmdPrefix,{text:`👍 ${definitions[0].thumbs_up} | 👎 ${definitions[0].thumbs_down}`, color:'gray'}])
|
||||
} catch (e) {
|
||||
bot.sendError(`${e.toString()}`)
|
||||
}
|
||||
]
|
||||
let component = [];
|
||||
let term = `${args.join(' ')}`
|
||||
const query = new URLSearchParams({ term });
|
||||
const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`);
|
||||
const { list } = await dictResult.body.json();
|
||||
if (!list.length) {
|
||||
bot.sendError('No results found');
|
||||
}
|
||||
for (const definitions of list) {
|
||||
component.push(prefix, [
|
||||
{
|
||||
text: `${definitions.definition.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray',
|
||||
underlined: false,
|
||||
italic: false,
|
||||
translate:"",
|
||||
hoverEvent: {
|
||||
action:"show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Example \u203a \n ${definitions.example.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}`,
|
||||
color: 'dark_blue'
|
||||
},
|
||||
{
|
||||
text: `Word \u203a ${definitions.word.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'dark_blue',
|
||||
},
|
||||
{
|
||||
text: `Author \u203a ${definitions.author.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'dark_blue'
|
||||
},
|
||||
{
|
||||
text: `written on \u203a ${definitions.written_on.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'dark_blue'
|
||||
},
|
||||
{
|
||||
text: `Rating \u203a Thumbs-Up ${definitions.thumbs_up} / Thumbs-Down ${definitions.thumbs_down}`,
|
||||
color: 'gray'
|
||||
}
|
||||
]
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'open_url',
|
||||
value: `${definitions.permalink}`
|
||||
}
|
||||
},
|
||||
])
|
||||
// console.log(Object.entries(list).map((key, value) => key).join(' ').replaceAll('[object Object]', '\n').replaceAll(',',''))
|
||||
}
|
||||
if (bot.options.isSavage) {
|
||||
for (const definitions of list) {
|
||||
await bot.chatDelay(500);
|
||||
bot.chat(bot.getMessageAsPrismarine({ text: `${definitions.definition.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`})?.toMotd().replaceAll('\xa7','&'));
|
||||
await bot.chatDelay(500);
|
||||
bot.chat(bot.getMessageAsPrismarine({ text: `${definitions.example.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`})?.toMotd().replaceAll('\xa7','&'));
|
||||
await bot.chatDelay(500);
|
||||
} // text: `${definitions.definition.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa78')}\n`,
|
||||
} else {
|
||||
bot.tellraw(component)
|
||||
|
||||
}
|
||||
},
|
||||
async discordExecute (context) {
|
||||
async discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const component = [];
|
||||
try {
|
||||
let definitions = await ud.define(args.join(' '))
|
||||
for (const def of definitions) {
|
||||
component.push([
|
||||
{
|
||||
text: def.example.replaceAll('\r','')
|
||||
},
|
||||
{
|
||||
text: '\n'
|
||||
},
|
||||
{
|
||||
text: def.definition.replaceAll("\r", "")
|
||||
}
|
||||
])
|
||||
// bot.tellraw([cmdPrefix, { text: def.example.replaceAll('\r',''), color: 'dark_gray' }])
|
||||
// bot.tellraw([cmdPrefix, { text: def.definition.replaceAll("\r", ""), color: 'dark_gray' }])
|
||||
}
|
||||
|
||||
// bot.discord.channel.send({ content: 'amonger', components: [row] })
|
||||
} catch (e) {
|
||||
let Embed = new EmbedBuilder()
|
||||
.setColor(`${bot.Commands.colors.discord.error}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`${e.toString()}`)
|
||||
bot.discord.Message.reply({ embeds: [Embed] })
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
|
|
@ -13,7 +13,7 @@ module.exports = {
|
|||
const args = context.arguments
|
||||
const ownerhash = bot.owner
|
||||
const discordHash = bot.hashing.hash
|
||||
if (args[0] === bot.hash ?? args[0] === bot.hashing.hash) {
|
||||
if (args[0] === bot.hash || bot.hashing.hash && args[0] !== bot.owner) {
|
||||
if (bot.options.isCreayun) {
|
||||
|
||||
} else {
|
||||
|
|
|
@ -14,11 +14,14 @@ Commands:
|
|||
error: "#FF0000"
|
||||
embed: "#000000"
|
||||
help:
|
||||
pub_lickColor: "#00FFFF"
|
||||
t_rustedColor: "dark_purple"
|
||||
own_herColor: "dark_red"
|
||||
pub_lickColor: "#2b7589"
|
||||
t_rustedColor: "#219696"
|
||||
own_herColor: "#2081c3"
|
||||
error: "#FF0000"
|
||||
|
||||
savage:
|
||||
password: "password here"
|
||||
|
||||
# core
|
||||
Core:
|
||||
# PLEASE MAKE THIS A VALID JSON
|
||||
|
@ -131,4 +134,3 @@ bots:
|
|||
god: true
|
||||
icu: false
|
||||
interval: 1000
|
||||
|
||||
|
|
47
src/index.js
47
src/index.js
|
@ -3,7 +3,7 @@ const util = require("util");
|
|||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const parseYaml = require('js-yaml');
|
||||
|
||||
const { loadModules } = require('./util/loadModules')
|
||||
if (!fs.existsSync(path.join(__dirname, '../config.yml'))) {
|
||||
console.log('Config not found creating config from default.yml');
|
||||
fs.copyFileSync(
|
||||
|
@ -12,28 +12,18 @@ if (!fs.existsSync(path.join(__dirname, '../config.yml'))) {
|
|||
);
|
||||
};
|
||||
const createBot = require('./bot.js');
|
||||
const fileExist = require("./util/file-exists");
|
||||
const readline = require("readline");
|
||||
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
});
|
||||
|
||||
try {
|
||||
config = parseYaml.load(fs.readFileSync('config.yml', 'utf8'));
|
||||
// console.log(config)
|
||||
} catch (e) {
|
||||
console.log(e.toString())
|
||||
}
|
||||
function load() {
|
||||
require("dotenv").config();
|
||||
const bots = [];
|
||||
const core = config.Core;
|
||||
const commands = config.Commands;
|
||||
const Console = config.console;
|
||||
const discord = config.Discord;
|
||||
const matrix = config.matrix;
|
||||
const validation = config.validation;
|
||||
const savage = config.savage;
|
||||
for (const options of config.bots) {
|
||||
|
@ -44,31 +34,24 @@ for (const options of config.bots) {
|
|||
bot.Commands = commands;
|
||||
bot.Console = Console;
|
||||
bot.discord = discord;
|
||||
bot.matrix = matrix;
|
||||
bot.validation = validation;
|
||||
bot.savage = savage;
|
||||
bot.options.username;
|
||||
bot.loadModule = (module) => module(bot, options);
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, "modules"))) {
|
||||
try {
|
||||
const module = require(path.join(__dirname, 'modules', filename))
|
||||
bot.loadModule(module);
|
||||
} catch (error) {
|
||||
console.error("Failed to load module",filename,":",error);
|
||||
}
|
||||
}
|
||||
bot.console.useReadlineInterface(rl);
|
||||
try {
|
||||
bot.on("error", error => {
|
||||
bot.console?.warn(error.toString())
|
||||
});
|
||||
} catch (error) {
|
||||
// console.log(error.stack);
|
||||
}
|
||||
}
|
||||
bot.options.username;
|
||||
// createBot(options, bot.core, bot.commands, bot.Console, bot.discord, bot.validation, bot.savage)
|
||||
// bot.loadModule = (module) => module(bot, options);
|
||||
loadModules(bot, options);
|
||||
/*for (const filename of fs.readdirSync(path.join(__dirname, "modules"))) {
|
||||
try {
|
||||
const module = require(path.join(__dirname, 'modules', filename))
|
||||
bot.loadModule(module);
|
||||
} catch (error) {
|
||||
console.error("Failed to load module",filename,":",error);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
//bot.console.useReadlineInterface(rl);
|
||||
process.on("uncaughtException", (e) => {
|
||||
console?.warn(e.stack)
|
||||
});
|
||||
|
||||
load()
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ let tag = 'bruhify'
|
|||
bot.chat(ChatMessage.fromNotch(component).toMotd().replaceAll('§', '&'))
|
||||
startHue = (startHue + increment) % 360
|
||||
} else {
|
||||
bot.core.run(`/minecraft:title @a title ${JSON.stringify(component)}`)
|
||||
bot.core.run(`/minecraft:title @a actionbar ${JSON.stringify(component)}`)
|
||||
|
||||
startHue = (startHue + increment) % 360
|
||||
}
|
||||
|
|
|
@ -23,9 +23,11 @@ function inject (bot) {
|
|||
ChatMessage = loadPrismarineChat(registry)
|
||||
})
|
||||
if (bot.options.isCreayun && !bot.options.isKaboom) {
|
||||
bot.chatParsers = [creayunChatParser];
|
||||
bot.chatParsers = [creayunChatParser];
|
||||
} else if (bot.options.isSavage) {
|
||||
bot.chatParsers = [savageChatParser, sayChatParser, creayunChatParser];
|
||||
} else if (bot.options.isKaboom && !bot.options.isCreayun) {
|
||||
bot.chatParsers = [kaboomChatParser, chipmunkmodChatParser, chipmunkmodblackilykatverChatParser, typetextChatParser, typeemotetextChatParser, sayChatParser, creayunChatParser]
|
||||
bot.chatParsers = [kaboomChatParser, chipmunkmodChatParser, chipmunkmodblackilykatverChatParser, typetextChatParser, typeemotetextChatParser, creayunChatParser]
|
||||
}
|
||||
|
||||
bot.on('packet.profileless_chat', packet => {//loadPrismarineChat.processNbtMessage(nbt.comp(json))
|
||||
|
@ -63,11 +65,12 @@ function inject (bot) {
|
|||
})
|
||||
const translateMessage = bot.getMessageAsPrismarine(message)?.toMotd()
|
||||
const translateUsername = bot.getMessageAsPrismarine(sender)?.toMotd()
|
||||
if (packet.type === 1) bot.emit('message', bot.getMessageAsPrismarine({translate:"chat.type.emote",with:[`${translateUsername}`,`${translateMessage}`]})?.toMotd())
|
||||
if (packet.type === 1) bot.emit('message', bot.getMessageAsPrismarine({translate:"chat.type.emote", with:[`${translateUsername}`,`${translateMessage}`]})?.toMotd())
|
||||
// if (packet.type === 1) bot.emit('message', `[${translateUsername}§r] translateMessage`)
|
||||
if (packet.type === 2) bot.emit('message', bot.getMessageAsPrismarine({"translate":"commands.message.display.incoming","with":[`${translateUsername}`,`${translateMessage}`],"color":"gray","italic":true})?.toMotd())
|
||||
if (packet.type === 3) bot.emit('message', bot.getMessageAsPrismarine({"translate":"commands.message.display.outgoing","with":[`${translateUsername}`,`${translateMessage}`],"color":"gray","italic":true})?.toMotd())
|
||||
if (packet.type === 4) bot.emit('message', message)
|
||||
if (packet.type === 5) bot.emit('message', bot.getMessageAsPrismarine({translate:"chat.type.announcement",color:'white',with:[`${translateUsername}`,`${translateMessage}`]})?.toMotd())
|
||||
if (packet.type === 4) bot.emit('message', message);
|
||||
if (packet.type === 5) bot.emit('message', bot.getMessageAsPrismarine({translate:"chat.type.announcement",color:'white', with:[`${translateUsername}`,`${translateMessage}`]})?.toMotd())
|
||||
tryParsingMessage(message, { senderName: sender, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
|
||||
})
|
||||
// Ignores command set messages
|
||||
|
@ -89,7 +92,9 @@ function inject (bot) {
|
|||
}
|
||||
|
||||
const message = parseMessage(tryParse(packet.content))
|
||||
if (packet.plainMessage === 'chat.type.announcement') console.log('e') //bot.emit('message', sender, message)
|
||||
const translateMessage = bot.getMessageAsPrismarine(unsigned)?.toMotd()
|
||||
const translateUsername = bot.getMessageAsPrismarine(packet.sender)?.toMotd()
|
||||
if (packet.type === 5) bot.emit('message', bot.getMessageAsPrismarine({translate:"chat.type.announcement",color:'white', with:[`${translateUsername}`,`${translateMessage}`]})?.toMotd())
|
||||
bot.emit('player_chat', { plain: packet.plainMessage, unsigned, senderUuid: packet.senderUuid })
|
||||
bot.emit('message', unsigned)
|
||||
tryParsingMessage(unsigned, { senderUuid: packet.senderUuid, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine})
|
||||
|
|
|
@ -69,7 +69,7 @@ function chat_command_handler(bot) {
|
|||
if (bot.options.useChat) {
|
||||
bot.tellraw([message]);
|
||||
} else {
|
||||
bot.tellraw(["", prefix, message]);
|
||||
bot.tellraw(["", message]);
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -83,7 +83,7 @@ try{
|
|||
ratelimit--
|
||||
}, 1000)
|
||||
if (ratelimit > bot.Commands.ratelimit) { // ,.
|
||||
bot.sendFeedback({text:'You are using commands to fast!',color:'dark_red'})
|
||||
bot.sendFeedback({text:'You are using commands too fast!',color:'dark_red'})
|
||||
// this isn't blocking running the command you know that right?
|
||||
} else {
|
||||
bot.commandManager.executeString(source, command);
|
||||
|
|
|
@ -4,4 +4,4 @@ bot.chatDelay = function delay(ms) {
|
|||
}
|
||||
|
||||
}
|
||||
module.exports = chatDelay;
|
||||
module.exports = chatDelay;
|
|
@ -48,13 +48,11 @@ if (command?.trustLevel === -1) {
|
|||
throw new CommandError('this command has been disabled!')
|
||||
}
|
||||
if (command?.trustLevel > 0) {
|
||||
|
||||
|
||||
if (command?.trustLevel === 1 && !source?.sources?.discord && !source?.sources?.console) {
|
||||
const hash = `${args[0]}`
|
||||
|
||||
if (args.length === 0 && bot.hash && bot.owner && bot.hashing.hash) throw new CommandError([{text:'Please provide an ',color:'gray'},{text:'Trusted ',color:'dark_purple'},{text:'hash or an ',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}])
|
||||
if (hash !== bot.hash && hash !== bot.owner && hash !== bot.hashing.hash) throw new CommandError([{text:'Invalid ',color:'gray'},{text:'Trusted ',color:'dark_purple'},{text:'hash or Invalid ',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}])
|
||||
if (args.length === 0 && bot.hash && bot.owner && bot.hashing.hash) throw new CommandError([{text:'Please provide an ',color:'gray'},{text:'Trusted ',color:'#219696'},{text:'hash or an ',color:'gray'},{text:'Owner ',color:'#2081c3'},{text:'hash',color:'gray'}])
|
||||
if (hash !== bot.hash && hash !== bot.owner && hash !== bot.hashing.hash) throw new CommandError([{text:'Invalid ',color:'gray'},{text:'Trusted ',color:'#219696'},{text:'hash or Invalid ',color:'gray'},{text:'Owner ',color:'#2081c3'},{text:'hash',color:'gray'}])
|
||||
|
||||
} else if (command.trustLevel === 1 && source?.sources?.discord && !source.sources.console) {
|
||||
|
||||
|
@ -70,12 +68,11 @@ if (hash !== bot.hash && hash !== bot.owner && hash !== bot.hashing.hash) throw
|
|||
} else if (args[0] === bot.owner) {
|
||||
bot.console.info({ text: `Player ${player} UUID: ${uuid} Hash:${bot.owner}`, color: 'white' })
|
||||
}
|
||||
if(command?.trustLevel === 2 && !source?.sources?.discord && !source?.sources?.console){
|
||||
if (command?.trustLevel === 2 && !source?.sources?.discord && !source?.sources?.console) {
|
||||
const owner = `${args[0]}`
|
||||
|
||||
if(args.length === 0 && bot.owner) throw new CommandError([{text:'Please provide a ',color:'red',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}])
|
||||
if(owner === bot.hash || owner === bot.hashing.hash) throw new CommandError([{text:"THATS A ",color:'gray'},{text:'TRUSTED ',color:'dark_purple'},{text:'HASH AFAIK',color:'gray'}])
|
||||
if (owner !== bot.owner) throw new CommandError([{text:"Invalid ",color:'gray'},{text:'Owner ',color:'dark_red'},{text:'Hash',color:'gray'}])
|
||||
if (args.length === 0 && bot.owner) throw new CommandError([{text:'Please provide a ',color:'red',color:'gray'},{text:'Owner ',color:'#2081c3'},{text:'hash',color:'gray'}])
|
||||
if (owner === bot.hash || owner === bot.hashing.hash) throw new CommandError([{text:"THATS A ",color:'gray'},{text:'TRUSTED ',color:'#219696'},{text:'HASH AFAIK',color:'gray'}])
|
||||
if (owner !== bot.owner) throw new CommandError([{text:"Invalid ",color:'gray'},{text:'Owner ',color:'#2081c3'},{text:'Hash',color:'gray'}])
|
||||
|
||||
} else if (command?.trustLevel === 2 && source?.sources?.discord && !source?.sources?.console) {
|
||||
// const events = source.discordMessageEvent
|
||||
|
|
|
@ -5,7 +5,7 @@ const CommandSource = require("../CommandModules/command_source");
|
|||
function Console(bot, options, context, source) {
|
||||
const chat = require('prismarine-chat')(bot.options.version)
|
||||
let ratelimit = 0
|
||||
bot.console = {
|
||||
bot.console = {
|
||||
readline: null,
|
||||
username: bot.username,
|
||||
consoleServer: "all",
|
||||
|
@ -61,46 +61,26 @@ function Console(bot, options, context, source) {
|
|||
}
|
||||
|
||||
bot.console.warn = function (error) {
|
||||
log(chat.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() + chat.fromNotch(error)?.toAnsi());
|
||||
log(chat.fromNotch([{text:'<',color:'gray'},{text:`${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} `,color:'#2b7589'},{text:`${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })}`,color:'#219696'},{text:' WARN',color:'yellow'},{text:'>',color:'gray'},{text:' [',color:'gray'},{text:`${bot.options.serverName}`,color:'#2081c3'},{text:'] ',color:'gray'}])?.toAnsi() + chat.fromNotch(error)?.toAnsi());
|
||||
};
|
||||
bot.console.error = function (error) {
|
||||
log(chat.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() + chat.fromNotch(error)?.toAnsi());
|
||||
log(chat.fromNotch([{text:'<',color:'gray'},{text: `${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} `,color:'#2b7589'},{text:`${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })}`,color:'#219696'},{text:' ERROR',color:'dark_red'},{text:'>',color:'gray'},{text:' [',color:'gray'},{text:`${bot.options.serverName}`,color:'#2081c3'},{text:'] ',color:'gray'}])?.toAnsi() + chat.fromNotch(error)?.toAnsi());
|
||||
};
|
||||
|
||||
/*
|
||||
pub_lickColor: "#2b7589"
|
||||
t_rustedColor: "#219696"
|
||||
own_herColor: "#2081c3"
|
||||
*/
|
||||
bot.console.info = function (message) {
|
||||
log(chat.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() + chat.fromNotch(message)?.toAnsi());
|
||||
log(chat.fromNotch([{text:'<',color:'gray'},{text:`${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} `,color:'#2b7589'},{text:`${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`,color:'#219696'},{text:' INFO',color:'green'},{text:'>',color:'gray'},{text:' [',color:'gray'},{text:`${bot.options.serverName}`,color:'#2081c3'},{text:'] ',color:'gray'}])?.toAnsi() + chat.fromNotch(message)?.toAnsi());
|
||||
};
|
||||
bot.console.log = function (message, ansi) {
|
||||
log(chat.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);
|
||||
log(chat.fromNotch([{text:'<',color:'gray'},{text:`${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO"})} `,color:'#2b7589'},{text:`${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO"})}`,color:'#219696'},{text:' LOGS',color:'gold'},{text:'>',color:'gray'},{text:' [',color:'gray'},{text:`${bot.options.serverName}`,color:'#2081c3'},{text:'] ',color:'gray'}])?.toAnsi() + message);
|
||||
};
|
||||
|
||||
bot.console.debug = function (message) {
|
||||
log(chat.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:' DEBUG',color:'yellow'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + message)
|
||||
log(chat.fromNotch([{text:'<',color:'gray'},{text:`${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO"})} `,color:'#2b7589'},{text:`${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO"})}`,color:'#219696'},{text:' DEBUG',color:'yellow'},{text:'>',color:'gray'},{text:' [',color:'gray'},{text:`${bot.options.serverName}`,color:'#2081c3'},{text:'] ',color:'gray'}])?.toAnsi() + message)
|
||||
};
|
||||
/* const ansimap = {
|
||||
0: '\x1b[0m\x1b[30m',
|
||||
1: '\x1b[0m\x1b[34m',
|
||||
2: '\x1b[0m\x1b[32m',
|
||||
3: '\x1b[0m\x1b[36m',
|
||||
4: '\x1b[0m\x1b[31m',
|
||||
5: '\x1b[0m\x1b[35m',
|
||||
6: '\x1b[0m\x1b[33m',
|
||||
7: '\x1b[0m\x1b[37m',
|
||||
8: '\x1b[0m\x1b[90m',
|
||||
9: '\x1b[0m\x1b[94m',
|
||||
a: '\x1b[0m\x1b[92m',
|
||||
b: '\x1b[0m\x1b[96m',
|
||||
c: '\x1b[0m\x1b[91m',
|
||||
d: '\x1b[0m\x1b[95m',
|
||||
e: '\x1b[0m\x1b[93m',
|
||||
f: '\x1b[0m\x1b[97m',
|
||||
r: '\x1b[0m',
|
||||
l: '\x1b[1m',
|
||||
o: '\x1b[3m',
|
||||
n: '\x1b[4m',
|
||||
m: '\x1b[9m',
|
||||
k: '\x1b[6m'
|
||||
}*/
|
||||
const isConsole = bot.username ? true : false;
|
||||
bot.console.source = new CommandSource(bot.username, {
|
||||
console: true,
|
||||
|
@ -146,27 +126,19 @@ function Console(bot, options, context, source) {
|
|||
ratelimit--
|
||||
}, 1000)
|
||||
if (ratelimit > bot.options.Console.ratelimit) { // ,.
|
||||
|
||||
// bot.console.logs = function () {}
|
||||
bot._client.end("Anti spam :3")
|
||||
bot._client.end("Anti spam :3")
|
||||
// rl.pause();
|
||||
} else {
|
||||
//bot.console.log(`${ansi}`);
|
||||
//oh real
|
||||
|
||||
//can i change the variable name so its name isnt confusing?
|
||||
|
||||
bot.console.log(`${ansi}`);
|
||||
bot?.console?.log(`${ansi}`);
|
||||
|
||||
// logger(`<${time} ${date}> [${bot.options.host}:${bot.options.port}] [LOGS]: ${string}`)
|
||||
if (bot.Console.filelogging) {
|
||||
bot.console.filelogger(`${chat.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}`)
|
||||
if (bot.Console.filelogging) {
|
||||
bot?.console?.filelogger(`${chat.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
|
||||
|
||||
};
|
||||
})
|
||||
}
|
||||
}
|
||||
}//nothing is logging to the file
|
||||
};
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Console;
|
||||
|
|
|
@ -4,7 +4,7 @@ function registry (bot) {
|
|||
bot.on('packet.login', packet => {
|
||||
bot.registry = createRegistry(bot._client.version);
|
||||
|
||||
bot.registry.language = require('../../languages/en_ud.json');
|
||||
bot.registry.language = require('../../languages/en_us.json');
|
||||
|
||||
bot.emit('registry_ready', bot.registry);
|
||||
})
|
||||
|
|
|
@ -3,7 +3,7 @@ const fs = require('fs');
|
|||
const CommandError = require('../CommandModules/command_error')
|
||||
const { EmbedBuilder } = require('discord.js')
|
||||
function reload (bot,options,context) {
|
||||
bot.reload = function () {
|
||||
bot.commandReload = function () {
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, "../commands"))) {
|
||||
try {
|
||||
// const command = require(path.join(__dirname, "../commands", filename));
|
||||
|
|
|
@ -4,6 +4,8 @@ const COMMANDSPY_ENABLED_MESSAGE = { text: 'Successfully enabled CommandSpy' }
|
|||
const COMMANDSPY_DISABLED_MESSAGE = { text: 'Successfully disabled CommandSpy' }
|
||||
//You now have the tag: &8[&bPrefix &4d~&8]
|
||||
function selfcare (bot) {
|
||||
let register;
|
||||
let login;
|
||||
let time = new Date; time.getMilliseconds();
|
||||
let positionPackets = 0;
|
||||
let entityId;
|
||||
|
@ -20,29 +22,43 @@ function selfcare (bot) {
|
|||
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
|
||||
ansiMessage = bot.getMessageAsPrismarine(message)?.toAnsi()
|
||||
stringmessage = bot.getMessageAsPrismarine(message)?.toString()
|
||||
// creayun
|
||||
|
||||
if (bot.options.isSavage) {
|
||||
// savage vanish selfcare
|
||||
if (stringmessage === `Vanish for ${bot.options.username}: enabled`) vanished = true;
|
||||
|
||||
else if (stringmessage === `Vanish for ${bot.options.username}: disabled`) vanished = false;
|
||||
}
|
||||
|
||||
// savage prefix selfcare
|
||||
else if (JSON.stringify(message) === `{"extra":[{"bold":true,"color":"aqua","text":" > "},{"color":"white","text":"Prefix for user "},{"color":"aqua","text":"${bot.options.username}"},{"color":"white","text":" "},{"color":"green","text":"set to"},{"color":"white","text":": "},{"color":"dark_gray","text":"["},{"color":"aqua","text":"Prefix"},{"color":"dark_gray","text":": "},{"color":"dark_red","text":"${bot.Commands.prefixes[0]}"},{"color":"dark_gray","text":"]"}],"text":""}`) prefix = true
|
||||
|
||||
else if (stringmessage === 'Prefix for user ${bot.options.username} removed.') prefix = false
|
||||
|
||||
else if (stringmessage.startsWith(`> Prefix for user ${bot.options.username} set to: `) || stringmessage === `> Prefix for user ${bot.options.username} removed.`) prefix = false
|
||||
|
||||
// savage login selfcare
|
||||
else if (stringmessage === 'Please, register to the server with the command: /register <password> <ConfirmPassword>') register = false;
|
||||
|
||||
else if (stringmessage === 'Successfully registered!') register = true;
|
||||
|
||||
else if (stringmessage === 'You already have registered this username!') register = true;
|
||||
|
||||
else if (stringmessage === 'Please, login with the command: /login <password>') login = true;
|
||||
|
||||
else if (stringmessage === 'Successful login!') login = true;
|
||||
|
||||
else if (stringmessage === "You're already logged in!") login = true;
|
||||
|
||||
else if (stringmessage === "You're already logged in!") registry = true;
|
||||
// You're already logged in!
|
||||
} // Please, register to the server with the command: /register <password> <ConfirmPassword>
|
||||
// Please, login with the command: /login <password>
|
||||
// Successfully registered!
|
||||
// Successful login!
|
||||
// You already have registered this username!
|
||||
if (bot.options.isCreayun) {
|
||||
|
||||
// creayun join selfcare
|
||||
|
@ -64,12 +80,12 @@ You do not have access to that command.
|
|||
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
|
||||
nickname = false
|
||||
return
|
||||
}
|
||||
|
||||
// creayun nick selfcare
|
||||
else if (stringmessage?.startsWith("Your nick has been set to: ") || stringmessage.startsWith("[SuffEx] Your nick has been set to: ")) nickname = false
|
||||
else if (stringmessage?.startsWith("Your nick has been set to: ") || stringmessage.startsWith("[SuffEx] Your nick has been set to: ")) nickname = true
|
||||
|
||||
// creayun vanish selfcare
|
||||
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.") {
|
||||
|
@ -127,23 +143,21 @@ You do not have access to that command.
|
|||
}
|
||||
|
||||
// kaboom username selfcare
|
||||
else if (stringmessage === `Successfully set your username to "${bot.username}"`) {
|
||||
username = true
|
||||
else if (stringmessage === `Successfully set your username to "${bot.username}"`) {
|
||||
username = false
|
||||
return
|
||||
}
|
||||
else if (stringmessage?.startsWith("Successfully set your username to ")) username = false
|
||||
else if (stringmessage?.startsWith("Successfully set your username to ")) username = true
|
||||
|
||||
else if (stringmessage === `You already have the username "${bot.username}"`) username = true
|
||||
else if (stringmessage === `You already have the username "${bot.username}"`) username = false
|
||||
|
||||
// kaboom nickname selfcare
|
||||
else if (JSON.stringify(message) === `{"color":"gold","text":"You no longer have a nickname."}`) {
|
||||
nickname = true
|
||||
nickname = false
|
||||
return
|
||||
}
|
||||
|
||||
else if (JSON.stringify(message) === `{"color":"gold","extra":[{"color":"red","extra":[{"color":"gold","text":"."}],"text":"${bot.options.username}"}],"text":"Your nickname is now "}`) nickname = false
|
||||
|
||||
// else if (stringmessage === `You no longer have a nickname.`) nickname = false
|
||||
else if (JSON.stringify(message) === `{"color":"gold","extra":[{"color":"red","extra":[{"color":"gold","text":"."}],"text":"${bot.options.username}"}],"text":"Your nickname is now "}`) nickname = true
|
||||
|
||||
// kaboom god selfcare
|
||||
else if (JSON.stringify(message) === `{"color":"gold","extra":[{"color":"red","extra":[{"color":"gold","text":"."}],"text":" enabled"}],"text":"God mode"}`) {
|
||||
|
@ -185,22 +199,19 @@ You do not have access to that command.
|
|||
bot.on('packet.login', (packet) => {
|
||||
entityId = packet.entityId
|
||||
gameMode = packet.gameMode
|
||||
/*
|
||||
bot.on('move', () => {
|
||||
bot.core.move(bot.position)
|
||||
|
||||
//setTimeout(() => bot.core.run('say hi'), 100)
|
||||
})
|
||||
*/
|
||||
//let position = bot.on('move', () => { bot.core.move(bot.position) })
|
||||
timer = setInterval(() => {
|
||||
if (bot.options.isSavage) {
|
||||
if (permissionLevel < 2 && bot.options.selfcare.op) bot.command(`op ${bot.options.username}`)
|
||||
if (!register) bot.command(`register ${bot.savage.password} ${bot.savage.password}`);
|
||||
|
||||
else if (gameMode !== 1 && bot.options.selfcare.gmc) bot.command('gamemode creative @s[type=player]')
|
||||
else if (!login) bot.command(`login ${bot.savage.password}`);
|
||||
|
||||
else if (!vanished && bot.options.selfcare.vanished) bot.core.run(`/essentials:vanish ${bot.username} enable`)
|
||||
|
||||
else if (permissionLevel < 2 && bot.options.selfcare.op) bot.command(`op ${bot.options.username}`);
|
||||
|
||||
else if (gameMode !== 1 && bot.options.selfcare.gmc) bot.command('gamemode creative @s[type=player]');
|
||||
|
||||
else if (!vanished && bot.options.selfcare.vanished) bot.core.run(`/essentials:vanish ${bot.username} enable`);
|
||||
|
||||
else if (!prefix && bot.options.selfcare.prefix) bot.command(`rank ${bot.options.username} &8[&bPrefix&8: &4${bot.Commands.prefixes[0]}&8]`);
|
||||
} else 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]`)
|
||||
|
@ -215,10 +226,6 @@ bot.on('move', () => {
|
|||
|
||||
if (permissionLevel < 2 && bot.options.selfcare.op) bot.command('op @s[type=player]')
|
||||
|
||||
// else if (time && positionPackets > bot.emit('move')) bot.core.run('sudo * icu stop')
|
||||
|
||||
// else if (bot.on('move', () => {})) bot.core.run('sudo * icu stop')
|
||||
|
||||
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}`)
|
||||
|
@ -229,9 +236,9 @@ bot.on('move', () => {
|
|||
|
||||
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 (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 (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`)
|
||||
|
||||
|
@ -242,10 +249,10 @@ bot.on('move', () => {
|
|||
}
|
||||
}, bot.options.selfcare.interval)
|
||||
})
|
||||
// if (!bot.options.selfcare.icu) return
|
||||
//bot.on('move', () => {
|
||||
// bot.core.run('sudo * icu stop')
|
||||
// })
|
||||
// bot.on('message', (message) => {
|
||||
// if (username && bot.options.selfcare.username) bot.command(`username ${bot.options.username}`);
|
||||
// })
|
||||
|
||||
bot.on('end', () => {
|
||||
if (timer) clearInterval(timer)
|
||||
prefix = false
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
/**
|
||||
* character allowed in mc chat
|
||||
* @param {String} character the character
|
||||
* @return {boolean} allowed
|
||||
*/
|
||||
function isAllowedCharacter (character) {
|
||||
return character !== '\xa7' && character !== '\x7f'
|
||||
}
|
||||
/**
|
||||
* mc chat check if contains illegal chars.
|
||||
* @param {String} string the string
|
||||
* @return {boolean} if contains then true else false
|
||||
*/
|
||||
function containsIllegalCharacters (string) {
|
||||
for (let i = 0; i < string.length; i++) if (!isAllowedCharacter(string[i])) return true
|
||||
}
|
||||
|
||||
module.exports = { containsIllegalCharacters, isAllowedCharacter }
|
|
@ -1,3 +0,0 @@
|
|||
const { Worker } = require('node:worker_threads');
|
||||
const ivm = require('isolated-vm');
|
||||
const { stylize } = require('./eval_colors')
|
|
@ -1,15 +0,0 @@
|
|||
const fs = require('fs/promises')
|
||||
|
||||
|
||||
async function fileExists (filepath) {
|
||||
try {
|
||||
await fs.access(filepath)
|
||||
return true
|
||||
} catch (error) {
|
||||
if (error.code !== 'ENOENT') throw error
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = fileExists
|
|
@ -1,14 +0,0 @@
|
|||
const fs = require('fs/promises')
|
||||
|
||||
|
||||
async function list (filepath = '.') {
|
||||
const files = await fs.readdir(filepath)
|
||||
|
||||
const component = []
|
||||
for (const filename of files) {
|
||||
component.push(filename)
|
||||
}
|
||||
return component
|
||||
}
|
||||
|
||||
module.exports = list
|
|
@ -1,8 +0,0 @@
|
|||
const path = require('path')
|
||||
|
||||
function getFilenameFromUrl (urlStr) {
|
||||
const url = new URL(urlStr)
|
||||
return path.basename(url.pathname)
|
||||
}
|
||||
|
||||
module.exports = getFilenameFromUrl
|
21
src/util/loadModules.js
Normal file
21
src/util/loadModules.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const readline = require('readline');
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
});
|
||||
|
||||
function loadModules (bot, options) {
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, "../modules"))) {
|
||||
try {
|
||||
const module = require(path.join(__dirname, '../modules', filename))
|
||||
bot.loadModule = (module) => module(bot, options);
|
||||
bot.loadModule(module);
|
||||
} catch (error) {
|
||||
console.error("Failed to load module", filename, ":", error);
|
||||
}
|
||||
}
|
||||
bot.console.useReadlineInterface(rl);
|
||||
}
|
||||
module.exports = { loadModules };
|
|
@ -1,24 +0,0 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const currentDate = new Date();
|
||||
const timestamp = `${currentDate.getFullYear()}-${(currentDate.getMonth() + 1).toString().padStart(2, '0')}-${currentDate.getDate().toString().padStart(2, '0')}`;
|
||||
const logFolder = path.join(__dirname, '../logs');
|
||||
const logFileName = `${timestamp}.txt`;
|
||||
const logFilePath = path.join(logFolder, logFileName);
|
||||
const logStream = fs.createWriteStream(logFilePath, { flags: 'a' });
|
||||
|
||||
function log (message, bot, toFile = true, toConsole = true ) {
|
||||
const now = new Date().toLocaleString();
|
||||
if (bot.options.filelogging = true) {
|
||||
const toWrite = `${message}`
|
||||
}
|
||||
if (toFile) logStream.write(toWrite + '\n');
|
||||
//if (toConsole) console.log(toWrite);
|
||||
};
|
||||
|
||||
if (!fs.existsSync(logFolder)) {
|
||||
fs.mkdirSync(logFolder);
|
||||
}
|
||||
//ohio
|
||||
module.exports = log
|
|
@ -1,9 +0,0 @@
|
|||
|
||||
function minecraftVersionToNumber (version) {
|
||||
const versionArray = version.split('.')
|
||||
if (versionArray.length === 2) return Number(version)
|
||||
versionArray.pop()
|
||||
return Number(versionArray.join('.'))
|
||||
}
|
||||
|
||||
module.exports = minecraftVersionToNumber
|
|
@ -1,220 +0,0 @@
|
|||
'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
|
||||
|
Loading…
Reference in a new issue