forked from afspiegeling/NitoriBot
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e50641297 | ||
|
|
3a5b5bdbbc | ||
|
|
122e8e7df0 | ||
|
|
23288717ab |
Generated
+2
-3
@@ -3,9 +3,8 @@
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"buildstring": {
|
||||
"version": "v6.1.3",
|
||||
"build": "1210",
|
||||
"releaseDate": "12/06/24",
|
||||
"version": "v6.1.5",
|
||||
"build": "1225",
|
||||
"codename": "",
|
||||
"url": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot"
|
||||
},
|
||||
|
||||
@@ -69,7 +69,6 @@ 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":
|
||||
|
||||
@@ -13,10 +13,11 @@ module.exports = {
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
process.kill(process.pid);
|
||||
process.exit(1);
|
||||
},
|
||||
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
process.kill(process.pid);
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,13 +20,17 @@ module.exports = {
|
||||
const discordClient = context.discordClient;
|
||||
const args = context.arguments;
|
||||
const script = args.slice(1).join(' ');
|
||||
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
|
||||
try {
|
||||
if (source.sources.console) {
|
||||
bot.console.log(bot.getMessageAsPrismarine({ text: util.inspect(eval(args.join(' ')), { stylize })})?.toAnsi())
|
||||
} else if (bot.options.useChat || bot.options.isSavage) {
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })?.toMotd().replaceAll('§','&'))
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source.player.profile.name}"]`, [
|
||||
bot.tellraw(`@a[name="${source.player.profile.name}"]`, new MessageBuilder()
|
||||
.setText(util.inspect(eval(script), { stylize }).substring(0, 32700))
|
||||
)
|
||||
/* bot.tellraw(`@a[name="${source.player.profile.name}"]`, [
|
||||
{
|
||||
text: util.inspect(eval(script), { stylize }).substring(0, 32700),
|
||||
hoverEvent: {
|
||||
@@ -41,7 +45,7 @@ module.exports = {
|
||||
value: `${script}`
|
||||
}
|
||||
}
|
||||
]);
|
||||
]);*/
|
||||
}
|
||||
} catch (e) {
|
||||
throw new CommandError(e.toString())
|
||||
|
||||
@@ -348,7 +348,7 @@ module.exports = {
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
|
||||
}, 400)
|
||||
setTimexout(() => {
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
|
||||
}, 400)
|
||||
setTimeout(() => {
|
||||
|
||||
+27
-15
@@ -311,45 +311,57 @@ module.exports = {
|
||||
break;
|
||||
case "version":
|
||||
case "ver":
|
||||
if (botInfo.codename === '') {
|
||||
|
||||
if (botInfo.buildstring.codename.length > 0) {
|
||||
component.push({
|
||||
translate: "%s %s %s-%s-%s%s-%s\n%s - %s",
|
||||
translate: "%s %s %s-%s-%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s-%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Friday Night Funkin", color: "dark_blue" },
|
||||
{ text: "Boyfriend", color: "dark_aqua" },
|
||||
{ text: "Bot", color: "blue" },
|
||||
{ text: `${botInfo.buildstring.version}`, color: config.colors.integer },
|
||||
{ text: "#" },
|
||||
botInfo.buildstring.codename,
|
||||
{ text: "Build", color: config.colors.commands.primary },
|
||||
{ text: `${botInfo.buildstring.build}`, color: config.colors.integer },
|
||||
{ text: `${botInfo.buildstring.releaseDate}`, color: config.colors.commands.secondary },
|
||||
{ text: "11/22/22", color: config.colors.commands.primary },
|
||||
{ text: `${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`, color: config.colors.commands.secondary },
|
||||
{ text: "Repo Build", color: config.colors.commands.primary },
|
||||
{ text: `${execSync('git rev-list --count --all').toString().replaceAll('\n','')}`, color: config.colors.integer },
|
||||
{ text: "Version Release Date", color: config.colors.commands.primary },
|
||||
{ text: `${new Date(execSync('git log -1 --format=%ci').toString()).toLocaleString("en-US", {timeZone: "America/CHICAGO"})}`, color: config.colors.commands.secondary },
|
||||
{ text: "Commit", color: config.colors.commands.primary },
|
||||
{ text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`, color: config.colors.commands.secondary },
|
||||
{ text: `${new Date().toLocaleDateString("en-US",{timeZone:"America/CHICAGO"})}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
});
|
||||
} else {
|
||||
component.push({
|
||||
translate: "%s %s %s-%s-%s%s-%s-%s\n%s - %s",
|
||||
translate: "%s %s %s-%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s-%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Friday Night Funkin", color: "dark_blue" },
|
||||
{ text: "Boyfriend", color: "dark_aqua" },
|
||||
{ text: "Bot", color: "blue" },
|
||||
{ text: `${botInfo.buildstring.version}`, color: config.colors.integer },
|
||||
{ text: "#" },
|
||||
{ text: "Build", color: config.colors.commands.primary },
|
||||
{ text: `${botInfo.buildstring.build}`, color: config.colors.integer },
|
||||
{ text: `${botInfo.buildstring.releaseDate}`, color: config.colors.commands.secondary },
|
||||
{ text: `${botInfo.buildstring.codename}` },
|
||||
{ text: "Repo Build", color: config.colors.commands.primary },
|
||||
{ text: `${execSync('git rev-list --count --all').toString().replaceAll('\n','')}`, color: config.colors.integer },
|
||||
{ text: "Version Release Date", color: config.colors.commands.primary },
|
||||
{ text: `${new Date(execSync('git log -1 --format=%ci').toString()).toLocaleString("en-US", {timeZone: "America/CHICAGO"})}`, color: config.colors.commands.secondary },
|
||||
{ text: "Commit", color: config.colors.commands.primary },
|
||||
{ text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`, color: config.colors.commands.secondary },
|
||||
{ text: "11/22/22", color: config.colors.commands.primary },
|
||||
{ text: `${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`, color: config.colors.commands.secondary },
|
||||
{ text: `${new Date().toLocaleDateString("en-US",{timeZone:"America/CHICAGO"})}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
})
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
|
||||
}
|
||||
bot.tellraw(`@a[name="${source.player.profile.name}"]`, component);
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(component)?.toMotd().replaceAll('§','&'));
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source.player.profile.name}"]`, component);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -44,49 +44,15 @@ module.exports = {
|
||||
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',
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
contents: [{
|
||||
text: 'click here for the servers ip',
|
||||
color: 'gray'
|
||||
}]
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'copy_to_clipboard',
|
||||
value: `${host}:${Number(port ?? 25565)}`
|
||||
}
|
||||
},
|
||||
{
|
||||
text: `Players \u203a `,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `${server.players.online}`,
|
||||
color: "gold"
|
||||
},
|
||||
{
|
||||
text: ' / ',
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `${server.players.max}\n`,
|
||||
color: "gold"
|
||||
},
|
||||
{
|
||||
text: `Version \u203a ${server.version.name}\n`,
|
||||
color: 'gray',
|
||||
},
|
||||
{
|
||||
text: "Motd \u203a\n",
|
||||
color: 'gray',
|
||||
},
|
||||
server.description,
|
||||
])*/
|
||||
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(`Ip \u203a ${host}:${Number(port ?? 25565)}`);
|
||||
bot.chat.message(`Players \u203a ${server.players.online} / ${server.players.max}`);
|
||||
bot.chat.message(`Version \u203a ${server.version.name}`);
|
||||
bot.chat.message(bot.getMessageAsPrismarine(server.description)?.toMotd().replaceAll('§','&'));
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component);
|
||||
}
|
||||
} catch (e) {
|
||||
bot.chat.message(`${e.toString()}`)
|
||||
}
|
||||
|
||||
@@ -39,20 +39,14 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
bot.bots.filter((eachBot) => {
|
||||
if (eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom || eachBot.options.isCreayun && !eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom) {
|
||||
eachBot.chat.message(`[${bot.options.serverName}] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} \u203a ${args.join(' ')}`)
|
||||
} else if (!eachBot.options.serverName !== "Savage Friends" && !eachBot.options.isSavage && !eachBot.options.useChat && eachBot.options.isKaboom) {
|
||||
eachBot.tellraw("@a", component);
|
||||
} else if (!eachBot.options.serverName !== "Savage Friends" && !eachBot.options.isSavage && eachBot.options.useChat && eachBot.options.isKaboom) {
|
||||
eachBot.chat.message(`&7[&7${bot.options.serverName}&7] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} &7\u203a ${args.join(' ')}`)
|
||||
} else if (eachBot.options.useChat && !eachBot.options.isSavage) {
|
||||
// eachBot.chat.message(bot.getMessageAsPrismarine(`[${bot.options.host}:${bot.options.port}] ${source.player.displayName ?? source.player.profile.name} \u203a ${args.join(' ')}`)?.toMotd().replaceAll('§','&'))
|
||||
eachBot.chat.message(`&7[&7${bot.options.serverName}&7] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} &7\u203a ${args.join(' ')}`)
|
||||
} else if (!eachBot.options.useChat && !eachBot.options.isSavage) {
|
||||
if (!eachBot.options.isKaboom || eachBot.options.useChat) {
|
||||
eachBot.chat.message(`${bot.getMessageAsPrismarine(component)?.toMotd().replaceAll('§','&')}`);
|
||||
} else if (eachBot.options.isKaboom && !eachBot.options.useChat) {
|
||||
eachBot.tellraw("@a", component);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
@@ -80,15 +74,9 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
bot.bots.filter((eachBot) => {
|
||||
if (eachBot.options.serverName === "Savage Friends" && eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom) {
|
||||
eachBot.chat.message(`[${bot.options.serverName}] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} \u203a ${args.join(' ')}`)
|
||||
} else if (!eachBot.options.serverName !== "Savage Friends" && !eachBot.options.isSavage && !eachBot.options.useChat && eachBot.options.isKaboom) {
|
||||
eachBot.tellraw("@a", component);
|
||||
} else if (!eachBot.options.serverName !== "Savage Friends" && !eachBot.options.isSavage && eachBot.options.useChat && eachBot.options.isKaboom) {
|
||||
eachBot.chat.message(`&7[&7${bot.options.serverName}&7] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} &7\u203a ${args.join(' ')}`)
|
||||
} else if (eachBot.options.useChat && !eachBot.options.isSavage) {
|
||||
eachBot.chat.message(`&7[&7${bot.options.serverName}&7] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} &7\u203a ${args.join(' ')}`)
|
||||
} else if (!eachBot.options.useChat && !eachBot.options.isSavage) {
|
||||
if (!eachBot.options.isKaboom || eachBot.options.useChat) {
|
||||
eachBot.chat.message(`${bot.getMessageAsPrismarine(component)?.toMotd().replaceAll('§','&')}`);
|
||||
} else if (eachBot.options.isKaboom && !eachBot.options.useChat) {
|
||||
eachBot.tellraw("@a", component);
|
||||
}
|
||||
})
|
||||
|
||||
+138
-35
@@ -16,43 +16,146 @@ module.exports = {
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
|
||||
try {
|
||||
let component = [];
|
||||
const weather = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ')?.replaceAll(' ', ',')}`);
|
||||
let component;
|
||||
const weather = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ').replaceAll(' ','&')}`);
|
||||
const info = await weather.body.json();
|
||||
component.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.commands.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)
|
||||
component = new MessageBuilder()
|
||||
.setTranslate("%s\n%s\n%s: %s (%s)\n%s\n%s\n%s: %s\n%s: %s")
|
||||
.setColor(config.colors.commands.tertiary)
|
||||
.addWith(new MessageBuilder()
|
||||
.setTranslate("%s: %s, %s %s")
|
||||
.setColor(config.colors.commands.tertiary)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.primary)
|
||||
.setText("Location")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText(info.location.name)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText(info.location.region)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText(info.location.country)
|
||||
)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setTranslate("%s: %s, %s")
|
||||
.setColor(config.colors.commands.tertiary)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.primary)
|
||||
.setText("Coords")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.integer)
|
||||
.setText(`${info.location.lat}`)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.integer)
|
||||
.setText(`${info.location.lon}`)
|
||||
)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.primary)
|
||||
.setText("Time")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText(`${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id, })}`)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText(`${info.location.tz_id}`)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setTranslate("%s: %s (%s), %s (%s)")
|
||||
.setColor(config.colors.commands.tertiary)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.primary)
|
||||
.setText("Temp")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.integer)
|
||||
.setText(`${Math.floor(info.current.temp_c)}`)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText("\u00b0C")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.integer)
|
||||
.setText(`${Math.floor(info.current.temp_f)}`)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText("\u00b0F")
|
||||
)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setTranslate("%s: %s (%s, %s), %s (%s, %s)")
|
||||
.setColor(config.colors.commands.tertiary)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.primary)
|
||||
.setText("Wind Speed")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.integer)
|
||||
.setText(`${Math.floor(info.current.wind_kph)}`)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText("kph")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText(info.current.wind_dir)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.integer)
|
||||
.setText(`${Math.floor(info.current.wind_mph)}`)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText("mph")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText(info.current.wind_dir)
|
||||
)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.primary)
|
||||
.setText("Condition")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText(info.current.condition.text)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.primary)
|
||||
.setText("Humidity")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.integer)
|
||||
.setText(`${Math.floor(info.current.humidity)}`)
|
||||
)
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(`Location: ${info.location.name}, ${info.location.region}, ${info.location.country}`);
|
||||
bot.chat.message(`Latitude: ${info.location.lat}`);
|
||||
bot.chat.message(`Longitude: ${info.location.lon}`);
|
||||
bot.chat.message(`Time: ${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id, })}(${info.location.tz_id})`);
|
||||
bot.chat.message(`Temp: ${info.current.temp_c}(\u00b0C), ${info.current.temp_f}(\u00b0F)`);
|
||||
bot.chat.message(`Wind speed: ${info.current.wind_kph}(KPH), ${info.current.wind_mph}(MPH)`);
|
||||
bot.chat.message(`Condition: ${info.current.condition.text}`);
|
||||
bot.chat.message(`Humidity: ${info.current.humidity}`);
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
} catch (e) {
|
||||
if (e.toString() === "TypeError: Cannot read properties of undefined (reading 'name')" && args.length !== 0) {
|
||||
bot.chat.message('The location is invalid please try a valid location');
|
||||
|
||||
@@ -17,13 +17,20 @@ module.exports = {
|
||||
const source = context.source;
|
||||
const args = context.arguments;
|
||||
const bot = context.bot;
|
||||
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
|
||||
try {
|
||||
const page = await wiki.page(args.join(' '))
|
||||
const summary = await page.intro();
|
||||
bot.tellraw(`@a`, { text: `${summary}`, color: 'gray' });
|
||||
bot.tellraw("@a", new MessageBuilder()
|
||||
.setText(summary)
|
||||
.setColor("gray")
|
||||
)
|
||||
} catch (error) {
|
||||
if (error.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')") {
|
||||
bot.tellraw(`@a`, { text: 'Article not found!', color: 'dark_red' })
|
||||
bot.tellraw("@a", new MessageBuilder()
|
||||
.setText("Article not found!")
|
||||
.setColor("red")
|
||||
)
|
||||
} else {
|
||||
bot.tellraw(`@a`, `${error.toString()}`)
|
||||
}
|
||||
|
||||
@@ -78,6 +78,11 @@ colors:
|
||||
console:
|
||||
prefix: "c."
|
||||
|
||||
logsFolder:
|
||||
path: "../../"
|
||||
# this is being loaded from the log folder so make sure it starts with ../../
|
||||
name: "logs"
|
||||
|
||||
bots:
|
||||
- host: "localhost"
|
||||
username: "FNFBoyfriendBot"
|
||||
|
||||
+11
-10
@@ -1,28 +1,29 @@
|
||||
const createBot = require('./bot.js');
|
||||
const readline = require('readline');
|
||||
const loadModules = require('./util/loadModules');
|
||||
const js_yaml = require('js-yaml');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const checks = require('./util/checks');
|
||||
const { Client, GatewayIntentBits } = require('discord.js');
|
||||
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits;
|
||||
const discordClient = new Client({ intents: [Guilds, GuildMessages, MessageContent] });
|
||||
|
||||
console.log('Starting FNFBoyfriendBot');
|
||||
process.stdout.write('\x1b]2;Starting FNFBoyfriendBot please wait,.....\x1b\x5c');
|
||||
|
||||
if (!fs.existsSync(path.join(__dirname, "../config.yml"))) {
|
||||
console.warn("Config not found creating config from the default config");
|
||||
fs.copyFileSync(
|
||||
path.join(__dirname, "./data/default_config.yml"),
|
||||
path.join(__dirname, "../config.yml")
|
||||
)
|
||||
}
|
||||
|
||||
try {
|
||||
config = js_yaml.load(fs.readFileSync(path.join(__dirname, '../', 'config.yml')))
|
||||
config = require('js-yaml').load(fs.readFileSync(path.join(__dirname, '../', 'config.yml')))
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
|
||||
checks(config);
|
||||
|
||||
/*if (config.core.method !== 'item' && config.core.method !== 'chat') {
|
||||
config.core.method = 'item';
|
||||
console.warn('invalid core method type defaulting to item');
|
||||
}*/
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
@@ -34,6 +35,6 @@ for (const options of config.bots) {
|
||||
const bot = new createBot(options, config);
|
||||
bots.push(bot);
|
||||
bot.bots = bots;
|
||||
loadModules(bot, options, config, discordClient);
|
||||
require('./util/loadModules')(bot, options, config, discordClient);
|
||||
bot.console.readlineInterface(rl);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
function boot (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
|
||||
+6
-3
@@ -89,9 +89,11 @@ function chat (context) {
|
||||
return
|
||||
}
|
||||
|
||||
bot.emit('systemChat', message)
|
||||
if (message.translate === "advMode.notAllowed") return;
|
||||
|
||||
tryParsingMessage(message, { players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
|
||||
bot.emit('systemChat', message);
|
||||
|
||||
tryParsingMessage(message, { players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine });
|
||||
})
|
||||
|
||||
bot.on('packet.action_bar', (message) => {
|
||||
@@ -165,8 +167,9 @@ function chat (context) {
|
||||
acknowledged: Buffer.alloc(3),
|
||||
previousMessages: []
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
bot.tellraw = (selector, message) => {
|
||||
bot.core.run(`minecraft:tellraw ${selector} ` + JSON.stringify(message))
|
||||
}
|
||||
|
||||
@@ -49,11 +49,7 @@ function core (context) {
|
||||
bot.chat.command('spawn');
|
||||
return
|
||||
}
|
||||
/*^^^
|
||||
for checking is the core pos is null and if so
|
||||
it will not refill core until the pos is not NaN
|
||||
instead of tping to a set cords cuz fuck you im not doing that
|
||||
*/
|
||||
|
||||
const command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'} destroy`
|
||||
|
||||
bot._client.write('set_creative_slot', {
|
||||
@@ -153,7 +149,7 @@ function core (context) {
|
||||
const itemPosition = bot.core.itemPosition;
|
||||
|
||||
if (!location) return;
|
||||
if (bot.options.isSavage || bot.options.isCreayun || bot.options.useChat) {
|
||||
if (bot.options.isCreayun || bot.options.useChat || bot.options.isSavage) {
|
||||
return
|
||||
} else {
|
||||
if (bot.core.usePlacedCommandBlock) {
|
||||
@@ -185,13 +181,7 @@ function core (context) {
|
||||
})
|
||||
|
||||
bot.on('packet.block_change', (data) => {
|
||||
// console.log('data pos ' + JSON.stringify(data.location))
|
||||
// console.log('core pos ' +JSON.stringify(bot.core.position));
|
||||
// if (data.type === 0) {
|
||||
// console.log('data pos ' + JSON.stringify(data.location));
|
||||
// console.log('core position ' + JSON.stringify(bot.core.position));
|
||||
// bot.core.refill();
|
||||
//}
|
||||
|
||||
})
|
||||
}
|
||||
module.exports = core;
|
||||
|
||||
@@ -4,6 +4,7 @@ module.exports = (context) => {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
|
||||
bot.on("parsed_message", (data) => {
|
||||
if (data.type !== "minecraft:chat") return;
|
||||
const prefixes = config.prefixes;
|
||||
@@ -16,8 +17,9 @@ module.exports = (context) => {
|
||||
setTimeout(() => {
|
||||
ratelimit--
|
||||
}, 1000)
|
||||
if (ratelimit > 2) {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'You are using commands too fast!', color: 'dark_red'})
|
||||
if (ratelimit > 2) { // new e.MessageBuilder().setText("e").toJSON()
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, new MessageBuilder().setText("You are using commands too fast!").setColor("dark_red").toJSON())
|
||||
// bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'You are using commands too fast!', color: 'dark_red'})
|
||||
} else if (command.split(" ")[0].length === 0) {
|
||||
} else {
|
||||
bot.commandManager.executeString(source, command)
|
||||
@@ -9,6 +9,7 @@ async function command_manager (context) {
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const options = context.options;
|
||||
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
|
||||
bot.commandManager = {
|
||||
commands: {},
|
||||
commandlist: [],
|
||||
@@ -25,16 +26,33 @@ async function command_manager (context) {
|
||||
}
|
||||
} else if (!source?.sources?.discord && !source?.sources?.console) {
|
||||
if (!command || !command.execute)
|
||||
bot.tellraw("@a", {
|
||||
translate: "%s%s%s %s",
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ translate: "command.unknown.command", color: "red" },
|
||||
{ text: "\n" },
|
||||
{ text: `${commandName}` },
|
||||
{ translate: "command.context.here", color: "red" }
|
||||
]
|
||||
})
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(bot.getMessageAsPrismarine({
|
||||
translate: "%s",
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ translate: "command.unknown.command", color: "red" },
|
||||
]
|
||||
})?.toMotd().replaceAll('§','&'));
|
||||
|
||||
bot.chat.message(bot.getMessageAsPrismarine({
|
||||
translate: "%s %s",
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: `${commandName}` },
|
||||
{ translate: "command.context.here", color: "red" }
|
||||
]
|
||||
})?.toMotd().replaceAll('§','&'));
|
||||
} else {
|
||||
bot.tellraw("@a", new MessageBuilder()
|
||||
.setTranslate("%s%s%s %s")
|
||||
.setColor("dark_gray")
|
||||
.addWith(new MessageBuilder().setTranslate("command.unknown.command").setColor("red"))
|
||||
.addWith(new MessageBuilder().setText("\n"))
|
||||
.addWith(new MessageBuilder().setText(`${commandName}`))
|
||||
.addWith(new MessageBuilder().setTranslate("command.context.here").setColor("red"))
|
||||
)
|
||||
}
|
||||
} else if (source?.sources?.console && !source?.sources?.discord) {
|
||||
if (!command || !command.execute)
|
||||
bot.console.warn(bot.getMessageAsPrismarine({
|
||||
@@ -89,11 +107,11 @@ async function command_manager (context) {
|
||||
break;
|
||||
}
|
||||
if (!command?.discordExecute && command && source?.sources?.discord) {
|
||||
throw new CommandError(`${command.name} command is not supported in discord!`)
|
||||
throw new CommandError(`${command.data.name} command is not supported in discord!`)
|
||||
} else if (command?.discordExecute && command && source?.sources?.discord) {
|
||||
return command.discordExecute({ bot, source, arguments: args, config, discordClient })
|
||||
} else if (!command?.execute && command && !source?.sources?.discord) {
|
||||
throw new CommandError(`${command.name} command is not supported in game!`)
|
||||
throw new CommandError(`${command.data.name} command is not supported in game!`)
|
||||
} else if (command?.execute && command && !source?.sources?.discord) {
|
||||
return command?.execute({ bot, source, arguments: args, config, discordClient });
|
||||
}
|
||||
|
||||
@@ -22,8 +22,6 @@ function discord (context) {
|
||||
channel: undefined,
|
||||
invite: config.discord.invite || undefined,
|
||||
prefix: config.discord.prefix,
|
||||
// presence: bot.discord.presence,
|
||||
// token: config.discord.token,
|
||||
}
|
||||
discordClient.once('ready', (context) => {
|
||||
bot.discord.channel = discordClient.channels.cache.get(options.channelId)
|
||||
@@ -72,9 +70,6 @@ function discord (context) {
|
||||
bot.on('playerChat', (message) => {
|
||||
sendComponent(message);
|
||||
})
|
||||
/* bot.on('message', message => {
|
||||
sendComponent(message)
|
||||
})*/
|
||||
|
||||
function messageCreate(message, source) {
|
||||
bot.discord.message = message;
|
||||
|
||||
@@ -11,15 +11,13 @@ function fileLogger(context) {
|
||||
const timestamp = `${currentDate.getFullYear()}-${(currentDate.getMonth() + 1)
|
||||
.toString()
|
||||
.padStart(2, "0")}-${currentDate.getDate().toString().padStart(2, "0")}`;
|
||||
const logFolder = path.join(__dirname, "../../logs");
|
||||
const logFolder = path.join(__dirname, `${config.logsFolder.path}`, `${config.logsFolder.name}`);
|
||||
const logFileName = "latest.log";
|
||||
const logFilePath = path.join(logFolder, logFileName);
|
||||
const logStream = fs.createWriteStream(logFilePath, { flags: "a" });
|
||||
if (!fs.existsSync(path.join(__dirname, "../../logs"))) {
|
||||
fs.mkdirSync(path.join(__dirname, "../../logs"))
|
||||
}
|
||||
try {
|
||||
if (!fs.existsSync(logFolder)) {
|
||||
console.info(`logs folder not found recreating it at ${config.logsFolder.path}${config.logsFolder.name}`);
|
||||
fs.mkdirSync(logFolder);
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -27,7 +25,6 @@ function fileLogger(context) {
|
||||
}
|
||||
|
||||
function compressFile(input, output) {
|
||||
// if (!bot.Console.filelogging) return
|
||||
const plainOutput = output.slice(0, -3);
|
||||
|
||||
fs.renameSync(input, plainOutput);
|
||||
|
||||
+59
-20
@@ -2,32 +2,71 @@ const os = require('os');
|
||||
module.exports = (context) => {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
|
||||
let timer;
|
||||
bot.memUsage = {
|
||||
enabled: false
|
||||
}
|
||||
|
||||
timer = setInterval(() => {
|
||||
component = {
|
||||
translate: "%s%s%s %s | %s: %s%s / %s%s | %s: %s%s / %s%s |",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "FNF", color: "dark_blue" },
|
||||
{ text: "Boyfriend", color: "dark_aqua" },
|
||||
{ text: "Bot", color: "blue" },
|
||||
{ text: "Memory Usage" },
|
||||
{ text: "Free Server Memory", color: config.colors.commands.primary },
|
||||
{ text: `${Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: "Bot Memory Usage", color: config.colors.commands.primary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576 )}`, color: config.colors.integer },
|
||||
{ text: "MiB", color: config.colors.commands.secondary }
|
||||
]
|
||||
}
|
||||
component = new MessageBuilder()
|
||||
.setTranslate("%s%s%s %s | %s: %s%s / %s%s | %s: %s%s / %s%s |")
|
||||
.setColor(config.colors.commands.tertiary)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor("dark_blue")
|
||||
.setText("FNF")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor("dark_aqua")
|
||||
.setText("Boyfriend")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor("blue")
|
||||
.setText("Bot")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setText("Memory Usage")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.primary)
|
||||
.setText("Free Server Memory")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.integer)
|
||||
.setText(`${Math.floor(os.freemem() / 1048576)}`)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText("MiB")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.integer)
|
||||
.setText(`${Math.floor(os.totalmem() / 1048576)}`)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText("MiB")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.primary)
|
||||
.setText("Bot Memory Usage")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.integer)
|
||||
.setText(`${Math.floor(process.memoryUsage().heapUsed / 1048576)}`)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText("MiB")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.integer)
|
||||
.setText(`${Math.floor(process.memoryUsage().heapTotal / 1048576 )}`)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText("MiB")
|
||||
)
|
||||
if (!bot.memUsage.enabled) return;
|
||||
bot.core.run(`minecraft:title @a[tag=!memusage] actionbar ${JSON.stringify(component)}`)
|
||||
}, 100)
|
||||
|
||||
@@ -40,6 +40,7 @@ function player_list (context) {
|
||||
bot.players = bot.players.filter(_entry => _entry.uuid !== entry.uuid)
|
||||
bot.players.push({
|
||||
uuid: entry.uuid,
|
||||
mcUUID: "",
|
||||
profile: { name: entry.player.name, properties: entry.player.properties },
|
||||
chatSession: undefined,
|
||||
gamemode: undefined,
|
||||
|
||||
@@ -5,11 +5,7 @@ function reconnect (context) {
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
bot.on('end', () => {
|
||||
//bot = undefined;
|
||||
|
||||
bot._client.removeAllListeners();
|
||||
//client = undefined;
|
||||
//bot._client = undefined;
|
||||
if (bot.reconnectDelay < 0) return
|
||||
setTimeout(() => {
|
||||
if (options.usernameGen) {
|
||||
|
||||
+1
-43
@@ -87,60 +87,18 @@ function selfcare (context) {
|
||||
}
|
||||
}, 1000)
|
||||
})
|
||||
/*
|
||||
bot.on("packet.teams", async (data) => {
|
||||
if (options.isSavage || options.isCreayun) return;
|
||||
try {
|
||||
// console.log(data);
|
||||
// bot.chat.command('minecraft:team add FNFBoyfriendBot');
|
||||
// if (data.team === "FNFBoyfriendBot") return;
|
||||
if (data.team === "FNFBoyfriendBot" && data.mode === 1) {
|
||||
bot.core.run("minecraft:team add FNFBoyfriendBot");
|
||||
}
|
||||
|
||||
for (const eachPlayer of data?.players) {
|
||||
if (eachPlayer !== bot.options.username) {
|
||||
bot.core.run("minecraft:team empty FNFBoyfriendBot");
|
||||
await sleep(100);
|
||||
bot.core.run("minecraft:team join FNFBoyfriendBot");
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack)
|
||||
}
|
||||
})*/
|
||||
/*
|
||||
{
|
||||
team: 'FNFBoyfriendBot',
|
||||
mode: 3,
|
||||
name: undefined,
|
||||
friendlyFire: undefined,
|
||||
nameTagVisibility: undefined,
|
||||
collisionRule: undefined,
|
||||
formatting: undefined,
|
||||
prefix: undefined,
|
||||
suffix: undefined,
|
||||
players: [ 'Parker2991' ]
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
let timer;
|
||||
bot.on('packet.login', async (packet) => {
|
||||
entityId = packet.entityId;
|
||||
gameMode = packet.gameMode;
|
||||
clientLock = packet.gameMode;
|
||||
/* if (bot.options.isKaboom) {
|
||||
bot.core.run('minecraft:team add FNFBoyfriendBot');
|
||||
await sleep(100);
|
||||
bot.core.run('minecraft:team join FNFBoyfriendBot');
|
||||
}*/
|
||||
timer = setInterval(() => {
|
||||
if (bot.options.isSavage && !bot.options.isKaboom && !bot.options.isCreayun) {
|
||||
if (login) bot.chat.command('login amogusissus');
|
||||
else if (register) bot.chat.command('register amogusissus amogusissus');
|
||||
// else if (permissionLevel < 2) bot.chat.command(`minecraft:op ${bot.options.username}`);
|
||||
else if (gameMode !== 1) bot.chat.command('minecraft:gamemode creative');
|
||||
else if (permissionLevel < 2) bot.chat.command(`minecraft:op ${bot.options.username}`);
|
||||
else if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 });
|
||||
} else if (bot.options.isCreayun && !bot.options.isKaboom && !bot.options.isSavage) {
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ module.exports = (context) => {
|
||||
if (options.isSavage || options.isCreayun) return;
|
||||
try {
|
||||
if (data.team === config.team.name) {
|
||||
// console.log(data);
|
||||
data?.players?.map(async (player) => {
|
||||
if (player !== bot.options.username) {
|
||||
await sleep(100);
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
module.exports = () => {
|
||||
if (!fs.existsSync(path.join(__dirname, "../../config.yml"))) {
|
||||
console.warn("Config not found creating config from the default config");
|
||||
fs.copyFileSync(
|
||||
path.join(__dirname, "../data/default_config.yml"),
|
||||
path.join(__dirname, "../../config.yml")
|
||||
)
|
||||
}
|
||||
|
||||
/* if (!fs.existsSync(path.join(__dirname, "../data/filter.json"))) {
|
||||
console.warn("filter json not found creating the file,......");
|
||||
let data = [{ ignoreCase: false, regexed: false, name: 'whatever player username idfk' }]
|
||||
fs.writeFileSync(path.join(__dirname, "../data/filter.json"), JSON.stringify(data))
|
||||
}*/
|
||||
|
||||
/*
|
||||
if (!fs.existsSync(path.join(__dirname, "../data/trustedPlayers.json"))) {
|
||||
console.warn("Trusted Players json not found creating the file,......");
|
||||
let data = [{player: ""}]
|
||||
fs.writeFileSync(path.join(__dirname, "../data/trustedPlayers.json"), JSON.stringify(data))
|
||||
}*/
|
||||
}
|
||||
Reference in New Issue
Block a user