forked from afspiegeling/NitoriBot
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
831fda8607 | ||
|
|
c6f77b0ac3 | ||
|
|
e75576a488 |
@@ -4,4 +4,6 @@ config.yml
|
||||
src/modules/exploits.js
|
||||
logs/*
|
||||
src/data/filter.json
|
||||
data/filter.json
|
||||
prototyping-crap
|
||||
|
||||
|
||||
Generated
+303
-2677
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -2,14 +2,14 @@
|
||||
"dependencies": {
|
||||
"cowsay": "^1.6.0",
|
||||
"cowsay2": "^2.0.4",
|
||||
"discord.js": "^14.11.0",
|
||||
"discord.js": "^14.16.3",
|
||||
"java-parser": "^2.3.2",
|
||||
"js-yaml": "^4.1.0",
|
||||
"json-stringify": "^1.0.0",
|
||||
"json5": "^2.2.3",
|
||||
"jvm": "^0.5.3",
|
||||
"man-db": "^1.0.3",
|
||||
"minecraft-data": "^3.36.1",
|
||||
"minecraft-data": "^3.69.0",
|
||||
"minecraft-protocol": "^1.47.0",
|
||||
"mojangson": "^2.0.4",
|
||||
"node-gyp": "^10.2.0",
|
||||
|
||||
@@ -4,7 +4,13 @@ module.exports = {
|
||||
aliases: [
|
||||
|
||||
],
|
||||
usages: [],
|
||||
usages: [
|
||||
'server/srv <all/servername>',
|
||||
'customchat <on/true/enable/off/false/disable>',
|
||||
'say <message>',
|
||||
'validate/validation/val <owner/o/admin/a/trusted/t>',
|
||||
'logging/togglelogging/logtoconsole <on/true/enable/off/false/disable>'
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
@@ -60,6 +66,7 @@ module.exports = {
|
||||
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
|
||||
} else if (!bot.console.customChat.enabled) {
|
||||
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
|
||||
// bot.chat.message(`${config.prefixes[0]}${args.slice(2)} ${args.slice(3).shift()}${bot.validation.trusted}`)
|
||||
}
|
||||
break
|
||||
case "admin":
|
||||
@@ -84,6 +91,7 @@ module.exports = {
|
||||
break
|
||||
case 'logging':
|
||||
case 'togglelogging':
|
||||
case 'logtoconsole':
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case 'on':
|
||||
case 'enable':
|
||||
|
||||
+19
-23
@@ -3,8 +3,9 @@ module.exports = {
|
||||
name: 'filter',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
"blacklist"
|
||||
],
|
||||
description: '',
|
||||
description: 'filters players',
|
||||
usages: [
|
||||
"list",
|
||||
"--regex(-r) --ignorecase(-i) add <player>",
|
||||
@@ -22,37 +23,23 @@ module.exports = {
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
let component = [];
|
||||
if (bot.options.isCreayun || bot.options.isSavage) throw new CommandError('this command is meant for kaboom.pw and its clones')
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4]) return
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case 'list':
|
||||
// bot.tellraw(`@a`, JSON.stringify(bot.filter.list().length));
|
||||
if (bot.filter.list().length === 0) {
|
||||
component.push({
|
||||
translate: '%s%s %s%s%s',
|
||||
color: 'blue',
|
||||
translate: '%s: (%s)',
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
{ text: 'Players', color: 'dark_blue' },
|
||||
{ text: ':', color: 'dark_blue' },
|
||||
{ text: '(', color: 'blue' },
|
||||
{ text: JSON.stringify(bot.filter.list().length), color: 'gold' },
|
||||
{ text: ')', color: 'blue' },
|
||||
]
|
||||
})
|
||||
} else {
|
||||
let i = 0;
|
||||
let listComponent = []
|
||||
/*component.push({
|
||||
translate: '%s%s %s%s%s\n %s',
|
||||
color: 'blue',
|
||||
with: [
|
||||
{ text: 'Players', color: 'dark_blue' },
|
||||
{ text: ':', color: 'dark_blue' },
|
||||
{ text: '(', color: 'blue' },
|
||||
{ text: JSON.stringify(bot.filter.list().length), color: 'gold' },
|
||||
{ text: ')', color: 'blue' },
|
||||
|
||||
]
|
||||
})*/
|
||||
for (const players of bot.filter.list()) {
|
||||
listComponent.push({
|
||||
translate: '%s \u203a %s',
|
||||
@@ -69,14 +56,18 @@ module.exports = {
|
||||
listComponent.pop()
|
||||
|
||||
component.push({
|
||||
translate: 'Players (%s):',
|
||||
color: 'dark_blue',
|
||||
with: [ { text: `${bot.filter.list().length}`, color: 'gold' } ]
|
||||
translate: '%s: (%s)',
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
{ text: 'Players', color: 'dark_blue' },
|
||||
{ text: `${bot.filter.list().length}`, color: 'gold' }
|
||||
]
|
||||
})
|
||||
component.push('\n')
|
||||
component.push(listComponent)
|
||||
bot.tellraw("@a", component)
|
||||
// bot.tellraw("@a", component)
|
||||
}
|
||||
bot.tellraw("@a", component)
|
||||
break;
|
||||
case "--regex":
|
||||
case "-r":
|
||||
@@ -99,7 +90,12 @@ module.exports = {
|
||||
break;
|
||||
case "--ignorecase":
|
||||
case "-i":
|
||||
bot.filter.add(true, false, args.slice(2).join(' '))
|
||||
switch (args[2]?.toLowerCase()) {
|
||||
case "add":
|
||||
bot.filter.add(true, false, args[3]);
|
||||
bot.chat.message(`Added ${args[3]} to the filter`)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "add":
|
||||
case "a":
|
||||
|
||||
+21
-11
@@ -54,7 +54,7 @@ module.exports = {
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.name} <trusted/admin/owner hashes>`, color: "blue" },
|
||||
{ text: `${command.usages}`, color: "aqua" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.trustLevel === 2) {
|
||||
@@ -63,7 +63,7 @@ module.exports = {
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.name} <admin/owner hashes>`, color: "blue" },
|
||||
{ text: `${command.usages}`, color: "aqua" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.trustLevel === 3) {
|
||||
@@ -72,16 +72,16 @@ module.exports = {
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.name} <owner hash>`, color: "blue" },
|
||||
{ text: `${command.usages}`, color: "aqua" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else {
|
||||
} else if (command?.trustLevel === 0 || command.trustLevel === 4) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.name}`, color: "blue" },
|
||||
{ text: `${command.usages.toString().replaceAll(',','')}`, color: "aqua" },
|
||||
{ text: `${usages.toString().replaceAll(',','')}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
}
|
||||
@@ -110,15 +110,25 @@ module.exports = {
|
||||
})
|
||||
commandComponent.push("\n");
|
||||
commandComponent.push(usagesComponent);
|
||||
for (const aliases of command.aliases) {
|
||||
if (args[0] === command.name) {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, commandComponent)
|
||||
// for (const aliases of command.aliases) {
|
||||
if (args[0]?.toLowerCase() === command.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] === aliases) {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, commandComponent)
|
||||
}
|
||||
/* } 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)*/
|
||||
// }
|
||||
if (command.trustLevel === 0) {
|
||||
public.push([
|
||||
{
|
||||
|
||||
@@ -270,7 +270,7 @@ module.exports = {
|
||||
color: "light_purple"
|
||||
},
|
||||
{
|
||||
text: "aaa - FBot, SnifferBot, Xbot\n",
|
||||
text: "aaa - FBot, SnifferBot, Xbot, Hydra\n",
|
||||
color: "gold",
|
||||
},
|
||||
{
|
||||
|
||||
@@ -11,10 +11,10 @@ module.exports = {
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
process.exit(69);
|
||||
process.kill(process.pid);
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
process.exit(69);
|
||||
process.kill(process.pid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ module.exports = {
|
||||
const component = []
|
||||
for (const player of players) {
|
||||
component.push({
|
||||
translate: `%s \u203a %s [%s %s %s %s %s]`,
|
||||
color: 'blue',
|
||||
translate: `%s \u203a %s [%s: %s %s %s: %s]`,
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
player.displayName ?? player.profile.name,
|
||||
{
|
||||
@@ -34,10 +34,10 @@ module.exports = {
|
||||
}]
|
||||
}
|
||||
},
|
||||
{ text: `Ping:`, color: 'dark_blue' },
|
||||
{ text: `Ping`, color: 'dark_blue' },
|
||||
{ text: `${player.latency}`, color: 'gold' },
|
||||
{ text: '/', color: 'dark_aqua' },
|
||||
{ text: `Gamemode:`, color: 'dark_blue' },
|
||||
{ text: '/', color: 'dark_gray' },
|
||||
{ text: `Gamemode`, color: 'dark_blue' },
|
||||
{ text: `${player.gamemode}`, color: 'gold' },
|
||||
]
|
||||
})
|
||||
@@ -53,10 +53,11 @@ module.exports = {
|
||||
}, 300)
|
||||
} else if (bot.options.isKaboom) {
|
||||
bot.tellraw(`@a[name="${source.player.profile.name}"]`, [
|
||||
{ text: `Players: `, color:'gray' },
|
||||
{ text: '(' , color: 'gray' },
|
||||
{ text: `Players`, color: 'dark_blue' },
|
||||
{ text: ': ', color: 'dark_gray' },
|
||||
{ text: '(' , color: 'dark_gray' },
|
||||
{ text: `${JSON.stringify(bot.players.length)}`, color: 'gold' },
|
||||
{ text: ')\n', color: 'gray' },
|
||||
{ text: ')\n', color: 'dark_gray' },
|
||||
component
|
||||
])
|
||||
}
|
||||
|
||||
@@ -18,10 +18,32 @@ module.exports = {
|
||||
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) })
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
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
|
||||
]
|
||||
})
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component);
|
||||
/* bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
{
|
||||
text: `Ip \u203a ${host}:${Number(port ?? 25565)}\n`,
|
||||
color: 'gray',
|
||||
@@ -62,7 +84,7 @@ module.exports = {
|
||||
color: 'gray',
|
||||
},
|
||||
server.description,
|
||||
])
|
||||
])*/
|
||||
} catch (e) {
|
||||
bot.chat.message(`${e.toString()}`)
|
||||
}
|
||||
|
||||
+2
-2
@@ -14,11 +14,11 @@ module.exports = {
|
||||
// if (!source.player) return
|
||||
if (bot.options.isKaboom) {
|
||||
x = between(-30_000_000, 30_000_000)
|
||||
y = 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 = between(-4096, 4096);
|
||||
y = 100
|
||||
z = between(-4096, 4096);
|
||||
}
|
||||
// bot.tellraw("@a", `Randomly Teleported: ${sender.profile.name} to x:${x} y:${y} z:${z} `)
|
||||
|
||||
@@ -13,20 +13,6 @@ module.exports = {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
/* if (args[0] === bot.validation.trusted) {
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message('&2Valid Trusted hash');
|
||||
} else {
|
||||
bot.tellraw(`@a`, { text: "Valid Trusted hash", color: "dark_green" });
|
||||
}
|
||||
}
|
||||
if (args[0] === bot.validation.owner) {
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message("&2Valid Owner hash");
|
||||
} else {
|
||||
bot.tellraw(`@a`, { text: "Valid Owner hash", color: "dark_green" });
|
||||
}
|
||||
}*/
|
||||
if (args[0] === bot.validation.trusted) {
|
||||
bot.chat.message('&2Valid Trusted hash');
|
||||
}
|
||||
@@ -42,7 +28,6 @@ module.exports = {
|
||||
const event = bot?.discord?.message
|
||||
const roles = event?.member?.roles?.cache
|
||||
const source = context.source;
|
||||
console.log(Object.keys(bot.discord.message.member.user.username));
|
||||
if (roles?.some(role => role.name === `${config.discord.roles.trusted}`)) {
|
||||
bot.discord.message.reply('Valid trusted user')
|
||||
bot.chat.message(`Valid trusted user [${bot.discord.message.member.user.username}]`)
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
const CommandError = require('../util/command_error');
|
||||
const { request } = require('undici');
|
||||
module.exports = {
|
||||
name: 'weather',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'check the weather of cities',
|
||||
usages: [
|
||||
"<message>"
|
||||
],
|
||||
async execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
try {
|
||||
let component = [];
|
||||
const weather = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ')}`);
|
||||
const info = await weather.body.json();
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s%s (%s%s)\n%s: %s %s %s (%s %s %s)\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Location", color: config.colors.commands.primary },
|
||||
{ text: `${info.location.name}, ${info.location.region}, ${info.location.country}`, color: config.colors.commands.secondary },
|
||||
{ text: "Latitude", color: config.colors.commands.primary },
|
||||
{ text: `${info.location.lat}`, color: config.colors.integer },
|
||||
{ text: "Longitude", color: config.colors.commands.primary },
|
||||
{ text: `${info.location.lon}`, color: config.colors.integer },
|
||||
{ text: "Time zone", color: config.colors.commands.primary },
|
||||
{ text: `${info.location.tz_id}`, color: config.colors.commands.secondary },
|
||||
{ text: "Time", color: config.colors.commands.primary },
|
||||
{ text: `${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id, })}`, color: config.colors.integer },
|
||||
{ text: "Temp", color: config.colors.commands.primary },
|
||||
{ text: `${info.current.temp_c}`, color: config.colors.integer },
|
||||
{ text: "\u00b0C", color: config.colors.commands.secondary },
|
||||
{ text: `${info.current.temp_f}`, color: config.colors.integer },
|
||||
{ text: "\u00b0F", color: config.colors.commands.secondary },
|
||||
{ text: "Wind speed" , color: config.colors.commands.primary },
|
||||
{ text: `${info.current.wind_kph}`, color: config.colors.integer },
|
||||
{ text: `kph`, color: config.colors.commands.secondary },
|
||||
{ text: `${info.current.wind_dir}`, color: config.colors.secondary },
|
||||
{ text: `${info.current.wind_mph}`, color: config.colors.integer },
|
||||
{ text: `mph`, color: config.colors.commands.secondary },
|
||||
{ text: `${info.current.wind_dir}`, color: config.colors.commands.secondary },
|
||||
{ text: "Condition", color: config.colors.commands.primary },
|
||||
{ text: `${info.current.condition.text}`, color: config.colors.commands.secondary },
|
||||
{ text: "Humidity", color: config.colors.commands.primary },
|
||||
{ text: `${info.current.humidity}`, color: config.colors.integer },
|
||||
]
|
||||
})
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
# FNFBoyfriendBot v6.0.0-alpha config
|
||||
|
||||
prefixes:
|
||||
- "!"
|
||||
- "fnfbfbot!"
|
||||
@@ -25,17 +23,24 @@ core:
|
||||
y: 0
|
||||
z: 15
|
||||
|
||||
commandSetMessage: true
|
||||
commandSetMessage: false
|
||||
|
||||
keys:
|
||||
trusted: "trusted key here"
|
||||
admin: "admin key here"
|
||||
owner: "owner key here"
|
||||
|
||||
weatherApiKey: ""
|
||||
|
||||
colors:
|
||||
integer: "gold"
|
||||
discord:
|
||||
embed: "#000000"
|
||||
error: "#FF0000"
|
||||
commands:
|
||||
primary: "dark_blue"
|
||||
secondary: "blue"
|
||||
tertiary: "dark_gray"
|
||||
|
||||
console:
|
||||
prefix: "c."
|
||||
|
||||
@@ -1 +1 @@
|
||||
[{"ignoreCase":false,"regexed":false,"name":"e"},{"ignoreCase":false,"regexed":false,"name":"sladkjf"},{"ignoreCase":true,"regexed":true,"name":"amogus"}]
|
||||
[]
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"bot": {
|
||||
"buildstring": {
|
||||
"version": "v6.0.4",
|
||||
"build":"1035",
|
||||
"version": "v6.0.6",
|
||||
"build":"1060",
|
||||
"codename":""
|
||||
},
|
||||
"source": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot/"
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ function chat (bot, options, config) {
|
||||
|
||||
bot.on('packet.system_chat', packet => {
|
||||
const message = tryParse(packet.content)
|
||||
if (config.commandSetMessage) {
|
||||
if (!config.commandSetMessage) {
|
||||
if (message.translate === 'advMode.setCommand.success') return // Ignores command set message
|
||||
}
|
||||
if (message.translate === 'multiplayer.message_not_delivered') return
|
||||
|
||||
@@ -67,7 +67,7 @@ function core (bot, options, config) {
|
||||
const location = bot.core.currentBlock()
|
||||
if (!location) return
|
||||
if (bot.options.isSavage || bot.options.isCreayun || bot.options.useChat) {
|
||||
bot.chat.command(`${command?.substring(0, 256)}`)
|
||||
return
|
||||
} else {
|
||||
bot._client.write('update_command_block', { command: command.substring(0, 32767), location, mode: 1, flags: 0b100 })
|
||||
bot.core.incrementCurrentBlock()
|
||||
|
||||
@@ -11,6 +11,7 @@ function command_loop (bot, options, config) {
|
||||
})
|
||||
|
||||
bot.on('packet.login', () => {
|
||||
if (this.list.length === 0) return
|
||||
timer = ({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
|
||||
this.list.push(timer);
|
||||
})
|
||||
|
||||
@@ -58,20 +58,22 @@ function command_manager (bot, options, config, discordClient) {
|
||||
const event = bot.discord.message;
|
||||
const roles = event?.member?.roles?.cache;
|
||||
if (command?.trustLevel === 1 && !source?.sources?.discord) {
|
||||
const hash = args[0]
|
||||
if (args.length === 0 && bot.validation.trusted && bot.validation.admin && bot.validation.owner && !source?.sources?.console) throw new CommandError({ text: "Please provide an trusted or an admin or an owner hash" })
|
||||
if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.admin && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted or admin or owner hash', color: 'dark_red' })
|
||||
if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.admin && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted or admin or owner hash', color: 'dark_red' });
|
||||
// if (args[0] === bot.validation.trusted || args[0] === bot.validation.admin || args[0] === bot.validation.owner) bot.validation.update();
|
||||
} else if (command?.trustLevel === 1 && source?.sources.discord) {
|
||||
const hasRole = roles?.some(role => role.name === `${config.discord.roles.trusted}` || role.name === `${config.discord.roles.owner}`)
|
||||
if (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!' })
|
||||
}
|
||||
if (command?.trustLevel === 2 && !source.sources.console) {
|
||||
if (args.length === 0 && bot.validation.admin && bot.validation.owner && !source.sources.console) throw new CommandError({ text: "Please provide an trusted or owner hash" })
|
||||
if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted or owner hash', color: 'dark_red' })
|
||||
if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted or owner hash', color: 'dark_red' });
|
||||
// if (args[0] === bot.validation.admin || args[0] === bot.validation.owner) bot.validation.update();
|
||||
}
|
||||
if (command?.trustLevel === 3 && !source.sources.discord && !source.sources.console) {
|
||||
if (args.length === 0 && bot.validation.owner) throw new CommandError({ text: "Please provide an owner hash" })
|
||||
if (args[0] !== bot.validation.owner) throw new CommandError({ translate: 'Invalid owner hash', color: 'dark_red' })
|
||||
// if (args[0] === bot.validation.owner) bot.validation.update();
|
||||
} else if (command?.trustLevel === 3 && source.sources.discord && !source.sources.console) {
|
||||
const hasRole = roles?.some(role => role.name === `${config.discord.roles.owner}`)
|
||||
if (!hasRole) throw new CommandError({ translate: 'You are not the owner!' })
|
||||
@@ -86,7 +88,7 @@ function command_manager (bot, options, config, discordClient) {
|
||||
} else if (!command?.execute && command && !source?.sources?.discord) {
|
||||
throw new CommandError(`${command.name} command is not supported in game!`)
|
||||
} else if (command?.execute && command && !source?.sources?.discord) {
|
||||
return command?.execute({ bot, source, arguments: args, config, discordClient})
|
||||
return command?.execute({ bot, source, arguments: args, config, discordClient });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error.stack)
|
||||
|
||||
+28
-21
@@ -1,5 +1,6 @@
|
||||
const CommandSource = require('../util/command_source');
|
||||
const prismarineChat = require('prismarine-chat')('1.20.2');
|
||||
const convert = require('color-convert')
|
||||
function Console (bot, options, config) {
|
||||
let rateLimit = 0;
|
||||
bot.console = {
|
||||
@@ -39,28 +40,34 @@ function Console (bot, options, config) {
|
||||
},
|
||||
customChat: {
|
||||
enabled: false,
|
||||
rainbow: false,
|
||||
chat (message) {
|
||||
const prefix = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
color:'dark_gray',
|
||||
with: [
|
||||
{
|
||||
text: 'FNFBoyfriendBot Console',
|
||||
color:'#00FFFF'
|
||||
},
|
||||
{
|
||||
selector: `${bot.username}`, color:'#00FFFF',
|
||||
clickEvent: { action: 'suggest_command', value: `${config.prefixes[0]}help` }
|
||||
},
|
||||
{
|
||||
text: '',
|
||||
extra: [`${message}`],
|
||||
color:'white'
|
||||
},
|
||||
],
|
||||
hoverEvent: { action:"show_text", value: 'FNF Sky is a fangirl but a simp for boyfriend confirmed??'},
|
||||
clickEvent: 'https://doin-your.mom' ?
|
||||
{ action: 'open_url', value: 'https://doin-your.mom' } : undefined,
|
||||
if (this.rainbow) {
|
||||
|
||||
|
||||
} else {
|
||||
prefix = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
color:'dark_gray',
|
||||
with: [
|
||||
{
|
||||
text: 'FNFBoyfriendBot Console',
|
||||
color:'#00FFFF'
|
||||
},
|
||||
{
|
||||
selector: `${bot.username}`, color:'#00FFFF',
|
||||
clickEvent: { action: 'suggest_command', value: `${config.prefixes[0]}help` }
|
||||
},
|
||||
{
|
||||
text: '',
|
||||
extra: [`${message}`],
|
||||
color:'white'
|
||||
},
|
||||
],
|
||||
hoverEvent: { action:"show_text", value: 'FNF Sky is a fangirl but a simp for boyfriend confirmed??'},
|
||||
clickEvent: 'https://doin-your.mom' ?
|
||||
{ action: 'open_url', value: 'https://doin-your.mom' } : undefined,
|
||||
}
|
||||
}
|
||||
bot.tellraw('@a', prefix)
|
||||
}
|
||||
|
||||
+74
-9
@@ -1,9 +1,8 @@
|
||||
//const json = require('../data/filter.json');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
//const json = fs.readFileSync(path.join(__dirname, '../data/filter.json'));
|
||||
function filter (bot, options, config, discordClient) {
|
||||
if (options.isSavage || options.isCreayun) return;
|
||||
// filter v5 (not to be confused with the bot version)
|
||||
bot.filter = {
|
||||
list () {
|
||||
try {
|
||||
@@ -12,33 +11,99 @@ function filter (bot, options, config, discordClient) {
|
||||
console.log(e.stack)
|
||||
}
|
||||
},
|
||||
|
||||
add (ignoreCase, regexed, player) {
|
||||
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
|
||||
var arrayadd = { ignoreCase: ignoreCase, regexed: regexed, name: player }
|
||||
data.push(arrayadd);
|
||||
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))
|
||||
},
|
||||
gamemodeCheck () {
|
||||
|
||||
},
|
||||
joinMsg () {
|
||||
|
||||
},
|
||||
check () {
|
||||
doAll () {
|
||||
|
||||
}
|
||||
}
|
||||
bot.on('message', async (data) => {
|
||||
for (const filteredPlayer of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
|
||||
let player_completion = (await bot.tab_complete('deop ')).filter(_ => _.tooltip == undefined);
|
||||
|
||||
// console.log(muted);
|
||||
// console.log(player_completion[0].match.toLowerCase());
|
||||
// console.log(bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase()).gamemode)
|
||||
player_completion.forEach(async (player) => {
|
||||
if (filteredPlayer.ignoreCase) {
|
||||
if (player.match !== bot.players.find((players) => players.profile.name === filteredPlayer.name.toLowerCase()).profile.name) return;
|
||||
if (player.match === bot.players.find((players) => players.profile.name === filteredPlayer.name.toLowerCase()).profile.name) {
|
||||
if (!bot.players.find((players) => players.profile.name === filteredPlayer.name.toLowerCase()).profile.name) return;
|
||||
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => players.profile.name === filteredPlayer.name.toLowerCase()).profile.name}"]`);
|
||||
}
|
||||
} else {
|
||||
if (player.match !== bot.players.find((players) => players.profile.name === filteredPlayer.name).profile.name) return;
|
||||
if (player.match === bot.players.find((players) => players.profile.name === filteredPlayer.name).profile.name) {
|
||||
if (!bot.players.find((players) => players.profile.name === filteredPlayer.name).profile.name) return;
|
||||
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => players.profile.name === filteredPlayer.name).profile.name}"]`);
|
||||
}
|
||||
}
|
||||
// if (filteredPlayer.ignoreCase) {
|
||||
/// console.log('e');
|
||||
// }
|
||||
//if (filteredPlayer.ignoreCase) {
|
||||
// if (player.match !== bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayer.name.toLowerCase())) return;
|
||||
// if (player.match === bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayer.name.toLowerCase())) {
|
||||
// bot.core.run(`execute run deop @a[name="${bot.players.find((players) => players.profile.name === filteredPlayer.name).profile.name}"]`);
|
||||
//}
|
||||
//if (bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayer.name.toLowerCase()).gamemode !== 2) {
|
||||
//console.log('e');
|
||||
// bot.core.run(`execute run gamemode adventure @a[name="${bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayer.name.toLowerCase()).profile.name}"]`);
|
||||
//}
|
||||
// }
|
||||
})
|
||||
/* if (player.match !== bot.players.find((players) => players.profile.name === filteredPlayer.name).profile.name) return;
|
||||
if (player.match === bot.players.find((players) => players.profile.name === filteredPlayer.name).profile.name) {
|
||||
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => players.profile.name === filteredPlayer.name).profile.name}"]`);
|
||||
}*/
|
||||
/* if (!player) return;
|
||||
if (player) {
|
||||
if (!bot.players.find((players) => players.profile.name === filteredPlayer.name).profile.name) return;
|
||||
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => players.profile.name === filteredPlayer.name).profile.name}"]`);
|
||||
}*/
|
||||
// console.log(player);
|
||||
// })
|
||||
}
|
||||
/* bot.players.forEach(async (player) => {
|
||||
if (player) {
|
||||
console.log(player_complete);
|
||||
}
|
||||
})*/
|
||||
})
|
||||
}
|
||||
module.exports = filter;
|
||||
// let e = new RegExp('Parker.*'); bot.players.find((a) => e.test(a.profile.name))
|
||||
/*
|
||||
let player_completion = (await bot.tab_complete('scoreboard players add ')).filter(_ => _.tooltip == undefined) // exclude>
|
||||
let op = (await bot.tab_complete('minecraft:op ')).filter(_ => _.tooltip == undefined);
|
||||
bot.players.forEach(async player => {
|
||||
if(!players.includes(player.uuid)) return
|
||||
|
||||
const a = player_completion.filter(_ => _.match == player.profile.name)
|
||||
const b = op.filter(_ => _.match == player.profile.name);
|
||||
//console.log(b)
|
||||
if(a.length >= 1) {
|
||||
player.vanished = true
|
||||
} else {
|
||||
bot.players = bot.players.filter(_ => _.uuid != player.uuid)
|
||||
}
|
||||
})
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
function player_list (bot, options, config) {
|
||||
bot.players = []
|
||||
|
||||
bot.on('packet.player_info', packet => {
|
||||
bot.on('packet.player_info', async (packet) => {
|
||||
const actions = []
|
||||
|
||||
if (packet.action & 0b000001) actions.push(addPlayer)
|
||||
if (packet.action & 0b000010) actions.push(initializeChat)
|
||||
if (packet.action & 0b000100) actions.push(updateGamemode)
|
||||
@@ -16,16 +15,17 @@ function player_list (bot, options, config) {
|
||||
action(entry)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
bot.on('packet.player_remove', async ({players}) => { // players has uuids of the players
|
||||
let player_completion = (await bot.tab_complete('scoreboard players add ')).filter(_ => _.tooltip == undefined) // exclude @a, @r, @s, @e, @p -aaa
|
||||
|
||||
bot.players.forEach(async player => {
|
||||
if(!players.includes(player.uuid)) return
|
||||
|
||||
const a = player_completion.filter(_ => _.match == player.profile.name)
|
||||
|
||||
const b = op.filter(_ => _.match == player.profile.name);
|
||||
//console.log(b)
|
||||
if(a.length >= 1) {
|
||||
player.vanished = true
|
||||
} else {
|
||||
@@ -39,7 +39,7 @@ function player_list (bot, options, config) {
|
||||
bot.players.push({
|
||||
uuid: entry.uuid,
|
||||
profile: { name: entry.player.name, properties: entry.player.properties },
|
||||
|
||||
// opped: false,
|
||||
chatSession: undefined,
|
||||
gamemode: undefined,
|
||||
listed: undefined,
|
||||
@@ -50,7 +50,7 @@ function player_list (bot, options, config) {
|
||||
}
|
||||
|
||||
function initializeChat (entry) {
|
||||
// TODO: Handle chat sessions
|
||||
|
||||
}
|
||||
|
||||
function updateGamemode (entry) {
|
||||
@@ -67,6 +67,21 @@ function player_list (bot, options, config) {
|
||||
target.listed = entry.listed
|
||||
}
|
||||
|
||||
/* async function op (target) {
|
||||
// let player_completion = (await bot.tab_complete('minecraft:op ')).filter(_ => _.tooltip === undefined);
|
||||
// console.log(player_completion);
|
||||
bot.players.forEach(async player => {
|
||||
if (!players.includes(player.uuid)) return;
|
||||
let player_completion = (await bot.tab_complete('minecraft:op ')).filter(_ => _.tooltip === undefined);
|
||||
const op = player_completion.filter(_ => _.match === players.profile.name);
|
||||
console.log(op);
|
||||
if (op.length >= 1) {
|
||||
player.opped = true
|
||||
}
|
||||
})
|
||||
target.opped = true
|
||||
}*/
|
||||
|
||||
function updateLatency (entry) {
|
||||
const target = bot.players.find(_entry => _entry.uuid === entry.uuid)
|
||||
if (!target) return
|
||||
|
||||
@@ -21,6 +21,7 @@ function selfcare (bot, options, config) {
|
||||
else if (stringMessage === "Successful login!") login = false;
|
||||
else if (stringMessage === "You're already logged in!") login = false;
|
||||
else if (stringMessage === "Please, register to the server with the command: /register <password> <ConfirmPassword>") register = true;
|
||||
else if (stringMessage === "This user isn't registered!") register = true;
|
||||
else if (stringMessage === "Successfully registered!") register = false;
|
||||
// else if (stringMessage === "You already have registered this username!") register = false;
|
||||
|
||||
@@ -95,7 +96,7 @@ You already have registered this username!
|
||||
else if (username) bot.chat.command(`username ${bot.options.username}`)
|
||||
else if (nickname) bot.chat.command(`nick off`)
|
||||
else if (!prefix) bot.chat.command(`prefix &8[&bPrefix&8: &3${config.prefixes[0]}&8]`);
|
||||
else if (!vanished) bot.core.run(`vanish ${bot.options.username} on`);
|
||||
else if (!vanished) bot.chat.command(`essentials:vanish on`);
|
||||
else if (unmuted) bot.core.run(`essentials:mute ${bot.uuid}`);
|
||||
else if (!god) bot.core.run(`god ${bot.options.username} enable`);
|
||||
else if (!teleportToggle) bot.core.run(`tptoggle ${bot.options.username} disable`);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
const crypto = require("crypto");
|
||||
function validation (bot, options, config, discordClient) {
|
||||
let hashRegenInterval = setInterval(() => {
|
||||
const crypto = require('crypto')
|
||||
function validation (bot, options, config) {
|
||||
setInterval(() => {
|
||||
bot.validation = {
|
||||
trusted: crypto.createHash('sha256').update(Math.floor(Date.now() / 5000) + config.keys.trusted).digest('hex').substring(0, 16),
|
||||
admin: crypto.createHash('sha256').update(Math.floor(Date.now() / 5000) + config.keys.admin).digest('hex').substring(0, 16),
|
||||
owner: crypto.createHash('sha256').update(Math.floor(Date.now() / 5000) + config.keys.owner).digest('hex').substring(0, 16),
|
||||
trusted: crypto.createHash('sha256').update(Math.floor(Date.now() / 1000) + config.keys.trusted).digest('hex').substring(0, 16),
|
||||
admin: crypto.createHash('sha256').update(Math.floor(Date.now() / 1000) + config.keys.admin).digest('hex').substring(0, 16),
|
||||
owner: crypto.createHash('sha256').update(Math.floor(Date.now() / 1000) + config.keys.owner).digest('hex').substring(0, 16),
|
||||
}
|
||||
}, 2000)
|
||||
}, 100)
|
||||
}
|
||||
module.exports = validation;
|
||||
module.exports = validation
|
||||
|
||||
@@ -17,7 +17,7 @@ function creayun (messageobj, data) {
|
||||
// console.log(data.players.find(player => player.profile.name === match[2]))
|
||||
sender = data.players.find(player => player.profile.name === match[2])
|
||||
// sender = data.players.find(player => util.isDeepStrictEqual(player.displayName, playerListDisplayName))
|
||||
if (!sender) return;
|
||||
// if (!sender) return;
|
||||
// console.log(sender)
|
||||
return { sender, contents: match[3], type: 'minecraft:chat'};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
function usernameGen (bot, config) {
|
||||
// const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
|
||||
const unicode = "▄".codePointAt(0).toString(16);
|
||||
const unicodeGen = "\\u" + "0000".substring(0, 4 - unicode.length) + unicode;
|
||||
if (bot.options.isSavage || bot.options.isCreayun && !bot.options.isKaboom) {
|
||||
characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user