v7.0.3, build: 2120

This commit is contained in:
Parker2991
2025-03-07 11:14:42 -05:00
parent 18e2278ebd
commit 668312461f
47 changed files with 786 additions and 1816 deletions
-32
View File
@@ -1,32 +0,0 @@
module.exports = {
data: {
name: 'vanish',
trustLevel: 2,
aliases: [
"vanishtoggle"
],
description: 'toggle the bots vanish selfcare',
usages: [
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;
if (args.slice(1).join('') === 'true') {
bot.vanished = true
bot.chat.message('enabled vanish selfcare')
}
if (args.slice(1).join('') === 'false') {
bot.vanished = false;
bot.chat.message('disabled vanish selfcare')
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
bot.vanished = false;
bot.chat.message('disabling vanish selfcare,...');
bot.chat.command('v off')
}
}
-27
View File
@@ -1,27 +0,0 @@
const CommandError = require('../../util/command_error')
module.exports = {
data: {
name: 'core',
trustLevel: 0,
aliases: [
"cb",
"corerun",
"commandcorerun",
],
description: 'run commands in core!',
usages: [
"<command>",
],
},
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ');
bot.core.run(message);
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
bot.core.run(args.join(' '));
}
}
-81
View File
@@ -1,81 +0,0 @@
const cowsay = require('cowsay2');
const cows = require('cowsay2/cows');
const { EmbedBuilder } = require('discord.js');
const fixansi = require('../../util/ansi');
module.exports = {
data: {
name: 'cowsay',
trustLevel: 0,
aliases: [
],
description: 'cows',
usages: [
"<message>",
"list"
],
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
const source = context.source;
if (args[0]?.toLowerCase() === "list") {
const list = Object.keys(cows);
let content = [];
let color = true;
for (const value of list) {
content.push([
{
text: value + ' ',
color: (!((color = !color)) ? 'blue' : 'dark_blue'),
}
])
}
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, content)
} else if (cows[args[0]]) {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
text: cowsay.say(args.slice(1).join(' '),
{ cow: cows[args[0]] })
})
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: cowsay.say(args.slice(0).join(' ')) })
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
let Embed
if (args[0] === "list") {
const list = Object.keys(cows);
let content = [];
let color = true;
for (const value of list) {
content.push([
{
text: value + ' ',
}
])
}
const ansiList = bot.getMessageAsPrismarine(content)?.toString();
const fixAnsiList = fixansi(ansiList.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.data.name} Command`)
.setDescription(`\`\`\`ansi\n${fixAnsiList}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
} else if (cows[args[0]]) {
const ansiCow1 = bot.getMessageAsPrismarine({ text: cowsay.say(args.slice(1).join(' '), { cow: cows[args[0]] }) })?.toAnsi()
const fixAnsiCow1 = fixansi(ansiCow1.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.data.name} Command`)
.setDescription(`\`\`\`ansi\n${fixAnsiCow1}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
} else {
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${cowsay.say(args.slice(0).join(' '))}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] });
}
}
}
-482
View File
@@ -1,482 +0,0 @@
const CommandError = require('../../util/command_error');
const sleep = require('../../util/sleep.js');
const fixansi = require('../../util/ansi');
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: {
name: 'help',
trustLevel: 0,
aliases: [
"heko",
"?",
"cmds",
"hell",
"hello",
"helo",
"commands",
"commandshelp",
],
description: 'a list of the bots commands',
usages: [
"",
"<command>",
],
},
execute (context) {
const commandList = [];
const bot = context.bot;
const source = context.source;
const args = context.arguments;
const category = {
translate: '(%s%s%s%s%s%s%s) \u203a ',
bold: false,
color: 'gray',
with: [
{ color: "aqua", text: 'Public'},
{ color: "gray", text: ' | '},
{ color: "dark_aqua", text: 'Trusted'},
{ color: 'gray', text: ' | '},
{ color: "blue", text: "Admin" },
{ color: "gray", text: " | " },
{ color: "dark_blue", text: 'Owner'},
]
}
let public = [];
let trusted = [];
let admin = [];
let owner = [];
for (const command of bot.commandManager.commandlist) {
let usagesComponent = [];
let commandComponent = [];
for (const usages of command.data.usages) {
if (command?.data?.trustLevel === 1) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
{ text: `${command.data.name} <trusted/admin/owner hashes>`, color: "blue" },
{ text: `${usages}`, color: "aqua" },
]
})
} else if (command?.data.trustLevel === 2) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
{ text: `${command.data.name} <admin/owner hashes>`, color: "blue" },
{ text: `${usages}`, color: "aqua" },
]
})
} else if (command?.data.trustLevel === 3) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
{ text: `${command.data.name} <owner hash>`, color: "blue" },
{ text: `${usages}`, color: "aqua" },
]
})
} else if (command?.data.trustLevel === 0 || command.data.trustLevel === 4) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
{ text: `${command.data.name}`, color: "blue" },
{ text: `${usages}`, color: "aqua" },
]
})
}
usagesComponent.push('\n');
}
usagesComponent.pop();
commandComponent.push({
translate: "%s %s %s\n%s %s %s\n%s %s %s\n%s %s %s\n%s %s",
color: "dark_gray",
with: [
{ text: "Command Name", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.data.name}`, color: "blue" },
{ text: "Aliases", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.data.aliases.toString().replaceAll(',',' ')}`, color: "blue" },
{ text: "Description", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.data.description}`, color: "blue" },
{ text: "Trust Level", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.data.trustLevel}`, color: "gold" },
{ text: "Usages", color: "dark_blue" },
{ text: "\u203a" }
]
})
commandComponent.push("\n");
commandComponent.push(usagesComponent);
// for (const aliases of command.aliases) {
if (args[0]?.toLowerCase() === command.data.name) {
if (bot.options.isSavage) {
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`);
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, commandComponent)
}
return;
}
/* } if (args[0]?.toLowerCase() === aliases) {
if (bot.options.isSavage) {
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`)
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, commandComponent)
}
return
}
console.log(aliases)*/
// }
// tellraw @p {"text":"this","clickEvent":{"action":"suggest_command","value":"this"}}
if (command.data.trustLevel === 0) {
public.push([
{
text: command.data.name + ' ',
color: "aqua",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: `Command: ${command.data.name}\n`,
color: 'blue'
},
{
text: `Trust Level: `,
color: 'blue'
},
{
text: `${command.data.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.data.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.data.aliases}\n`,
color: 'blue'
},
{
text: 'click on me to use me :)',
color: 'dark_blue',
},
],
},
clickEvent: {
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.data.name}`
}
}
])
} else if (command.data.trustLevel === 1) {
trusted.push([
{
text: command.data.name + ' ',
color: "dark_aqua",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: `Command: ${command.data.name}\n`,
color: 'blue'
},
{
text: `Trust Level: `,
color: 'blue'
},
{
text: `${command.data.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.data.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.data.aliases}\n`,
color: 'blue'
},
{
text: 'click on me to use me :)',
color: 'dark_blue',
},
],
},
clickEvent: {
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.data.name}`
}
}
])
} else if (command.data.trustLevel === 2) {
admin.push([
{
text: command.data.name + ' ',
color: "blue",
translate: "",
hoverEvent: {
action:"show_text",
value: [
{
text: `Command: ${command.data.name}\n`,
color: 'blue'
},
{
text: `Trust Level: `,
color: 'blue'
},
{
text: `${command.data.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.data.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.data.aliases}\n`,
color: 'blue'
},
{
text: 'click on me to use me :)',
color: 'dark_blue',
},
],
},
clickEvent: {
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.data.name}`
}
}
])
} else if (command.data.trustLevel === 3) {
owner.push([
{
text: command.data.name + ' ',
color: "dark_blue",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: `Command: ${command.data.name}\n`,
color: 'blue'
},
{
text: `Trust Level: `,
color: 'blue'
},
{
text: `${command.data.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.data.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.data.aliases}\n`,
color: 'blue'
},
{
text: 'click on me to use me :)',
color: 'dark_blue',
},
],
},
clickEvent: {
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.data.name}`
}
}
])
}
}
const length = bot.commandManager.commandlist.filter(c => c.data.trustLevel != 4).length
if (bot.options.useChat) {
bot.chat.message(bot.getMessageAsPrismarine([
{
text: 'Commands (',
color: 'gray'
},
{
text: length,
color: 'gold'
},
{
text: ') ',
color: 'gray'
},
category,
])?.toMotd().replaceAll('§','&'))
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(public)?.toMotd().replaceAll("§","&"))
}, 300)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
}, 300)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
}, 300)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
}, 300)
} else if (bot.options.isSavage) {
bot.chat.message(bot.getMessageAsPrismarine([
{
text: 'Commands (',
color: 'gray'
},
{
text: length,
color: 'gold'
},
{
text: ') ',
color: 'gray'
},
category,
])?.toMotd().replaceAll('§','&'))
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(public)?.toMotd().replaceAll("§","&"))
}, 400)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
}, 400)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
}, 400)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
}, 400)
} else if (bot.options.isCreayun) {
bot.chat.message(bot.getMessageAsPrismarine([
{
text: 'Commands (',
color: 'gray'
},
{
text: length,
color: 'gold'
},
{
text: ') ',
color: 'gray'
},
category,
])?.toMotd().replaceAll('§','&'))
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(public)?.toMotd().replaceAll("§","&"))
}, 2500)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
}, 2500)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
}, 2500)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
}, 2500)
} else if (admin.length === 0) {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
{ text: 'Commands (', color: 'gray' },
{ text: JSON.stringify(length), color: 'gold' },
{ text: ') ', color: 'gray' },
category,
'\n',
public,
trusted,
owner
])
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
{ text: 'Commands (', color: 'gray' },
{ text: JSON.stringify(length), color: 'gold' },
{ text: ') ', color: 'gray' },
category,
'\n',
public,
trusted,
admin,
owner
])
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const category = {
translate: '(%s%s%s%s%s%s%s) \u203a ',
bold: false,
color: 'gray',
with: [
{ color: "aqua", text: 'Public'},
{ color: "gray", text: ' | '},
{ color: "dark_aqua", text: 'Trusted'},
{ color: 'gray', text: ' | '},
{ color: 'blue', text: 'Admin' },
{ color: 'gray', text: ' | ' },
{ color: "dark_blue", text: 'Owner'},
]
}
let public = [];
let trusted = [];
let admin = [];
let owner = [];
for (const command of bot.commandManager.commandlist) {
if (args[0] === command.data.name) {
const ansi = bot.getMessageAsPrismarine([ { text: `CommandName \u203a ${command.data.name}\n`, color: 'gray', }, { text: `Aliases \u203a ${command.data.aliases}\n`, color: 'gray', }, { text: `Description \u203a ${command.data.description}\n`, color: 'gray', }, { text: `trustLevel \u203a ${command.data.trustLevel}\n`, color: 'gray' }, { text: `Usages \u203a ${command?.data.usages}`, color: "dark_gray" }, ])?.toAnsi().replaceAll('```\u001b[9```' + '```\u001b[3```')
const fix = fixansi(ansi.replaceAll('`', '`\u200b'))
const Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.data.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
return
}
if (command?.data.trustLevel === 0 && command.discordExecute) {
public.push([
{
text: command.data.name + ' ',
color: "aqua",
}
])
} else if (command?.data.trustLevel === 1 && command.discordExecute) {
trusted.push([
{
text: command.data.name + ' ',
color: "dark_aqua"
}
])
} else if (command?.data.trustLevel === 2 && command.discordExecute) {
admin.push([
{
text: command.data.name + ' ',
color: 'blue'
}
])
} else if (command?.data.trustLevel === 3 && command.discordExecute) {
owner.push([
{
text: command.data.name + ' ',
color: "dark_blue",
}
])
}
}
const length = bot.commandManager.commandlist.filter(c => c.data.trustLevel !== 4 && c.discordExecute).length
const ansi1 = bot.getMessageAsPrismarine([ { text: 'Commands (', color: 'gray' }, { text: JSON.stringify(length), color: 'gold' }, { text: ') ', color: 'gray' }, category, '\n', public, trusted, owner ])?.toAnsi();
const fix1 = fixansi(ansi1.replaceAll('`', '`\u200b'))
const Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.data.name} Command`)
.setDescription(`\`\`\`ansi\n${fix1}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
bot?.discord?.message.react('♋')
}
}
-101
View File
@@ -1,101 +0,0 @@
const CommandError = require('../../util/command_error');
const { EmbedBuilder } = require('discord.js');
const fixansi = require('../../util/ansi');
module.exports = {
data: {
name: 'list',
description: 'check the player list',
trustLevel: 0,
aliases: [
'playerlist',
'plist',
'pl'
],
usages: [
""
],
},
execute (context) {
const bot = context.bot
const args = context.arguments
const players = bot.players
const source = context.source
const component = []
for (const player of players) {
component.push({
translate: `%s \u203a %s [%s: %s %s %s: %s]`,
color: 'dark_gray',
with: [
player.displayName ?? player.profile.name,
{
text: `${player.uuid}`,
color: 'dark_blue',
clickEvent: {
action: 'copy_to_clipboard',
value: `${player.uuid}`
},
hoverEvent: {
action: 'show_text',
contents: [{
text: 'click here to copy the player\'s uuid',
color: 'aqua'
}]
}
},
{ text: `Ping`, color: 'dark_blue' },
{ text: `${player.latency}`, color: 'gold' },
{ text: '/', color: 'dark_gray' },
{ text: `Gamemode`, color: 'dark_blue' },
{ text: `${player.gamemode}`, color: 'gold' },
]
})
component.push('\n')
}
component.pop()
if (bot.options.isSavage) {
bot.chat.message(`${bot.getMessageAsPrismarine([{ text: `Players: `, color:'gray' }, { text: '(' , color: 'gray' }, { text: `${JSON.stringify(bot.players.length)}`, color: 'gold' }, { text: ')\n', color: 'gray' }])?.toMotd().replaceAll('§','&')}`)
setTimeout(() => {
for (const player of bot.players) {
bot.chat.message(`${bot.getMessageAsPrismarine([player.displayName ?? player.profile.name, ' &8', player.uuid,` &r&8[&2Ping: &6${player.latency}&8 / &5Gamemode: &6${player.gamemode}&8]`]).toMotd().replaceAll('§', '&')}`)
}
}, 300)
} else if (bot.options.isKaboom) {
bot.tellraw(`@a[name="${source.player.profile.name}"]`, [
{ text: `Players`, color: 'dark_blue' },
{ text: ': ', color: 'dark_gray' },
{ text: '(' , color: 'dark_gray' },
{ text: `${JSON.stringify(bot.players.length)}`, color: 'gold' },
{ text: ')\n', color: 'dark_gray' },
component
])
}
},
discordExecute(context) {
const bot = context.bot
const players = bot.players
const component = []
for (const player of players) {
component.push({
translate: `%s \u203a %s [%s %s %s %s %s]`,
with: [
player.displayName ?? player.profile.name,
player.uuid,
{ text: `Ping:`, color: 'dark_green' },
{ text: `${player.latency}`, color: 'gold' },
{ text: '/', color: 'gray' },
{ text: `Gamemode:`, color: 'dark_purple' },
{ text: `${player.gamemode}`, color: 'gold' },
]
})
component.push('\n')
}
component.pop()
const ansi = bot.getMessageAsPrismarine([{ text: `Players: `, color:'gray' }, { text: '(' , color: 'gray' }, { text: `${JSON.stringify(bot.players.length)}`, color: 'gold' }, { text: ')\n', color: 'gray' }, component])?.toAnsi()
const fix = fixansi(ansi.replaceAll('`', '`\u200b').substring(0, 3080))
const Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.data.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
}
}
-60
View File
@@ -1,60 +0,0 @@
const { request } = require('undici');
const CommandError = require('../../util/command_error.js');
const mc = require('minecraft-protocol');
const util = require('util')
module.exports = {
data: {
name: 'mcserver',
trustLevel: 0,
aliases: [
"pingserver",
"pingsrv",
],
description: 'look up minecraft server info',
usages: [
"<minecraft server ip>",
],
},
async execute (context) {
const bot = context.bot;
const discordClient = context.discordClient;
const args = context.arguments;
const source = context.source;
let component = [];
try {
const [host, port] = args[0].split(':')
const server = await mc.ping({ host, port: Number(port ?? 25565) })
component.push({
translate: '%s %s %s:%s\n%s %s %s / %s\n%s %s %s\n%s %s %s',
color: 'dark_gray',
with: [
{ text: 'Ip', color: 'dark_blue' },
{ text: '\u203a' },
{ text: `${host}`, color: 'dark_blue' },
{ text: `${Number(port ?? 25565)}`, color: 'gold' },
{ text: 'Players', color: 'dark_blue' },
{ text: '\u203a' },
{ text: `${server.players.online}`, color: 'gold' },
{ text: `${server.players.max}`, color: 'gold' },
{ text: 'Version', color: 'dark_blue' },
{ text: '\u203a' },
{ text: `${server.version.name}`, color: 'blue' },
{ text: 'Motd', color: 'dark_blue' },
{ text: '\u203a' },
server.description
]
})
if (bot.options.isSavage) {
bot.chat.message(`Ip \u203a ${host}:${Number(port ?? 25565)}`);
bot.chat.message(`Players \u203a ${server.players.online} / ${server.players.max}`);
bot.chat.message(`Version \u203a ${server.version.name}`);
bot.chat.message(bot.getMessageAsPrismarine(server.description)?.toMotd().replaceAll('§','&'));
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component);
}
} catch (e) {
bot.chat.message(`${e.toString()}`)
}
}
}
-32
View File
@@ -1,32 +0,0 @@
module.exports = {
data: {
name: 'memusage',
trustLevel: 0,
aliases: [
],
description: 'check the bots and the servers ram usage',
usages: [
"on/enable/true",
"off/disable/false",
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;
switch (args[0]?.toLowerCase()) {
case "on":
case "enable":
case "true":
bot.memUsage.enabled = true;
bot.chat.message('enabled memusage');
break;
case "off":
case "enable":
case "false":
bot.memUsage.enabled = false;
bot.chat.message('disabled memusage');
break;
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
}
},
}
-84
View File
@@ -1,84 +0,0 @@
const CommandError = require('../../util/command_error.js')
module.exports = {
data: {
name: 'netmsg',
trustLevel: 0,
aliases: [
],
description: 'netmsg to other servers',
usages: [
"<message>"
],
},
execute (context) {
const args = context.arguments;
const bot = context.bot;
const source = context.source;
const config = context.config;
if (bot.options.private) {
component = {
translate: '[%s] %s \u203a %s',
color: "dark_gray",
with: [
{ text: bot.options.serverName, color: "blue" },
source.player.displayName ?? source.player.profile.name,
{ text: args.join(' '), color: "blue" },
]
}
} else if (!bot.options.private) {
component = {
translate: '[%s:%s] %s \u203a %s',
color: "dark_gray",
with: [
{ text: bot.options.host, color: "blue" },
{ text: `${bot.options.port}`, color: "gold" },
source.player.displayName ?? source.player.profile.name,
{ text: args.join(' '), color: "blue" },
]
}
}
bot.bots.filter((eachBot) => {
if (!eachBot.options.isKaboom || eachBot.options.useChat) {
eachBot.chat.message(`${bot.getMessageAsPrismarine(component)?.toMotd().replaceAll('§','&')}`);
} else if (eachBot.options.isKaboom && !eachBot.options.useChat) {
eachBot.tellraw("@a", component);
}
})
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const source = context.source;
if (bot.options.private) {
component = {
translate: '[%s] %s \u203a %s',
color: "dark_gray",
with: [
{ text: bot.options.serverName, color: "blue" },
source.player.displayName ?? source.player.profile.name,
{ text: args.join(' '), color: "blue" },
]
}
} else if (!bot.options.private) {
component = {
translate: '[%s:%s] %s \u203a %s',
color: "dark_gray",
with: [
{ text: bot.options.host, color: "blue" },
{ text: `${bot.options.port}`, color: "gold" },
source.player.displayName ?? source.player.profile.name,
{ text: args.join(' '), color: "blue" },
]
}
}
bot.bots.filter((eachBot) => {
if (!eachBot.options.isKaboom || eachBot.options.useChat) {
eachBot.chat.message(`${bot.getMessageAsPrismarine(component)?.toMotd().replaceAll('§','&')}`);
} else if (eachBot.options.isKaboom && !eachBot.options.useChat) {
eachBot.tellraw("@a", component);
}
})
}
}
-46
View File
@@ -1,46 +0,0 @@
const CommandError = require('../../util/command_error');
module.exports = {
data: {
name: 'test',
trustLevel: 0,
aliases: [
],
description: 'Make me say something',
usages: [
"error stack <message>",
"error message <message>",
"message <message>"
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;
if (!args && !args[0] && !args[1]) return
switch (args[0]) {
case 'error':
switch (args[1]) {
case 'stack':
throw new Error(args.slice(2).join(' '));
break
case 'message':
throw new CommandError(args.slice(2).join(' '));
break
}
break;
case "message":
bot.tellraw("@a", [
{
text: `Hello, World!, Player: ${bot.getMessageAsPrismarine(context.source.player.displayName ?? context.source.player.profile.name)?.toMotd()}§r`,
color: 'gray',
bold: false
},
{
text: ` Args: ${args.slice(1).join(' ')}`,
color: 'gray',
bold: false,
}
])
break;
}
}
}
-88
View File
@@ -1,88 +0,0 @@
const CommandError = require('../../util/command_error')
const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, SlashCommandBuilder } = require('discord.js');
const { request } = require('undici');
module.exports = {
data: {
name: 'urban',
description: 'urban dictionary',
aliases: [
'urbandictionary'
],
trustLevel: 0,
usages: [
"<definition>",
],
},
async execute (context) {
const source = context.source
const args = context.arguments
const bot = context.bot
const prefix = [
{ text: '[', color: 'dark_gray' },
{ text: 'Urban', color: '#B72A00' },
{ text: '] ', color: 'dark_gray'}
]
let component = [];
let term = `${args.join(' ')}`
const query = new URLSearchParams({ term });
const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`);
const { list } = await dictResult.body.json();
if (!list.length) {
bot.tellraw('@a', { text: 'No results found', color: 'dark_red' });
}
for (definitions of list) {
component.push(prefix, [
{
text: `${definitions.definition.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray',
underlined: false,
italic: false,
translate:"",
hoverEvent: {
action:"show_text",
value: [
{
text: `Example \u203a \n ${definitions.example.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray'
},
{
text: `Word \u203a ${definitions.word.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray',
},
{
text: `Author \u203a ${definitions.author.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray'
},
{
text: `written on \u203a ${definitions.written_on.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray'
},
{
text: `Rating \u203a Thumbs-Up ${definitions.thumbs_up} / Thumbs-Down ${definitions.thumbs_down}`,
color: 'gray'
}
]
},
clickEvent: {
action: 'open_url',
value: `${definitions.permalink}`
}
},
])
}
if (bot.options.useChat) {
for (const definitions of list) {
bot.chat.message(bot.getMessageAsPrismarine({ text: `${definitions.example.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`})?.toMotd().replaceAll("§","&"));
// bot.chat.message(definitions.example.replaceAll("\r", ""));
}
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)
}
},
async discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const component = [];
}
}
-170
View File
@@ -1,170 +0,0 @@
const CommandError = require('../../util/command_error');
const { request } = require('undici');
module.exports = {
data: {
name: 'weather',
trustLevel: 0,
aliases: [
],
description: 'check the weather of cities',
usages: [
"<city/zipcode>"
],
},
async execute (context) {
const bot = context.bot
const args = context.arguments;
const config = context.config;
const source = context.source;
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
try {
let component;
const weather = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ').replaceAll(' ','&')}`);
const info = await weather.body.json();
component = new MessageBuilder()
.setTranslate("%s\n%s\n%s: %s (%s)\n%s\n%s\n%s: %s\n%s: %s")
.setColor(config.colors.commands.tertiary)
.addWith(new MessageBuilder()
.setTranslate("%s: %s, %s %s")
.setColor(config.colors.commands.tertiary)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.primary)
.setText("Location")
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText(info.location.name)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText(info.location.region)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText(info.location.country)
)
)
.addWith(new MessageBuilder()
.setTranslate("%s: %s, %s")
.setColor(config.colors.commands.tertiary)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.primary)
.setText("Coords")
)
.addWith(new MessageBuilder()
.setColor(config.colors.integer)
.setText(`${info.location.lat}`)
)
.addWith(new MessageBuilder()
.setColor(config.colors.integer)
.setText(`${info.location.lon}`)
)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.primary)
.setText("Time")
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText(`${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id, })}`)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText(`${info.location.tz_id}`)
)
.addWith(new MessageBuilder()
.setTranslate("%s: %s (%s), %s (%s)")
.setColor(config.colors.commands.tertiary)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.primary)
.setText("Temp")
)
.addWith(new MessageBuilder()
.setColor(config.colors.integer)
.setText(`${Math.floor(info.current.temp_c)}`)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText("\u00b0C")
)
.addWith(new MessageBuilder()
.setColor(config.colors.integer)
.setText(`${Math.floor(info.current.temp_f)}`)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText("\u00b0F")
)
)
.addWith(new MessageBuilder()
.setTranslate("%s: %s (%s, %s), %s (%s, %s)")
.setColor(config.colors.commands.tertiary)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.primary)
.setText("Wind Speed")
)
.addWith(new MessageBuilder()
.setColor(config.colors.integer)
.setText(`${Math.floor(info.current.wind_kph)}`)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText("kph")
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText(info.current.wind_dir)
)
.addWith(new MessageBuilder()
.setColor(config.colors.integer)
.setText(`${Math.floor(info.current.wind_mph)}`)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText("mph")
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText(info.current.wind_dir)
)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.primary)
.setText("Condition")
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText(info.current.condition.text)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.primary)
.setText("Humidity")
)
.addWith(new MessageBuilder()
.setColor(config.colors.integer)
.setText(`${Math.floor(info.current.humidity)}`)
)
if (bot.options.isSavage) {
bot.chat.message(`Location: ${info.location.name}, ${info.location.region}, ${info.location.country}`);
bot.chat.message(`Latitude: ${info.location.lat}`);
bot.chat.message(`Longitude: ${info.location.lon}`);
bot.chat.message(`Time: ${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id, })}(${info.location.tz_id})`);
bot.chat.message(`Temp: ${info.current.temp_c}(\u00b0C), ${info.current.temp_f}(\u00b0F)`);
bot.chat.message(`Wind speed: ${info.current.wind_kph}(KPH), ${info.current.wind_mph}(MPH)`);
bot.chat.message(`Condition: ${info.current.condition.text}`);
bot.chat.message(`Humidity: ${info.current.humidity}`);
} else {
bot.tellraw("@a", component);
}
} catch (e) {
if (e.toString() === "TypeError: Cannot read properties of undefined (reading 'name')" && args.length !== 0) {
bot.chat.message('The location is invalid please try a valid location');
} else if (args.length === 0) {
bot.chat.message('there were no arguments detected')
} else {
bot.chat.message(`${e.toString()}`);
console.warn(e.stack);
}
}
}
}
-39
View File
@@ -1,39 +0,0 @@
const wiki = require('wikipedia');
const CommandError = require('../../util/command_error');
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: {
name: 'wiki',
description: 'wikipedia',
trustLevel: 0,
aliases: [
'wikipedia'
],
usages:[
"<article>"
],
},
async execute (context) {
const source = context.source;
const args = context.arguments;
const bot = context.bot;
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
try {
const page = await wiki.page(args.join(' '))
const summary = await page.intro();
bot.tellraw("@a", new MessageBuilder()
.setText(summary)
.setColor("gray")
)
} catch (error) {
if (error.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')") {
bot.tellraw("@a", new MessageBuilder()
.setText("Article not found!")
.setColor("red")
)
} else {
bot.tellraw(`@a`, `${error.toString()}`)
}
}
}
}
-161
View File
@@ -1,161 +0,0 @@
const { EmbedBuilder } = require('discord.js');
const CommandError = require('../../util/command_error');
module.exports = {
data: {
name: 'cloop',
trustLevel: 1,
aliases: [
"commandloop"
],
description: 'run cloops',
usages: [
"add <interval> <command>",
"remove <index>",
"clear",
"list",
],
},
execute (context) {
const args = context.arguments
const bot = context.bot
const source = context.source
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
switch (args[1]) {
case 'add':
if (isNaN(args[2])) throw new CommandError({ text: 'Invalid interval', color: 'red' })
//bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid interval', color: 'red' })
const interval = parseInt(args[2])
const command = args.slice(3).join(' ');
bot.cloop.add(command, interval)
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
translate: 'Added \'%s\' with interval %s to the cloops',
color: 'gray',
with: [ command, { text: `${interval}`, color: 'gold' } ]
})
break
case 'remove':
if (parseInt(args[2]) === NaN) bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid index', color: 'red' })
const index = parseInt(args[2])
bot.cloop.remove(index)
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
translate: 'Removed cloop %s',
color: 'gray',
with: [ { text: `${index}`, color: 'gold' } ]
})
break
case 'clear':
bot.cloop.clear()
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Cleared all cloops' })
break
case 'list':
const component = []
const listComponent = []
let i = 0
for (const cloop of bot.cloop.list) {
listComponent.push({
translate: '%s \u203a %s (%s)',
color: 'gray',
with: [
{ text: `${i}`, color: 'gold' },
cloop.command,
{ text: `${cloop.interval}`, color: 'gold'},
]
})
listComponent.push('\n')
i++
}
listComponent.pop()
component.push({
translate: 'Cloops (%s):',
with: [ { text: `${bot.cloop.list.length}`, color: 'gold' } ]
})
component.push('\n')
component.push(listComponent)
if (bot.cloop.list.length === 0) {
bot.tellraw(`@a[name="${source?.player.profile?.name}"]`, {
translate: 'Cloops (%s):',
color: 'gray',
with: [ { text: `${bot.cloop.list.length}`, color: 'gold' } ]
})
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)
}
break
default:
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid action', color: 'red' })
break
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
let Embed;
switch (args[0]) {
case "add":
const interval = parseInt(args[1])
const command = args.slice(2).join(' ')
bot.cloop.add(command, interval)
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`Added ${command} with the interval ${interval} to the cloops`)
bot?.discord?.message?.reply({ embeds: [Embed] })
break;
case "remove":
var index = (args[1])
if (parseInt(args[1]) === NaN) throw new CommandError("invalid index");
bot.cloop.remove(index)
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`removed cloop ${index}`)
bot?.discord?.message?.reply({ embeds: [Embed] })
break
case 'clear':
bot.cloop.clear()
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`cleared cloops`)
bot?.discord?.message?.reply({ embeds: [Embed] })
break
case 'list':
const component = []
const listComponent = []
let i = 0
for (const cloop of bot.cloop.list) {
listComponent.push({
translate: '%s \u203a %s (%s)',
with: [
`id ${i}`,
cloop.command,
cloop.interval
]
})
listComponent.push('\n')
i++
}
listComponent.pop()
component.push({
translate: 'Cloops (%s):',
with: [ bot.cloop.list.length ]
})
component.push('\n')
component.push(listComponent)
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(bot.getMessageAsPrismarine(component)?.toString())
bot?.discord?.message?.reply({ embeds: [Embed] })
break
}
}
}
-47
View File
@@ -1,47 +0,0 @@
const CommandError = require('../../util/command_error');
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: {
name: 'kick',
trustLevel: 1,
aliases: [
],
description: 'kick or crash players',
usages: [
"invalidstring <player>",
"item <player>"
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
if (bot.options.useChat || bot.options.isSavage || bot.options.isCreayun) throw new CommandError('Cannot execute command due to smth in the config being enabled');
switch (args[1]) {
case 'invalidstring':
bot.exploits.crashes.invalidString(`${args.slice(2).join(' ')}`);
break
case 'item':
bot.exploits.kicks.item(`${args.slice(2).join(' ')}`)
break
default:
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
if (bot.options.useChat || bot.options.isSavage || bot.options.isCreayun) throw new CommandError('Cannot execute command!');
switch (args[0]) {
case "invalidstring":
bot.exploits.crashes.invalidString(`${args.slice(1).join(' ')}`)
break
case 'item':
bot.exploits.kicks.item(`${args.slice(1).join(' ')}`)
break
default:
throw new CommandError('Invalid argument');
}
}
}
-23
View File
@@ -1,23 +0,0 @@
module.exports = {
data: {
name: 'reconnect',
trustLevel: 1,
aliases: [
"end",
"recon",
],
description: 'reconnect the bot',
usages: [
],
},
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ')
bot._client.end("disconnect :3")
},
discordExecute (context) {
const bot = context.bot;
bot._client.end("disconnect :3")
}
}
-60
View File
@@ -1,60 +0,0 @@
const between = require('../../util/between')
const CommandError = require('../../util/command_error')
module.exports = {
data: {
name: 'tpr',
description: 'teleport to very fucked up coords',
trustLevel: 1,
aliases: [
'rtp',
'teleportrandom',
'randomteleport'
],
usages: [
""
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;
const source = context.source
if (bot.options.isKaboom) {
x = between(-30_000_000, 30_000_000)
y = 100
z = between(-30_000_000, 30_000_000)
} else if (bot.options.isSavage) {
x = between(-4096, 4096);
y = 100
z = between(-4096, 4096);
}
if (args.slice(1).join(' ')) {
bot.tellraw("@a", [
{ text: 'Randomly Teleported: ', color: 'gray' },
{ text: args.slice(1).join(' '), color: 'blue' },
{ text: ' to ', color: 'gray' },
{ text: `${x} `, color: 'gold' },
{ text: `${y} `, color: 'gold' },
{ text: `${z}`, color: 'gold' }
])
if (bot.options.isSavage) {
bot.chat.command(`minecraft:tp ${args.slice(1).join(' ')} ${x} ${y} ${z}`)
} else if (bot.options.isKaboom) {
bot.core.run(`minecraft:tp ${args.slice(1).join(' ')} ${x} ${y} ${z}`);
}
} else {
bot.tellraw("@a", [
{ text: 'Randomly Teleported: ', color: 'gray' },
{ text: source.player.profile.name, color: 'blue' },
{ text: ' to ', color: 'gray' },
{ text: `${x} `, color: 'gold' },
{ text: `${y} `, color: 'gold' },
{ text: `${z}`, color: 'gold' }
])
if (bot.options.isSavage) {
bot.chat.command(`minecraft:tp ${source.player.profile.name} ${x} ${y} ${z}`)
} else if (bot.options.isKaboom) {
bot.core.run(`minecraft:tp ${source.player.profile.name} ${x} ${y} ${z}`);
}
}
}
}
-108
View File
@@ -1,108 +0,0 @@
const http = require('http');
const https = require('https');
const util = require('util');
const fixansi = require('../../util/ansi');
const CommandError = require('../../util/command_error')
module.exports = {
data: {
name: 'website',
trustLevel: 1,
aliases: [
],
description: 'look up website data',
usages: [
"<url>"
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;
if (args.slice(1).join(' ').toLowerCase().startsWith("http://")) {
http.get(args.slice(1).join(' '), (res) => {
const { statusCode } = res;
const contentType = res.headers['content-type'];
res.setEncoding('utf8');
let rawData = '';
res.on('data', (chunk) => { rawData += chunk; });
res.on('end', () => {
try {
bot.tellraw("@a", { text: util.inspect(rawData.toString().substring(0, 32750)), color: "dark_green" })
} catch (e) {
bot.tellraw("@a", e.toString());
}
});
}).on('error', (e) => {
bot.chat.message(`&4${e.toString()}`);
});
} else {
https.get(args.slice(1).join(' '), (res) => {
res.on('data', (d) => {
bot.tellraw("@a", { text: util.inspect(d.toString().substring(0, 32750)), color: "dark_green", })
// console.log(Object.keys(d.toString().length));
});
}).on('error', (e) => {
bot.chat.message(`&4${e.toString()}`);
});
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
let Embed;
let fix;
let ansi;
//bot.discord.message.reply('e');
if (args.join(' ').toLowerCase().startsWith("http://")) {
http.get(args.join(' '), (res) => {
const { statusCode } = res;
const contentType = res.headers['content-type'];
res.setEncoding('utf8');
let rawData = '';
res.on('data', (chunk) => { rawData += chunk; });
res.on('end', () => {
// try {
// bot.tellraw("@a", { text: util.inspect(rawData), color: "dark_green" })
ansi = bot.getMessageAsPrismarine({ text: util.inspect(rawData.toString()), color: 'dark_green'})?.toAnsi()
fix = fixansi(ansi.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.data.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
// } catch (e) {
// bot.tellraw("@a", e.toString());
//throw new CommandError(e.toString())
// }
});
}).on('error', (e) => {
//bot.chat.message(`&4${e.toString()}`);
});
} else {
https.get(args.join(' '), (res) => {
res.on('data', (d) => {
// bot.tellraw("@a", { text: util.inspect(d.toString()), color: "dark_green", })
// console.log(Object.keys(d.toString().length));
ansi = bot.getMessageAsPrismarine({ text: util.inspect(d.toString()), color: 'dark_green'})?.toAnsi()
fix = fixansi(ansi.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.datta.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
// bot.discord.message.reply('e');
});
}).on('error', (e) => {
//bot.chat.message(`&4${e.toString()}`);
//throw new CommandError(e.toString())
});
/*
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${fix1}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
*/
}
}
}
+115
View File
@@ -0,0 +1,115 @@
const CommandError = require('../../util/command_error');
module.exports = {
data: {
name: 'filter',
trustLevel: 2,
aliases: [
"blacklist",
],
description: 'filter players',
usages: [
"add <player>",
"list",
"-ignorecase add <player> / -regex add <player>",
"-regex add <player>",
"clear",
"remove <index>",
],
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
let component = [];
if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4] && !args[5] && !args[6]) return;
switch (args[1]) {
case "add":
bot.filter.add(`${args[2]}`, false, false);
bot.chat.message(`added ${args[2]} to the filter`);
break;
case "list":
if (bot.filter.list().length === 0) {
component.push({
translate: "%s: (%s)",
color: config.colors.commands.tertiary,
with: [
{ text: "Filtered", color: config.colors.commands.primary },
{ text: `${bot.filter.list().length}`, color: config.colors.integer }
]
});
} else {
let index = 0;
let filterList = [];
for (const players of bot.filter.list()) {
filterList.push({
translate: "%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: `${index}`, color: config.colors.integer },
{ text: players.name, color: config.colors.commands.primary }
]
});
filterList.push('\n');
index++;
}
filterList.pop();
component.push({
translate: "%s: (%s)",
color: config.colors.commands.tertiary,
with: [
{ text: "Players", color: config.colors.commands.primary },
{ text: `${bot.filter.list().length}`, color: config.colors.integer }
]
});
component.push('\n');
component.push(filterList);
}
bot.tellraw("@a", component);
break;
case "remove":
bot.filter.remove(args[2]);
bot.chat.message(`removed ${args[2]} from the filter`);
break;
case "-ignorecase":
switch (args[2]) {
case "-regex":
switch (args[3]) {
case "add":
bot.filter.add(`${args[4]}`, true, true);
bot.chat.message(`added ${args[4]} to the filter`);
break;
}
break;
case "add":
bot.filter.add(`${args[3]}`, true, false);
bot.chat.message(`added ${args[3]} to the filter`);
break;
}
break;
case "-regex":
switch (args[2]) {
case "add":
bot.filter.add(`${args[3]}`, false, true);
bot.chat.message(`added ${args[3]} to the filter`);
break;
}
break;
case "clear":
bot.filter.clear();
bot.chat.message('cleared the filter');
break;
default:
throw new CommandError('invalid argument');
}
},
}
+3 -1
View File
@@ -25,7 +25,9 @@ module.exports = {
if (source.sources.console) {
bot.console.log(bot.getMessageAsPrismarine({ text: util.inspect(eval(args.join(' ')), { stylize })})?.toAnsi())
} else if (bot.options.mode === "savageFriends") {
bot.chat.message(bot.getMessageAsPrismarine({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })?.toMotd().replaceAll('§','&'))
bot.core.run(`minecraft:tellraw @a ${JSON.stringify(util.inspect(eval(script), { stylize }).substring(0, 32700))}`)
// bot.tellraw('@a', `${util.inspect(eval(script), { stylize }).substring(0, 32700)}`);
// bot.chat.message(bot.getMessageAsPrismarine({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })?.toMotd().replaceAll('§','&'))
} else {
bot.tellraw(`@a[name="${source.player.profile.name}"]`, {
text: `${util.inspect(eval(script), { stylize }).substring(0, 32700)}`
+11 -3
View File
@@ -12,12 +12,20 @@ module.exports = {
const bot = context.bot;
const args = context.arguments;
bot.core.run(args.join(' '));
if (bot.options.mode === "savageFriends") {
bot.core.run(args.join(' '));
} else if (bot.options.mode === "kaboom") {
bot.core.runTracked(args.join(' '));
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
bot.core.run(args.join(' '));
if (bot.options.mode === "savageFriends") {
bot.core.run(args.join(' '));
} else if (bot.options.mode === "kaboom") {
bot.core.runTracked(args.join(' '));
}
}
}
}
-1
View File
@@ -24,6 +24,5 @@ module.exports = {
} else {
bot.discord.message.channel.send(args.join(' '));
}
// bot.chat.send(args.join(' '));
}
}
+1 -5
View File
@@ -377,11 +377,7 @@ module.exports = {
componentPush(bot, args, config, discordClient, source, component);
if (bot.options.mode === "savageFriends") {
bot.chat.message(bot.getMessageAsPrismarine(component)?.toMotd().replaceAll('§','&'));
} else {
bot.tellraw(`@a`, component);
}
bot.tellraw(`@a`, component);
},
discordExecute (context) {
const bot = context.bot;
+46
View File
@@ -0,0 +1,46 @@
const mc = require('minecraft-protocol');
const util = require('util');
module.exports = {
data: {
name: "mcserver",
aliases: [
"pingserver"
],
description: "pings minecraft servers",
trustLevel: 0,
usages: [
"<ip>"
]
},
async execute (context) {
const bot = context.bot;
const config = context.config;
const args = context.arguments;
const [host, port] = args[0].split(':');
const server = await mc.ping({ host, port: Number(port ?? 25565) });
let component = [];
try {
component.push({
translate: "%s: %s:%s\n%s: (%s/%s)\n%s: %s\n%s",
color: config.colors.commands.tertiary,
with: [
{ text: "ip", color: config.colors.commands.primary },
{ text: `${host}`, color: config.colors.commands.secondary },
{ text: `${Number(port ?? 25565)}`, color: config.colors.commands.secondary },
{ text: "players", color: config.colors.commands.primary },
{ text: `${server.players.online}`, color: config.colors.integer },
{ text: `${server.players.max}`, color: config.colors.integer },
{ text: "server version", color: config.colors.commands.primary },
{ text: `${server.version.name}`, color: config.colors.commands.secondary },
server.description
]
});
bot.tellraw("@a", component);
} catch (e) {
bot.chat.message(`${e.toString()}`);
}
}
}
+5 -5
View File
@@ -25,7 +25,7 @@ module.exports = {
color: config.colors.commands.tertiary,
with: [
{ text: `${bot.options.serverName}`, color: config.colors.commands.primary },
source.player.displayName ?? source.player.profile.name,
source?.player?.displayName ?? source?.player?.profile?.name,
{ text: `${args.join(' ')}`, color: config.colors.commands.secondary }
]
})
@@ -43,11 +43,11 @@ module.exports = {
}
for (const eachBot of bot.bots) {
if (eachBot.options.mode === "savageFriends" || eachBot.options.mode === "creayun") {
/* if (eachBot.options.mode === "savageFriends" || eachBot.options.mode === "creayun") {
eachBot.chat.message(`${bot.getMessageAsPrismarine(component)?.toMotd()?.replaceAll('§','&')}`)
} else {
} else {*/
eachBot.tellraw("@a", component)
}
// }
}
}
}
}
+10 -2
View File
@@ -14,14 +14,22 @@ module.exports = {
execute (context) {
const bot = context.bot;
const config = context.config;
bot.core.move();
if (bot.options.mode === "savageFriends") {
bot.core.chatRefill();
} else {
bot.core.move();
}
bot.tellraw("@a", "Refilling core,...")
},
discordExecute (context) {
const bot = context.bot;
const config = context.config;
bot.core.move();
if (bot.options.mode === "savageFriends") {
bot.core.chatRefill();
} else {
bot.core.move();
}
bot.tellraw("@a", "Refilling core,...");
}
}
+1 -1
View File
@@ -70,7 +70,7 @@ module.exports = {
},
])
}
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)
bot.tellraw(`@a`, component)
},
async discordExecute (context) {
const bot = context.bot;
+7 -32
View File
@@ -30,34 +30,6 @@ core:
y: 0
z: 15
team:
name: "FNFBoyfriendBot"
suffix: {
color: "dark_gray",
translate: " [ %s ]",
with: [
{ color: "dark_red", text: "https://sus.red" }
]
}
# make sure if nothing is set as the suffix it is set as { text: "" } as the packet reads "" as { text: "" }
prefix: {
color: "dark_gray",
translate: "[%s: %s] ",
with: [
{ color: "aqua", text: "Prefix" },
{ color: "dark_aqua", text: "!" }
]
}
displayName: {
translate: "%s%s%s",
with: [
{ color: "dark_blue", text: "FNF" },
{ color: "dark_aqua", text: "Boyfriend" },
{ color: "blue", text: "Bot" }
]
}
# color HAS to come first before any components or it will break! dont ask why, its because of how nmp parses it
keys:
trusted: "trusted key here"
admin: "admin key here"
@@ -90,6 +62,12 @@ logsFolder:
name: "logs"
bots:
# modes: kaboom, savageFriends, creayun
# private is for hiding the server ip in netmsg
# reconnectDelay is for reconnecting the bot to the server on a delay
# serverName is whatever you set the name as for the server
# usernameGen is for generating random usernames
# channelId is for the discord channel
- host: "localhost"
username: "FNFBoyfriendBot"
usernameGen: true
@@ -99,8 +77,5 @@ bots:
reconnectDelay: 6000
channelId: "discord channel id here"
logging: false
useChat: false
isKaboom: true
isSavage: false
isCreayun: false
mode: "kaboom"
+1
View File
@@ -0,0 +1 @@
[{"name":"TarmacGnat.*","ignorecase":false,"regex":true},{"name":"TarmacGnat26842","ignorecase":false,"regex":false},{"name":"TarmacGnat26843","ignorecase":false,"regex":false},{"name":"Denisek38","ignorecase":false,"regex":false}]
+2 -2
View File
@@ -1,8 +1,8 @@
{
"buildstring": {
"build": "2100",
"codename": "§bPit Stop",
"version": "v7.0.2",
"codename": "",
"version": "v7.0.3",
"url":"https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot"
}
}
+1 -13
View File
@@ -7,7 +7,6 @@ const { Client, GatewayIntentBits } = require('discord.js');
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits;
const discordClient = new Client({ intents: [Guilds, GuildMessages, MessageContent] });
const CommandSource = require('./util/command_source');
const matrix = require('matrix-js-sdk');
console.log('Starting FNFBoyfriendBot');
@@ -32,16 +31,6 @@ const rl = readline.createInterface({
if (config.discord.enabled) discordClient.login(config.discord.token);
const mxClient = matrix.createClient({
baseUrl: config.matrix.host,
accessToken: config.matrix.token,
userId: config.matrix.id
});
if (config.matrix.enabled) mxClient.startClient();
const bots = [];
let bot;
@@ -49,7 +38,7 @@ for (const options of config.bots) {
bot = new createBot(options, config);
bots.push(bot);
bot.bots = bots;
require('./util/loadModules')(bot, options, config, discordClient, mxClient);
require('./util/loadModules')(bot, options, config, discordClient);
bot.console.readlineInterface(rl);
}
@@ -70,7 +59,6 @@ discordClient.on('messageCreate', (message) => {
}, {
discord: true,
console: false,
matrix: false
}, false, message);
bot.commandManager.executeString(source, message.content.substring(prefix.length));
-1
View File
@@ -16,7 +16,6 @@ function inject (context) {
bot.chat.message('Killing bot.....');
process.exit(5);
});
}
module.exports = {
+1
View File
@@ -5,6 +5,7 @@ const CreayunChatParser = require('../util/ChatParsers/Creayun');
const sayConsoleChatParser = require('../util/ChatParsers/sayConsole');
const VanillaChatParser = require("../util/ChatParsers/VanillaChat");
const yfdCustomChatParser = require('../util/ChatParsers/yfdCustomChat');
function tryParse (json) {
try {
return JSON.parse(json)
+89 -9
View File
@@ -1,6 +1,6 @@
const mcData = require('minecraft-data')('1.20.2');
const nbt = require('prismarine-nbt');
const sleep = require('../util/sleep');
function inject (context) {
const bot = context.bot;
const config = context.config;
@@ -24,9 +24,14 @@ function inject (context) {
const { start, end } = bot.core.area
if (!pos) return
if (bot.options.mode === "creayun" || bot.options.mode === "savageFriends") return;
if (bot.options.mode === "creayun") return;
if (bot.options.mode === "savageFriends") {
command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} command_block`
} else {
command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'} destroy`
}
const command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'} destroy`
bot.chat.command(`${command}`)
},
@@ -36,7 +41,6 @@ function inject (context) {
const itemPosition = bot.core.itemPosition;
if (!pos) return;
if (bot.options.mode === "creayun" || bot.options.mode === "savageFriends") return;
const command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'} destroy`
@@ -64,9 +68,9 @@ function inject (context) {
hand: 0,
location: itemPosition,
direction: 0,
cursorX: 0.1,
cursorX: 0,
cursorY: 0,
cursorZ: 0.1,
cursorZ: 0,
insideBlock: false
});
@@ -95,7 +99,7 @@ function inject (context) {
z: pos.z
}
if (config.core.itemRefill === true) {
if (config.core.itemRefill) {
bot.core.itemRefill();
} else {
bot.core.chatRefill();
@@ -137,8 +141,17 @@ function inject (context) {
const itemPosition = bot.core.itemPosition;
if (!location) return;
if (bot.options.mode === "creayun" || bot.options.mode === "savageFriends") {
return
if (bot.options.mode === "creayun") {
return;
} else if (bot.options.mode === "savageFriends") {
bot._client.write('update_command_block', {
command: command.substring(0, 32767),
location: location,
mode: 2,
flags: 0b101,
});
bot.core.incrementCurrentBlock();
} else {
if (bot.core.usePlacedCommandBlock) {
bot._client.write('update_command_block', {
@@ -161,6 +174,73 @@ function inject (context) {
}
}
},
async runTracked (command) {
const location = bot.core.itemPosition;
let transactionId = Math.floor(Math.random() * 10000);
bot._client.write('set_creative_slot', {
slot: 36,
item: {
present: true,
itemId: mcData.itemsByName.repeating_command_block.id,
itemCount: 1,
nbtData: nbt.comp({
BlockEntityTag: nbt.comp({
CustomName: nbt.string(JSON.stringify(config.core.itemName))
})
})
}
});
bot._client.write('block_dig', {
status: 0,
location: {
x: location.x,
y: location.y - 1,
z: location.z
},
face: 0
});
bot._client.write('block_place', {
hand: 0,
location,
direction: 0,
cursorX: 0,
cursorY: 0,
cursorZ: 0,
insideBlock: false
});
bot._client.write('update_command_block', {
command: command.substring(0, 32767),
location: {
x: location.x,
y: location.y,
z: location.z
},
flags: 0b101,
mode: 1
});
await sleep(100);
bot._client.write('query_block_nbt', { location, transactionId });
bot.on('packet.nbt_query_response', (data) => {
try {
if (data.transactionId == transactionId) {
if (data?.nbt?.value?.LastOutput) {
bot.tellraw("@a", JSON.parse(data.nbt.value.LastOutput.value));
}
}
} catch (e) {
console.log(e.stack)
}
});
}
}
require('../util/core_util')(bot, config, options);
+1 -1
View File
@@ -19,7 +19,7 @@ function inject (context) {
ratelimit--
}, 1000)
if (ratelimit > 2) {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'You are using commands too fast!', color: 'dark_red'})
bot.tellraw('@a', { text: 'You are using commands too fast!', color: 'dark_red'})
} else if (command.split(" ")[0].length === 0) {
} else {
bot.commandManager.executeString(source, command)
+4 -3
View File
@@ -5,6 +5,7 @@ const CommandSource = require('../util/command_source');
const { EmbedBuilder } = require('discord.js');
const fixansi = require('../util/ansi');
const cmdMgrUtil = require('../util/command_manager_util');
const sleep = require('../util/sleep.js');
async function inject (context) {
const bot = context.bot;
@@ -52,7 +53,7 @@ async function inject (context) {
if (error instanceof CommandError) {
if (options.mode !== "kaboom") {
bot.chat.message(`&4${error._message}`);
bot.chat.message(`&4${bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&')}`);
} else {
if (error.toString().length > 256) {
bot.tellraw("@a", error._message);
@@ -70,7 +71,7 @@ async function inject (context) {
const [commandName, ...args] = command.split(' ');
if (source?.sources?.discord) {
return this.discordExecute(source, commandName, args);
} else {
} else if (!source?.sources?.discord) {
return this.execute(source, commandName, args);
}
},
@@ -87,7 +88,7 @@ async function inject (context) {
if (!command?.discordExecute) {
throw new CommandError(`${command.data.name} command is not supported in discord!`);
} else {
} else if (source.sources.discord) {
return command?.discordExecute({ bot, source, arguments: args, config, discordClient, EmbedBuilder, fixansi });
}
} catch (error) {
+7 -1
View File
@@ -23,7 +23,13 @@ function inject (context) {
})
})
},
source: new CommandSource(bot._client.username, { console: true, discord: false }),
source: new CommandSource({
profile: {
name: bot._client.username
}, uuid: bot._client.uuid },
{ console: true, discord: false
}),
refreshLine (...args) {
this.readline.output.write("\x1b[2K\r");
console.log.apply(console, arguments);
+2 -3
View File
@@ -36,7 +36,6 @@ function inject (context) {
try {
bot?.discord?.channel?.send(`\`\`\`ansi\n${discordQueue.join('\n').substring(0, 1984)}\n\`\`\``)
} catch (error) {
console.error(error.toString())
}
discordQueue = []
}, 2000)
@@ -50,7 +49,7 @@ function inject (context) {
try {
sendDiscordMessage(fixansi(ansi?.replaceAll('`', '`\u200b')))
} catch (e) {
bot.console.error(`Error sending a message to Discord:\n${e.message}`)
bot.console.warn(`Error sending a message to Discord: ${e.message}`)
sendDiscordMessage(e.message)
}
}
@@ -152,7 +151,7 @@ function inject (context) {
} else if (message?.reference?.type === 1) {
// this is for messages that are forwarded
} else {
if (options.mode === "savageFriends" || options.mode === "creayun") {
if (options.mode === "creayun") {
bot.chat.message(bot.getMessageAsPrismarine(`&7[&9FNF&3Boyfriend&1Bot Discord&7] ${message?.member?.displayName} \u203a ${message?.content}`)?.toMotd().replaceAll('§','&'))
} else {
bot.tellraw('@a', [tag, message.content]);
+154
View File
@@ -0,0 +1,154 @@
const fs = require('fs');
const path = require('path');
function inject (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
if (options.mode !== "kaboom") return;
bot.filter = {
list () {
try {
return JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
} catch (e) {
bot.console.warn(e.toString())
}
},
add (Player, ignoreCase, Regex) {
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
const filterAdd = { name: Player, ignorecase: ignoreCase, regex: Regex };
data.push(filterAdd);
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data));
this.doAll();
},
remove (index) {
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
data.splice(index, 1);
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data));
},
clear () {
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
data = [];
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data));
},
doAll () {
for (const filtered of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
for (const players of bot.players) {
if (filtered.ignorecase === true) {
if (filtered.regex === true) {
let regex = new RegExp(filtered.name.toLowerCase());
if (regex.test(players.profile.name.toLowerCase())) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name.toLowerCase()}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name.toLowerCase()}"]`)
}
} else {
if (filtered.name.toLowerCase() === players.profile.name.toLowerCase()) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name.toLowerCase()}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
}
}
} else if (filtered.regex === true) {
let regex = new RegExp(filtered.name);
if (regex.test(players.profile.name)) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
}
} else {
if (filtered.name === players.profile.name) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
}
}
}
}
}
}
bot.on('parsed_message', (data) => {
try {
for (const filtered of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
if (filtered.ignorecase === true) {
if (filtered.regex === true) {
let regex = new RegExp(filtered.name.toLowerCase());
if (regex.test(data.sender.profile.name.toLowerCase())) {
bot.core.run(`essentials:mute ${data.sender.uuid} 10y`);
}
} else {
if (data.sender.profile.name.toLowerCase() === filtered.name.toLowerCase()) {
bot.core.run(`essentials:mute ${data.sender.uuid} 10y`);
}
}
} else if (filtered.regex === true) {
let regex = new RegExp(filtered.name);
if (regex.test(data.sender.profile.name)) {
bot.core.run(`essentials:mute ${data.sender.uuid} 10y`);
}
} else {
if (data.sender.profile.name === filtered.name) {
bot.core.run(`essentials:mute ${data.sender.uuid} 10y`);
}
}
}
} catch (e) {
console.log(e.stack);
}
});
bot.on('player_info', (data) => {
for (const filtered of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
for (const players of bot.players) {
if (filtered.ignorecase === true) {
if (filtered.regex === true) {
let regex = new RegExp(filtered.name.toLowerCase());
if (regex.test(players.profile.name.toLowerCase())) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
bot.exploits.kicks.item(`@a[name="${players.profile.name}"]`);
}
} else {
if (filtered.name.toLowerCase() === players.profile.name.toLowerCase()) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
bot.exploits.kicks.item(`@a[name="${players.profile.name}"]`);
}
}
} else if (filtered.regex === true) {
let regex = new RegExp(filtered.name);
if (regex.test(players.profile.name)) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
}
} else {
if (players.profile.name === filtered.name) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
bot.exploits.kicks.item(`@a[name="${players.profile.name}"]`);
}
}
}
}
});
}
module.exports = {
data: {
enabled: true,
name: "filter",
type: "blacklist"
},
inject
}
-86
View File
@@ -1,86 +0,0 @@
const CommandSource = require('../util/command_source');
function inject (context) {
const matrixClient = context.mxClient;
const config = context.config;
const bot = context.bot;
const options = context.options;
if (!config.matrix.enabled) return;
require('matrix-js-sdk/lib/logger').logger.disableAll();
bot.matrix = {
client: matrixClient,
invite: JSON.stringify(config.matrix.invite),
};
let matrixQueue = [];
setInterval(async () => {
try {
if (matrixQueue.length === 0) return;
const content = { body: matrixQueue.join('\n'), msgtype: "m.text" };
await bot.matrix.client.sendEvent(bot.options.roomId, 'm.room.message', content, '');
} catch (e) {
bot?.console?.warn(e.stack);
}
matrixQueue = [];
}, 5000);
function sendChatMessage (message) {
matrixQueue.push(message);
}
bot.on('message', (data) => {
const message = bot.getMessageAsPrismarine(data)?.toString();
sendChatMessage(message)
});
let start = Date.now();
bot.matrix.client.on('Room.timeline', (event, room, toStartOfTimeline) => {
if (event.getRoomId() !== bot.options.roomId || event.getType() !== 'm.room.message' || event.getTs() < start || event.sender.userId === bot.matrix.client.getUserId()) return;
if (event.getContent().body.startsWith('/')) {
bot.core.run(event.getContent().body.substring('/'.length));
return;
}
const tag = [{
translate: "[%s] %s \u203a ",
color: "dark_gray",
with: [
{
translate: "%s%s%s %s",
with: [
{ text: "FNF", color: "blue" },
{ text: "Boyfriend", color: "dark_aqua" },
{ text: "Bot", color: "dark_blue" },
{ text: "Matrix", color: "green" },
],
clickEvent: config.matrix.invite ? {
action: "open_url",
value: bot.matrix.invite
} : undefined,
hoverEvent: {
action: "show_text",
contents: "Click to join the matrix!"
}
},
{ text: event.sender.rawDisplayName },
]
}]
bot.tellraw("@a", [ tag, event.getContent().body ]);
});
}
module.exports = {
data: {
enabled: true,
name: "matrix",
type: "logging"
},
inject
};
+14 -2
View File
@@ -20,6 +20,7 @@ function inject (context) {
let positionCount = 0;
bot.vanished = true
bot.on('system_chat', (data) => {
try {
const stringMessage = bot.getMessageAsPrismarine(data.message)?.toString();
if (options.mode === "savageFriends") {
if (stringMessage === "Please, login with the command: /login <password>") login = true;
@@ -30,7 +31,12 @@ function inject (context) {
else if (stringMessage === "Successfully registered!") register = false;
else if (stringMessage === "You're already logged in!") register = false;
else if (stringMessage === "Successful login!") register = false;
else if (stringMessage === ` > Prefix for user ${bot.options.username} set to: [Prefix: ${config.prefixes[0]}]`) prefix = true;
else if (stringMessage?.startsWith(` > Prefix for user ${bot.options.username} set to: `) || stringMessage === ` > Prefix for user ${bot.options.username} removed.`) prefix = false;
else if (stringMessage === `You no longer have a nickname.`) nickname = false;
else if (stringMessage?.startsWith('Your nickname is now ')) nickname = true;
else if (stringMessage === `Vanish for ${bot.options.username}: enabled`) vanished = true;
else if (stringMessage === `Vanish for ${bot.options.username}: disabled`) vanished = false;
} else if (options.mode === "kaboom") {
if (stringMessage === "Successfully enabled CommandSpy") commandSpy = true;
else if (stringMessage === "Successfully enabled CommandSpy.") commandSpy = true;
@@ -56,6 +62,9 @@ function inject (context) {
else if (stringMessage === `You no longer have a nickname.`) nickname = false;
else if (stringMessage?.startsWith('Your nickname is now ')) nickname = true;
}
} catch (e) {
console.log(e.stack);
}
})
bot.on('packet.entity_status', packet => {
@@ -74,7 +83,7 @@ function inject (context) {
})
bot.on("packet.position", (packet, position) => {
if (options.isSavage || options.isCreayun) return
if (options.mode === "savageFriends" || options.mode === "creayun") return;
positionCount++
setTimeout(() => {
positionCount--
@@ -97,6 +106,9 @@ function inject (context) {
else if (register) bot.chat.command('register amogusissus amogusissus');
else if (gameMode !== 1) bot.chat.command('minecraft:gamemode creative');
else if (permissionLevel < 2) bot.chat.command(`minecraft:op ${bot.options.username}`);
else if (!prefix) bot.chat.command(`rank ${bot.options.username} &8[&bPrefix&8: &3${config.prefixes[0]}&8]`);
else if (nickname) bot.chat.command('nick off');
else if (!vanished && bot.vanished) bot.chat.command('essentials:vanish on');
else if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 });
} else if (bot.options.isCreayun && !bot.options.isKaboom && !bot.options.isSavage) {
+60
View File
@@ -0,0 +1,60 @@
const sleep = require('../util/sleep');
function inject (context) {
const bot = context.bot;
const options = context.options;
const config = context.config;
if (options.mode !== "kaboom" || config.team.enabled === false) return;
bot.on("packet.login", async () => {
if (options.mode === "kaboom") {
await sleep(100);
bot.chat.command(`minecraft:team add ${config.team.name}`);
await sleep(100);
bot.core.run(`minecraft:team join ${config.team.name} @a[name="${bot.options.username}"]`);
}
})
bot.on("packet.teams", async (data) => {
try {
if (data.team === config.team.name) {
data?.players?.map(async (player) => {
if (player !== bot.options.username) {
await sleep(100);
bot.core.run(`minecraft:team empty ${config.team.name}`);
await sleep(100);
bot.core.run(`minecraft:team join ${config.team.name} @a[name="${bot.options.username}"]`);
// this removes players who are not the bot
}
});
if (data.mode == 1) {
// this is checking if the team has been deleted
bot.core.run(`minecraft:team add ${config.team.name}`);
await sleep(100);
bot.core.run(`minecraft:team join ${config.team.name} @a[name="${bot.options.username}"]`);
} if (data.name !== JSON.stringify(config.team.displayName)) {
// this checks if the team displayName matches the one set in the config
bot.core.run(`minecraft:team modify ${config.team.name} displayName ${JSON.stringify(config.team.displayName)}`);
} if (data.prefix !== JSON.stringify(config.team.prefix)) {
// this checks if the team prefix matches the one set in the config
bot.core.run(`minecraft:team modify ${config.team.name} prefix ${JSON.stringify(config.team.prefix)}`);
} if (data.suffix !== JSON.stringify(config.team.suffix)) {
// this checks if the team suffix matches the one set in the config
bot.core.run(`minecraft:team modify ${config.team.name} suffix ${JSON.stringify(config.team.suffix)}`)
}
}
} catch (e) {
console.log(e.stack)
}
})
}
module.exports = {
data: {
enabled: true,
name: "teams",
type: "extras"
},
inject
}
+5 -1
View File
@@ -59,6 +59,10 @@ module.exports = (bot) => {
}
bot.tellraw = (selector, message) => {
bot.core.run(`minecraft:tellraw ${selector} ` + JSON.stringify(message))
if (bot.options.mode === "savageFriends") {
bot.core.run(`minecraft:tellraw ${selector} ` + JSON.stringify(bot.getMessageAsPrismarine(message)?.toMotd()))
} else {
bot.core.run(`minecraft:tellraw ${selector} ` + JSON.stringify(message))
}
}
}
+1
View File
@@ -0,0 +1 @@
chip told me to pull these files from chipmunkbot and add html to matrix relay chat
+28
View File
@@ -0,0 +1,28 @@
{
"colors": [
{"name": "black", "code": "§0", "ansi": "\u001b[0m\u001b[30m", "rgb": 0},
{"name": "dark_blue", "code": "§1", "ansi": "\u001b[0m\u001b[34m", "rgb": 170},
{"name": "dark_green", "code": "§2", "ansi": "\u001b[0m\u001b[32m", "rgb": 43520},
{"name": "dark_aqua", "code": "§3", "ansi": "\u001b[0m\u001b[36m", "rgb": 43690},
{"name": "dark_red", "code": "§4", "ansi": "\u001b[0m\u001b[31m", "rgb": 11141120},
{"name": "dark_purple", "code": "§5", "ansi": "\u001b[0m\u001b[35m", "rgb": 11141290},
{"name": "gold", "code": "§6", "ansi": "\u001b[0m\u001b[33m", "rgb": 16755200},
{"name": "gray", "code": "§7", "ansi": "\u001b[0m\u001b[37m", "rgb": 11184810},
{"name": "dark_gray", "code": "§8", "ansi": "\u001b[0m\u001b[90m", "rgb": 5592405},
{"name": "blue", "code": "§9", "ansi": "\u001b[0m\u001b[94m", "rgb": 5592575},
{"name": "green", "code": "§a", "ansi": "\u001b[0m\u001b[92m", "rgb": 5635925},
{"name": "aqua", "code": "§b", "ansi": "\u001b[0m\u001b[96m", "rgb": 5636095},
{"name": "red", "code": "§c", "ansi": "\u001b[0m\u001b[91m", "rgb": 16733525},
{"name": "light_purple", "code": "§d", "ansi": "\u001b[0m\u001b[95m", "rgb": 16733695},
{"name": "yellow", "code": "§e", "ansi": "\u001b[0m\u001b[93m", "rgb": 16777045},
{"name": "white", "code": "§f", "ansi": "\u001b[0m\u001b[97m", "rgb": 16777215}
],
"formatting": [
{"name": "bold", "code": "§l", "ansi": "\u001b[1m"},
{"name": "italic", "code": "§o", "ansi": "\u001b[3m"},
{"name": "underlined", "code": "§n", "ansi": "\u001b[4m"},
{"name": "strikethrough", "code": "§m", "ansi": "\u001b[9m"},
{"name": "obfuscated", "code": "§k", "ansi": "\u001b[6m"}
],
"reset": {"name": "reset", "code": "§r", "ansi": "\u001b[0m"}
}
+111
View File
@@ -0,0 +1,111 @@
const { colors } = require('./formatting.json')
const { normalize } = require('./utility')
const colormap = Object.fromEntries(colors.map(color => [color.name, color.rgb]))
const colorcodemap = Object.fromEntries(colors.map(color => [color.code, color.rgb]))
const reservedCharacters = {
'"': '&quot;',
"'": '&apos;',
'&': '&amp;',
'<': '&lt;',
'>': '&gt;'
}
function htmlStringify (text, { lang = {} } = {}) {
text = normalize(text)
let string = ''
if (text.text != null) string += preprocessText(text.text)
else if (text.translate != null) {
let format
if (Object.hasOwn(lang, text.translate)) format = lang[text.translate]
else if (text.fallback != null) format = text.fallback
else format = text.translate
const _with = text.with || []
let i = 0
string += preprocessText(format).replace(/%(?:(\d+)\$)?(s|%)/g, (g0, g1) => {
if (g0 === '%%') return '%'
const idx = g1 ? parseInt(g1) : i++
if (_with[idx]) {
return htmlStringify(_with[idx], { lang })
}
return ''
})
}
else if (text.selector != null) string += preprocessText(text.selector)
else if (text.keybind) {
// TODO
}
if (text.extra) {
for (const extra of text.extra) {
string += htmlStringify(extra, { lang })
}
}
if (text.color) {
const rgb = text.color[0] === '#' ? parseInt(text.color.substring(1), 16) : colormap[text.color]
if (rgb) string = `<font color="#${rgb.toString(16).padStart(6, '0')}">${string}</font>`
}
// formatting
if (text.bold) string = `<b>${string}</b>`
if (text.italic) string = `<i>${string}</i>`
if (text.underlined) string = `<u>${string}</u>`
if (text.strikethrough) string = `<strike>${string}</strike>`
if (text.obfuscated) string = `<blink>${string}</blink>`
return string
}
function preprocessText (input) {
let string = ''
let closing = ''
for (let i = 0; i < input.length; i++) {
const c = input[i]
// Emulate Minecraft's section sign escape sequences
if (c === '§') {
if ((i + 1) >= input.length) break // For trailing section signs, append nothing
const code = input.substring(i, i + 2)
i++
const hex = colorcodemap[code]
if (hex) {
string += closing
string += `<font color="${hex.toString(16).padStart(6, '0')}">`
closing = '</font>'
continue
}
if (code === '§r') {
string += closing
closing = ''
continue
}
if (code === '§l') { string += '<b>'; closing += '</b>' }
else if (code === '§o') { string += '<i>'; closing += '</i>' }
else if (code === '§n') { string += '<u>'; closing += '</u>' }
else if (code === '§m') { string += '<strike>'; closing += '</strike>' }
else if (code === '§k') { string += '<blink>'; closing += '</blink>' }
continue // Do not append the escape sequence itself to the string
}
else if (reservedCharacters[c]) string += reservedCharacters[c]
else if (c === '\n') string += '<br>'
else string += c
}
string += closing
return string
}
module.exports = htmlStringify
+103
View File
@@ -0,0 +1,103 @@
const { colors, formatting } = require('./formatting.json')
const formatNames = Object.fromEntries(formatting.map(format => [format.name, true]))
const baseColors = colors.map(color => intToRgb(color.rgb))
function parseJsonText (json) {
try {
return JSON.parse(json)
} catch {
return { text: '' }
}
}
function parseNbtText (data) {
try {
if (data.type === 'byte') return !!data.value
if (typeof data.value !== 'object') return data.value
if (Array.isArray(data.value)) return [...data.value]
if (data.type === 'list') return data.value.value.map(value => parseNbtText({ type: data.value.type, value }))
return Object.fromEntries(Object.entries(data.value).map(([key, value]) => ([key === '' ? 'text' : key, parseNbtText(value)])))
} catch {
return { text: '' }
}
}
function parseText (text) {
const f = text?.type ? parseNbtText : parseJsonText
return f(text)
}
function normalize (text) {
if (typeof text === 'string') return { text }
if (Array.isArray(text)) {
const text2 = [...text]
const text3 = { ...normalize(text2.shift()) }
text3.extra = text2
return text3
}
return text
}
function rgbToInt (r, g, b) {
return (r & 0xff) << 16 | (g & 0xff) << 8 | (b & 0xff)
}
function intToRgb (int) {
const r = (int >> 16) & 0xff
const g = (int >> 8) & 0xff
const b = int & 0xff
return [r, g, b]
}
// skidded from https://github.com/edqx/amongus-experiments/blob/master/index5.js#L34C1-L56C2
function getNearestColor (rgb) {
if (typeof rgb === 'number') rgb = intToRgb(rgb)
const [red, green, blue] = rgb
let nearestDist = Infinity
let nearestColorIdx
for (let i = 0; i < baseColors.length; i++) {
const baseColor = baseColors[i]
const [baseR, baseG, baseB] = baseColor
const diffR = (red - baseR) * (red - baseR)
const diffG = (green - baseG) * (green - baseG)
const diffB = (blue - baseB) * (blue - baseB)
const dist = Math.sqrt(diffR + diffG + diffB)
if (dist < nearestDist) {
nearestDist = dist
nearestColorIdx = i
}
}
return nearestColorIdx
}
function getChangedFormatting (text, previousText, parent = {}) {
// Merge both texts with their parents
text = { ...parent, ...text }
if (previousText) previousText = { ...parent, ...previousText }
const getAllFormatting = () => Object.fromEntries(Object.entries(text).filter(([key, value]) => formatNames[key] || key === 'color'))
if (!previousText || text.color !== previousText.color) return getAllFormatting()
const format = {}
for (const key in formatNames) {
if (text[key] && previousText[key]) continue
if (previousText[key] && !text[key]) return getAllFormatting() // Color codes do not have any way to unset specific formattings
if (text[key] == null) continue
format[key] = format[key]
}
format.color = text.color
return format
}
module.exports = { parseJsonText, parseNbtText, parseText, normalize, rgbToInt, intToRgb, getNearestColor, getChangedFormatting }
+3 -3
View File
@@ -1,6 +1,6 @@
const fs = require("fs");
const path = require("path");
async function loadModules (bot, options, config, discordClient, mxClient) {
async function loadModules (bot, options, config, discordClient) {
bot.modules = [];
for (const filename of fs.readdirSync(path.join(__dirname, '../', 'modules'))) {
try {
@@ -9,12 +9,12 @@ async function loadModules (bot, options, config, discordClient, mxClient) {
if (module.data.enabled === false) {
bot.modules.push(module);
} else {
module.inject({ bot, options, config, discordClient, mxClient });
module.inject({ bot, options, config, discordClient });
bot.modules.push(module);
}
} if (filename.endsWith(".mjs")) {
const module = await import(path.join(__dirname, '../modules', filename));
module.default({ bot, options, config, discordClient, mxClient });
module.default({ bot, options, config, discordClient });
}
} catch (error) {
console.error(`Failed to load module ${filename} due to error`);