added weather and re fucking writing. v6.0.6 build:1060
This commit is contained in:
parent
c6f77b0ac3
commit
831fda8607
18 changed files with 543 additions and 2822 deletions
2980
package-lock.json
generated
2980
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -2,14 +2,14 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cowsay": "^1.6.0",
|
"cowsay": "^1.6.0",
|
||||||
"cowsay2": "^2.0.4",
|
"cowsay2": "^2.0.4",
|
||||||
"discord.js": "^14.11.0",
|
"discord.js": "^14.16.3",
|
||||||
"java-parser": "^2.3.2",
|
"java-parser": "^2.3.2",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"json-stringify": "^1.0.0",
|
"json-stringify": "^1.0.0",
|
||||||
"json5": "^2.2.3",
|
"json5": "^2.2.3",
|
||||||
"jvm": "^0.5.3",
|
"jvm": "^0.5.3",
|
||||||
"man-db": "^1.0.3",
|
"man-db": "^1.0.3",
|
||||||
"minecraft-data": "^3.36.1",
|
"minecraft-data": "^3.69.0",
|
||||||
"minecraft-protocol": "^1.47.0",
|
"minecraft-protocol": "^1.47.0",
|
||||||
"mojangson": "^2.0.4",
|
"mojangson": "^2.0.4",
|
||||||
"node-gyp": "^10.2.0",
|
"node-gyp": "^10.2.0",
|
||||||
|
|
|
@ -4,7 +4,13 @@ module.exports = {
|
||||||
aliases: [
|
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) {
|
execute (context) {
|
||||||
const bot = context.bot
|
const bot = context.bot
|
||||||
const args = context.arguments;
|
const args = context.arguments;
|
||||||
|
@ -68,7 +74,7 @@ module.exports = {
|
||||||
if (bot.console.customChat.enabled) {
|
if (bot.console.customChat.enabled) {
|
||||||
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
|
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
|
||||||
} else if (!bot.console.customChat.enabled) {
|
} 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
|
break
|
||||||
case "trusted":
|
case "trusted":
|
||||||
|
@ -85,6 +91,7 @@ module.exports = {
|
||||||
break
|
break
|
||||||
case 'logging':
|
case 'logging':
|
||||||
case 'togglelogging':
|
case 'togglelogging':
|
||||||
|
case 'logtoconsole':
|
||||||
switch (args[1]?.toLowerCase()) {
|
switch (args[1]?.toLowerCase()) {
|
||||||
case 'on':
|
case 'on':
|
||||||
case 'enable':
|
case 'enable':
|
||||||
|
|
|
@ -3,8 +3,9 @@ module.exports = {
|
||||||
name: 'filter',
|
name: 'filter',
|
||||||
trustLevel: 1,
|
trustLevel: 1,
|
||||||
aliases: [
|
aliases: [
|
||||||
|
"blacklist"
|
||||||
],
|
],
|
||||||
description: '',
|
description: 'filters players',
|
||||||
usages: [
|
usages: [
|
||||||
"list",
|
"list",
|
||||||
"--regex(-r) --ignorecase(-i) add <player>",
|
"--regex(-r) --ignorecase(-i) add <player>",
|
||||||
|
@ -89,7 +90,12 @@ module.exports = {
|
||||||
break;
|
break;
|
||||||
case "--ignorecase":
|
case "--ignorecase":
|
||||||
case "-i":
|
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;
|
break;
|
||||||
case "add":
|
case "add":
|
||||||
case "a":
|
case "a":
|
||||||
|
|
|
@ -54,7 +54,7 @@ module.exports = {
|
||||||
with: [
|
with: [
|
||||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||||
{ text: `${command.name} <trusted/admin/owner hashes>`, color: "blue" },
|
{ text: `${command.name} <trusted/admin/owner hashes>`, color: "blue" },
|
||||||
{ text: `${command.usages}`, color: "aqua" },
|
{ text: `${usages}`, color: "aqua" },
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
} else if (command?.trustLevel === 2) {
|
} else if (command?.trustLevel === 2) {
|
||||||
|
@ -63,7 +63,7 @@ module.exports = {
|
||||||
with: [
|
with: [
|
||||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||||
{ text: `${command.name} <admin/owner hashes>`, color: "blue" },
|
{ text: `${command.name} <admin/owner hashes>`, color: "blue" },
|
||||||
{ text: `${command.usages}`, color: "aqua" },
|
{ text: `${usages}`, color: "aqua" },
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
} else if (command?.trustLevel === 3) {
|
} else if (command?.trustLevel === 3) {
|
||||||
|
@ -72,16 +72,16 @@ module.exports = {
|
||||||
with: [
|
with: [
|
||||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||||
{ text: `${command.name} <owner hash>`, color: "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({
|
usagesComponent.push({
|
||||||
translate: "%s%s %s",
|
translate: "%s%s %s",
|
||||||
with: [
|
with: [
|
||||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||||
{ text: `${command.name}`, color: "blue" },
|
{ text: `${command.name}`, color: "blue" },
|
||||||
{ text: `${command.usages.toString().replaceAll(',','')}`, color: "aqua" },
|
{ text: `${usages.toString().replaceAll(',','')}`, color: "aqua" },
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ module.exports = {
|
||||||
})
|
})
|
||||||
commandComponent.push("\n");
|
commandComponent.push("\n");
|
||||||
commandComponent.push(usagesComponent);
|
commandComponent.push(usagesComponent);
|
||||||
for (const aliases of command.aliases) {
|
// for (const aliases of command.aliases) {
|
||||||
if (args[0]?.toLowerCase() === command.name) {
|
if (args[0]?.toLowerCase() === command.name) {
|
||||||
if (bot.options.isSavage) {
|
if (bot.options.isSavage) {
|
||||||
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`);
|
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`);
|
||||||
|
@ -118,7 +118,8 @@ module.exports = {
|
||||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, commandComponent)
|
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, commandComponent)
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} if (args[0]?.toLowerCase() === aliases) {
|
}
|
||||||
|
/* } if (args[0]?.toLowerCase() === aliases) {
|
||||||
if (bot.options.isSavage) {
|
if (bot.options.isSavage) {
|
||||||
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`)
|
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`)
|
||||||
} else {
|
} else {
|
||||||
|
@ -126,7 +127,8 @@ module.exports = {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
console.log(aliases)*/
|
||||||
|
// }
|
||||||
if (command.trustLevel === 0) {
|
if (command.trustLevel === 0) {
|
||||||
public.push([
|
public.push([
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,10 +11,10 @@ module.exports = {
|
||||||
],
|
],
|
||||||
execute (context) {
|
execute (context) {
|
||||||
const bot = context.bot;
|
const bot = context.bot;
|
||||||
process.exit(69);
|
process.kill(process.pid);
|
||||||
},
|
},
|
||||||
discordExecute (context) {
|
discordExecute (context) {
|
||||||
const bot = context.bot;
|
const bot = context.bot;
|
||||||
process.exit(69);
|
process.kill(process.pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const CommandError = require('../util/command_error.js')
|
const CommandError = require('../util/command_error.js')
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'netmsg',
|
name: 'netmsg',
|
||||||
trustLevel: 0,
|
trustLevel: 1,
|
||||||
aliases: [
|
aliases: [
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
65
src/commands/weather.js
Normal file
65
src/commands/weather.js
Normal file
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -23,17 +23,24 @@ core:
|
||||||
y: 0
|
y: 0
|
||||||
z: 15
|
z: 15
|
||||||
|
|
||||||
commandSetMessage: true
|
commandSetMessage: false
|
||||||
|
|
||||||
keys:
|
keys:
|
||||||
trusted: "trusted key here"
|
trusted: "trusted key here"
|
||||||
admin: "admin key here"
|
admin: "admin key here"
|
||||||
owner: "owner key here"
|
owner: "owner key here"
|
||||||
|
|
||||||
|
weatherApiKey: ""
|
||||||
|
|
||||||
colors:
|
colors:
|
||||||
|
integer: "gold"
|
||||||
discord:
|
discord:
|
||||||
embed: "#000000"
|
embed: "#000000"
|
||||||
error: "#FF0000"
|
error: "#FF0000"
|
||||||
|
commands:
|
||||||
|
primary: "dark_blue"
|
||||||
|
secondary: "blue"
|
||||||
|
tertiary: "dark_gray"
|
||||||
|
|
||||||
console:
|
console:
|
||||||
prefix: "c."
|
prefix: "c."
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"bot": {
|
"bot": {
|
||||||
"buildstring": {
|
"buildstring": {
|
||||||
"version": "v6.0.5",
|
"version": "v6.0.6",
|
||||||
"build":"1050",
|
"build":"1060",
|
||||||
"codename":""
|
"codename":""
|
||||||
},
|
},
|
||||||
"source": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot/"
|
"source": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot/"
|
||||||
|
|
|
@ -72,7 +72,7 @@ function chat (bot, options, config) {
|
||||||
|
|
||||||
bot.on('packet.system_chat', packet => {
|
bot.on('packet.system_chat', packet => {
|
||||||
const message = tryParse(packet.content)
|
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 === 'advMode.setCommand.success') return // Ignores command set message
|
||||||
}
|
}
|
||||||
if (message.translate === 'multiplayer.message_not_delivered') return
|
if (message.translate === 'multiplayer.message_not_delivered') return
|
||||||
|
|
|
@ -11,6 +11,7 @@ function command_loop (bot, options, config) {
|
||||||
})
|
})
|
||||||
|
|
||||||
bot.on('packet.login', () => {
|
bot.on('packet.login', () => {
|
||||||
|
if (this.list.length === 0) return
|
||||||
timer = ({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
|
timer = ({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
|
||||||
this.list.push(timer);
|
this.list.push(timer);
|
||||||
})
|
})
|
||||||
|
|
|
@ -58,20 +58,22 @@ function command_manager (bot, options, config, discordClient) {
|
||||||
const event = bot.discord.message;
|
const event = bot.discord.message;
|
||||||
const roles = event?.member?.roles?.cache;
|
const roles = event?.member?.roles?.cache;
|
||||||
if (command?.trustLevel === 1 && !source?.sources?.discord) {
|
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.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) {
|
} 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}`)
|
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 (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!' })
|
||||||
}
|
}
|
||||||
if (command?.trustLevel === 2 && !source.sources.console) {
|
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.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 (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.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) 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) {
|
} else if (command?.trustLevel === 3 && source.sources.discord && !source.sources.console) {
|
||||||
const hasRole = roles?.some(role => role.name === `${config.discord.roles.owner}`)
|
const hasRole = roles?.some(role => role.name === `${config.discord.roles.owner}`)
|
||||||
if (!hasRole) throw new CommandError({ translate: 'You are not the 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) {
|
} else if (!command?.execute && command && !source?.sources?.discord) {
|
||||||
throw new CommandError(`${command.name} command is not supported in game!`)
|
throw new CommandError(`${command.name} command is not supported in game!`)
|
||||||
} else if (command?.execute && command && !source?.sources?.discord) {
|
} 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) {
|
} catch (error) {
|
||||||
console.error(error.stack)
|
console.error(error.stack)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const CommandSource = require('../util/command_source');
|
const CommandSource = require('../util/command_source');
|
||||||
const prismarineChat = require('prismarine-chat')('1.20.2');
|
const prismarineChat = require('prismarine-chat')('1.20.2');
|
||||||
|
const convert = require('color-convert')
|
||||||
function Console (bot, options, config) {
|
function Console (bot, options, config) {
|
||||||
let rateLimit = 0;
|
let rateLimit = 0;
|
||||||
bot.console = {
|
bot.console = {
|
||||||
|
@ -39,28 +40,34 @@ function Console (bot, options, config) {
|
||||||
},
|
},
|
||||||
customChat: {
|
customChat: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
|
rainbow: false,
|
||||||
chat (message) {
|
chat (message) {
|
||||||
const prefix = {
|
if (this.rainbow) {
|
||||||
translate: '[%s] %s \u203a %s',
|
|
||||||
color:'dark_gray',
|
|
||||||
with: [
|
} else {
|
||||||
{
|
prefix = {
|
||||||
text: 'FNFBoyfriendBot Console',
|
translate: '[%s] %s \u203a %s',
|
||||||
color:'#00FFFF'
|
color:'dark_gray',
|
||||||
},
|
with: [
|
||||||
{
|
{
|
||||||
selector: `${bot.username}`, color:'#00FFFF',
|
text: 'FNFBoyfriendBot Console',
|
||||||
clickEvent: { action: 'suggest_command', value: `${config.prefixes[0]}help` }
|
color:'#00FFFF'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '',
|
selector: `${bot.username}`, color:'#00FFFF',
|
||||||
extra: [`${message}`],
|
clickEvent: { action: 'suggest_command', value: `${config.prefixes[0]}help` }
|
||||||
color:'white'
|
},
|
||||||
},
|
{
|
||||||
],
|
text: '',
|
||||||
hoverEvent: { action:"show_text", value: 'FNF Sky is a fangirl but a simp for boyfriend confirmed??'},
|
extra: [`${message}`],
|
||||||
clickEvent: 'https://doin-your.mom' ?
|
color:'white'
|
||||||
{ action: 'open_url', value: 'https://doin-your.mom' } : undefined,
|
},
|
||||||
|
],
|
||||||
|
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)
|
bot.tellraw('@a', prefix)
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,95 +33,77 @@ function filter (bot, options, config, discordClient) {
|
||||||
},
|
},
|
||||||
|
|
||||||
doAll () {
|
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) => {
|
bot.on('message', async (data) => {
|
||||||
try {
|
for (const filteredPlayer of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
|
||||||
const stringMessage = bot.getMessageAsPrismarine(message)?.toString()
|
let player_completion = (await bot.tab_complete('deop ')).filter(_ => _.tooltip == undefined);
|
||||||
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) => {
|
// console.log(muted);
|
||||||
const stringMessage = bot.getMessageAsPrismarine(message)?.toString();
|
// console.log(player_completion[0].match.toLowerCase());
|
||||||
for (const filteredPlayers of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
|
// console.log(bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase()).gamemode)
|
||||||
if (filteredPlayers.ignoreCase) {
|
player_completion.forEach(async (player) => {
|
||||||
check = bot.players.find((players) => players.profile.name.toLowerCase() === filteredPlayers.name.toLowerCase())
|
if (filteredPlayer.ignoreCase) {
|
||||||
} else if (filteredPlayers.regexed) {
|
if (player.match !== bot.players.find((players) => players.profile.name === filteredPlayer.name.toLowerCase()).profile.name) return;
|
||||||
let regex = new RegExp(filteredPlayers.name);
|
if (player.match === bot.players.find((players) => players.profile.name === filteredPlayer.name.toLowerCase()).profile.name) {
|
||||||
check = bot.players.find((players) => regex.test(players.profile.name))
|
if (!bot.players.find((players) => players.profile.name === filteredPlayer.name.toLowerCase()).profile.name) return;
|
||||||
} else if (filteredPlayers.ignoreCase && filteredPlayers.regexed) {
|
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => players.profile.name === filteredPlayer.name.toLowerCase()).profile.name}"]`);
|
||||||
let regex = new RegExp(filteredPlayers.name.toLowerCase());
|
}
|
||||||
check = bot.players.find((players) => regex.test(players.profile.name.toLowerCase()))
|
} else {
|
||||||
} else {
|
if (player.match !== bot.players.find((players) => players.profile.name === filteredPlayer.name).profile.name) return;
|
||||||
check = bot.players.find((players) => players.profile.name === filteredPlayers.name)
|
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);
|
||||||
}
|
}
|
||||||
}
|
})*/
|
||||||
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;
|
module.exports = filter;
|
||||||
|
/*
|
||||||
|
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) {
|
function player_list (bot, options, config) {
|
||||||
bot.players = []
|
bot.players = []
|
||||||
|
|
||||||
bot.on('packet.player_info', packet => {
|
bot.on('packet.player_info', async (packet) => {
|
||||||
const actions = []
|
const actions = []
|
||||||
|
|
||||||
if (packet.action & 0b000001) actions.push(addPlayer)
|
if (packet.action & 0b000001) actions.push(addPlayer)
|
||||||
if (packet.action & 0b000010) actions.push(initializeChat)
|
if (packet.action & 0b000010) actions.push(initializeChat)
|
||||||
if (packet.action & 0b000100) actions.push(updateGamemode)
|
if (packet.action & 0b000100) actions.push(updateGamemode)
|
||||||
|
@ -16,16 +15,17 @@ function player_list (bot, options, config) {
|
||||||
action(entry)
|
action(entry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
bot.on('packet.player_remove', async ({players}) => { // players has uuids of the players
|
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
|
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 => {
|
bot.players.forEach(async player => {
|
||||||
if(!players.includes(player.uuid)) return
|
if(!players.includes(player.uuid)) return
|
||||||
|
|
||||||
const a = player_completion.filter(_ => _.match == player.profile.name)
|
const a = player_completion.filter(_ => _.match == player.profile.name)
|
||||||
|
const b = op.filter(_ => _.match == player.profile.name);
|
||||||
|
//console.log(b)
|
||||||
if(a.length >= 1) {
|
if(a.length >= 1) {
|
||||||
player.vanished = true
|
player.vanished = true
|
||||||
} else {
|
} else {
|
||||||
|
@ -39,7 +39,7 @@ function player_list (bot, options, config) {
|
||||||
bot.players.push({
|
bot.players.push({
|
||||||
uuid: entry.uuid,
|
uuid: entry.uuid,
|
||||||
profile: { name: entry.player.name, properties: entry.player.properties },
|
profile: { name: entry.player.name, properties: entry.player.properties },
|
||||||
|
// opped: false,
|
||||||
chatSession: undefined,
|
chatSession: undefined,
|
||||||
gamemode: undefined,
|
gamemode: undefined,
|
||||||
listed: undefined,
|
listed: undefined,
|
||||||
|
@ -50,7 +50,7 @@ function player_list (bot, options, config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function initializeChat (entry) {
|
function initializeChat (entry) {
|
||||||
// TODO: Handle chat sessions
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateGamemode (entry) {
|
function updateGamemode (entry) {
|
||||||
|
@ -67,6 +67,21 @@ function player_list (bot, options, config) {
|
||||||
target.listed = entry.listed
|
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) {
|
function updateLatency (entry) {
|
||||||
const target = bot.players.find(_entry => _entry.uuid === entry.uuid)
|
const target = bot.players.find(_entry => _entry.uuid === entry.uuid)
|
||||||
if (!target) return
|
if (!target) return
|
||||||
|
|
|
@ -21,6 +21,7 @@ function selfcare (bot, options, config) {
|
||||||
else if (stringMessage === "Successful login!") login = false;
|
else if (stringMessage === "Successful login!") login = false;
|
||||||
else if (stringMessage === "You're already logged in!") 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 === "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 === "Successfully registered!") register = false;
|
||||||
// else if (stringMessage === "You already have registered this username!") register = false;
|
// else if (stringMessage === "You already have registered this username!") register = false;
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
const crypto = require("crypto");
|
const crypto = require('crypto')
|
||||||
function validation (bot, options, config, discordClient) {
|
function validation (bot, options, config) {
|
||||||
let hashRegenInterval = setInterval(() => {
|
setInterval(() => {
|
||||||
bot.validation = {
|
bot.validation = {
|
||||||
trusted: crypto.createHash('sha256').update(Math.floor(Date.now() / 5000) + config.keys.trusted).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() / 5000) + config.keys.admin).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() / 5000) + config.keys.owner).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
|
||||||
|
|
Loading…
Reference in a new issue