finished filter and made the bot send vanish in chat instead of core. v6.0.5, Build: 1050

This commit is contained in:
Parker2991 2024-10-09 12:12:54 -04:00
parent 0b264d7aaf
commit e75576a488
20 changed files with 172 additions and 77 deletions

2
.gitignore vendored
View file

@ -4,4 +4,6 @@ config.yml
src/modules/exploits.js
logs/*
src/data/filter.json
data/filter.json
prototyping-crap

View file

@ -60,6 +60,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":
@ -67,7 +68,7 @@ module.exports = {
if (bot.console.customChat.enabled) {
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
} else if (!bot.console.customChat.enabled) {
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
// bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
}
break
case "trusted":

View file

@ -22,37 +22,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 +55,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":

View file

@ -111,11 +111,19 @@ module.exports = {
commandComponent.push("\n");
commandComponent.push(usagesComponent);
for (const aliases of command.aliases) {
if (args[0] === command.name) {
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) {
} 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
}
}

View file

@ -270,7 +270,7 @@ module.exports = {
color: "light_purple"
},
{
text: "aaa - FBot, SnifferBot, Xbot\n",
text: "aaa - FBot, SnifferBot, Xbot, Hydra\n",
color: "gold",
},
{

View file

@ -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
])
}

View file

@ -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()}`)
}

View file

@ -1,7 +1,7 @@
const CommandError = require('../util/command_error.js')
module.exports = {
name: 'netmsg',
trustLevel: 1,
trustLevel: 0,
aliases: [
],

View file

@ -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} `)

View file

@ -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}]`)

View file

@ -1,5 +1,3 @@
# FNFBoyfriendBot v6.0.0-alpha config
prefixes:
- "!"
- "fnfbfbot!"

View file

@ -1 +1 @@
[{"ignoreCase":false,"regexed":false,"name":"e"},{"ignoreCase":false,"regexed":false,"name":"sladkjf"},{"ignoreCase":true,"regexed":true,"name":"amogus"}]
[]

View file

@ -1,8 +1,8 @@
{
"bot": {
"buildstring": {
"version": "v6.0.4",
"build":"1035",
"version": "v6.0.5",
"build":"1050",
"codename":""
},
"source": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot/"

View file

@ -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()

View file

@ -58,7 +58,7 @@ 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]
// 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' })
} else if (command?.trustLevel === 1 && source?.sources.discord) {

View file

@ -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,117 @@ 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 () {
for (const filteredPlayers of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
if (filteredPlayers.ignoreCase) {
check = bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase())
} else if (filteredPlayers.regexed) {
let regex = new RegExp(filteredPlayers.name);
check = bot.players.find((players) => regex.test(players.profile.name))
} else if (filteredPlayers.ignoreCase && filteredPlayers.regexed) {
let regex = new RegExp(filteredPlayers.name.toLowerCase());
check = bot.players.find((players) => regex.test(players.profile.name.toLowerCase()))
} else {
check = bot.players.find((players) => players.profile.name === filteredPlayers.name)
}
}
if (!check) return;
bot.core.run(`execute run gamemode adventure @a[name="${check?.profile?.name}"]`)
bot.core.run(`execute run deop @a[name="${check?.profile?.name}"]`);
bot.core.run(`essentials:mute ${check?.uuid} 10y`);
}
}
bot.on('message', (message) => {
try {
const stringMessage = bot.getMessageAsPrismarine(message)?.toString()
for (const filteredPlayers of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
if (filteredPlayers.ignoreCase) {
if (!bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase())) return;
else if (bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase()).gamemode !== 2) {
bot.core.run(`execute run gamemode adventure @a[name="${bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase()).profile.name}"]`);
} else if (stringMessage.includes('op')) {
setTimeout(() => {
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase()).profile.name}"]`)
}, 10);
}
} else if (filteredPlayers.regexed) {
let regex = new RegExp(filteredPlayers.name);
if (!bot.players.find((players) => regex.test(players.profile.name))) return;
else if (bot.players.find((players) => regex.test(players.profile.name)).gamemode !== 2) {
bot.core.run(`execute run gamemode adventure @a[name="${bot.players.find((players) => regex.test(players.profile.name)).profile.name}"]`);
} else if (stringMessage.includes('op')) {
setTimeout(() => {
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => regex.test(players.profile.name)).profile.name}"]`);
}, 10)
}
} else if (filteredPlayers.ignoreCase && filteredPlayers.regexed) {
let regex = new RegExp(filteredPlayers.name.toLowerCase());
if (!bot.players.find((players) => regex.test(players.profile.name.toLowerCase()))) return;
else if (bot.players.find((players) => regex.test(players.profile.name.toLowerCase())).gamemode !== 2) {
bot.core.run(`execute run gamemode adventure @a[name="${bot.players.find((players) => regex.test(players.profile.name.toLowerCase())).profile.name}"]`);
} else if (stringMessage.includes('op')) {
setTimeout(() => {
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => regex.test(players.profile.name.toLowerCase())).profile.name}"]`);
}, 10)
}
} else {
if (!bot.players.find((players) => players.profile.name === filteredPlayers.name)) return;
else if (bot.players.find((players) => players.profile.name === filteredPlayers.name).gamemode !== 2) {
bot.core.run(`execute run gamemode adventure @a[name="${bot.players.find((players) => players.profile.name === filteredPlayers.name).profile.name}"]`);
} else if (stringMessage.includes('op')) {
setTimeout(() => {
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => players.profile.name === filteredPlayers.name).profile.name}"]`);
}, 10)
}
}
}
} catch (e) {
bot.console.warn(e.stack);
}
})
bot.on('parsed_message', (message) => {
const stringMessage = bot.getMessageAsPrismarine(message)?.toString();
for (const filteredPlayers of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
if (filteredPlayers.ignoreCase) {
check = bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase())
} else if (filteredPlayers.regexed) {
let regex = new RegExp(filteredPlayers.name);
check = bot.players.find((players) => regex.test(players.profile.name))
} else if (filteredPlayers.ignoreCase && filteredPlayers.regexed) {
let regex = new RegExp(filteredPlayers.name.toLowerCase());
check = bot.players.find((players) => regex.test(players.profile.name.toLowerCase()))
} else {
check = bot.players.find((players) => players.profile.name === filteredPlayers.name)
}
}
if (bot.filter.list().length === 0) return;
if (!check) return;
if (!bot.players) return;
if (message.sender.profile.name === check?.profile?.name) {
bot.core.run(`essentials:mute ${check?.uuid} 10y`);
}
})
}
module.exports = filter;
// let e = new RegExp('Parker.*'); bot.players.find((a) => e.test(a.profile.name))

View file

@ -95,7 +95,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`);

7
src/output.txt Normal file
View file

@ -0,0 +1,7 @@
27 util/ChatParsers/ChipmunkMod.js
25 util/ChatParsers/Creayun.js
41 util/ChatParsers/Kaboom.js
23 util/ChatParsers/VanillaChat.js
26 util/ChatParsers/sayConsole.js
25 util/ChatParsers/yfdCustomChat.js
167 total

View file

@ -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'};
}

View file

@ -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 {