v7.0.0, build: 2050

This commit is contained in:
Parker2991
2025-02-05 10:11:22 -06:00
parent 59ab5966c4
commit 7eadb4eccd
7 changed files with 251 additions and 183 deletions
+7 -1
View File
@@ -15,4 +15,10 @@ module.exports = {
bot._client.end();
bot.chat.message('reconnecting')
},
}
discordExecute (context) {
const bot = context.bot;
bot._client.end();
bot?.discord?.message?.reply('reconnecting');
}
}
+93 -122
View File
@@ -1,3 +1,74 @@
function commandListComponent (commands, config, public, trusted, admin, owner, Console) {
switch (commands.data.trustLevel) {
case 0:
public.push({
text: commands.data.name + ' ',
color: config.colors.help.public
});
break;
case 1:
trusted.push({
text: commands.data.name + ' ',
color: config.colors.help.trusted
});
break;
case 2:
admin.push({
text: commands.data.name + ' ',
color: config.colors.help.admin
});
break;
case 3:
owner.push({
text: commands.data.name + ' ',
color: config.colors.help.owner
});
break;
case 4:
Console.push({
text: commands.data.name + ' ',
color: config.colors.help.console
});
break;
default:
bot.chat.message(`fuck you ${commands.data.name} has a invalid trust level`);
};
}
function infoComponents (commands, config, infoComponent, usagesComponent) {
for (const usages of commands.data.usages) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: `${usages}`, color: config.colors.commands.secondary },
]
});
usagesComponent.push('\n');
};
infoComponent.push({
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s:\n",
color: config.colors.commands.tertiary,
with: [
{ text: "Name", color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: "Aliases", color: config.colors.commands.primary },
{ text: `${commands.data.aliases.toString().replaceAll(',',' ')}`, color: config.colors.commands.secondary },
{ text: "Description", color: config.colors.commands.primary },
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
{ text: "Trust Level", color: config.colors.commands.primary },
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
{ text: "Usages", color: config.colors.commands.primary },
]
});
infoComponent.push(usagesComponent);
}
module.exports = {
data: {
name: "help",
@@ -26,7 +97,7 @@ module.exports = {
let admin = [];
let owner = [];
let Console = [];
const { MessageBuilder } = require('prismarine-chat')(bot._client.version);
component.push({
translate: "%s: (%s) \u203a\n",
color: config.colors.commands.tertiary,
@@ -36,72 +107,12 @@ module.exports = {
]
});
for (const commands of bot.commandManager.commandlist) {
switch (commands.data.trustLevel) {
case 0:
public.push({
text: commands.data.name + ' ',
color: config.colors.help.public
});
break;
case 1:
trusted.push({
text: commands.data.name + ' ',
color: config.colors.help.trusted
});
break;
case 2:
admin.push({
text: commands.data.name + ' ',
color: config.colors.help.admin
});
break;
case 3:
owner.push({
text: commands.data.name + ' ',
color: config.colors.help.owner
});
break;
case 4:
Console.push({
text: commands.data.name + ' ',
color: config.colors.help.console
});
break;
default:
bot.chat.message(`fuck you ${commands.data.name} has a invalid trust level`);
};
commandListComponent(commands, config, public, trusted, admin, owner, Console);
if (args[0] === commands.data.name) {
for (const usages of commands.data.usages) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: `${usages}`, color: config.colors.commands.secondary },
]
})
usagesComponent.push('\n');
}
infoComponent.push({
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s:\n",
color: config.colors.commands.tertiary,
with: [
{ text: "Name", color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: "Aliases", color: config.colors.commands.primary },
{ text: `${commands.data.aliases.toString().replaceAll(',',' ')}`, color: config.colors.commands.secondary },
{ text: "Description", color: config.colors.commands.primary },
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
{ text: "Trust Level", color: config.colors.commands.primary },
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
{ text: "Usages", color: config.colors.commands.primary },
]
});
infoComponent.push(usagesComponent);
infoComponents(commands, config, infoComponent, usagesComponent);
bot.tellraw(`@a`, infoComponent);
return;
}
}
@@ -115,7 +126,6 @@ module.exports = {
discordExecute (context) {
const bot = context.bot;
const config = context.config;
const EmbedBuilder = context.EmbedBuilder
const fixansi = context.fixansi;
const args = context.arguments;
let infoComponent = [];
@@ -125,72 +135,33 @@ module.exports = {
let admin = [];
let owner = [];
let Console = [];
let component = [];
component.push({
translate: "%s: (%s) \u203a\n",
color: config.colors.commands.tertiary,
with: [
{ text: "Commands", color: config.colors.commands.secondary },
{ text: `${bot.commandManager.commandlist.length}`, color: config.colors.integer },
]
});
for (const commands of bot.commandManager.commandlist) {
switch (commands.data.trustLevel) {
case 0:
public.push(commands.data.name);
break;
case 1:
trusted.push(commands.data.name);
break;
case 2:
admin.push(commands.data.name);
break;
case 3:
owner.push(commands.data.name);
break;
case 4:
Console.push(commands.data.name);
break;
}
if (args[0] === commands.data.name) {
for (const usages of commands.data.usages) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: `${usages}`, color: config.colors.commands.secondary },
]
})
usagesComponent.push('\n');
}
commandListComponent(commands, config, public, trusted, admin, owner, Console);
infoComponent.push({
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s:\n",
color: config.colors.commands.tertiary,
with: [
{ text: "Name", color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: "Aliases", color: config.colors.commands.primary },
{ text: `${commands.data.aliases.toString().replaceAll(',',' ')}`, color: config.colors.commands.secondary },
{ text: "Description", color: config.colors.commands.primary },
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
{ text: "Trust Level", color: config.colors.commands.primary },
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
{ text: "Usages", color: config.colors.commands.primary },
]
});
infoComponent.push(usagesComponent);
if (args[0] === commands.data.name) {
infoComponents(commands, config, infoComponent, usagesComponent);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(infoComponent)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
return;
}
}
let commandsEmbed = new EmbedBuilder()
.setColor(config.colors.discord.embed)
.setTitle(`${this.data.name} Command`)
.setDescription(`Commands (${bot.commandManager.commandlist.length})`)
.addFields(
{ name: "Public", value: public.toString().replaceAll(',',' '), inline: false },
{ name: "Trusted", value: trusted.toString().replaceAll(',',' '), inline: false },
{ name: "Admin", value: admin.toString().replaceAll(',',' '), inline: false },
{ name: "Owner", value: owner.toString().replaceAll(',',' '), inline: false },
{ name: "Console", value: Console.toString().replaceAll(',',' '), inline: false },
);
bot.discord.message.reply({ embeds: [ commandsEmbed ] });
component.push(public);
component.push(trusted);
component.push(admin);
component.push(owner);
component.push(Console);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
}
}
+38 -1
View File
@@ -16,7 +16,7 @@ module.exports = {
execute (context) {
const bot = context.bot;
const args = context.arguments;
const confix = context.config;
const config = context.config;
let component = [];
let infoComponent = [];
@@ -48,5 +48,42 @@ module.exports = {
}
component.pop();
bot.tellraw("@a", component);
},
discordExecute (context) {
const bot = context.bot;
const config = context.config;
const fixansi = context.fixansi;
let component = [];
let playerCount = [];
playerCount.push({
translate: "%s: (%s)\n",
color: config.colors.commands.tertiary,
with: [
{ text: "Players", color: config.colors.commands.primary },
{ text: `${bot.players.length}`, color: config.colors.integer },
]
});
component.push(playerCount);
for (const player of bot.players) {
component.push({
translate: "%s \u203a %s [%s: %s]",
color: config.colors.commands.tertiary,
with: [
player.displayName ?? player.profile.name,
{ text: `${player.uuid}`, color: config.colors.commands.primary },
{ text: "Latency", color: config.colors.commands.primary },
{ text: `${player.latency}`, color: config.colors.integer }
]
});
component.push("\n");
};
component.pop();
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi())}\`\`\``);
}
}
+21 -1
View File
@@ -75,7 +75,27 @@ module.exports = {
async discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const component = [];
const fixansi = context.fixansi;
let component = [];
let term = `${args.join(' ')}`
const query = new URLSearchParams({ term });
const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`);
const { list } = await dictResult.body.json();
try {
for (definitions of list) {
component.push([
{
text: `${definitions.definition.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77').substring(0, 1950)}\n`,
color: 'gray',
}
]);
}
bot.discord.message.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
} catch (e) {
bot?.discord?.message?.reply(e.toString());
}
}
}
+71 -48
View File
@@ -1,6 +1,56 @@
const CommandError = require('../../util/command_error');
const { request } = require('undici');
function components (config, info, component) {
component.push({
translate: "%s\n%s: %s, %s\n%s: %s (%s)\n%s\n%s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{
translate: "%s: %s, %s %s",
with: [
{ text: "Location", color: config.colors.commands.primary },
{ text: `${info.location.name}`, color: config.colors.commands.secondary },
{ text: `${info.location.region}`, color: config.colors.commands.secondary },
{ text: `${info.location.country}`, color: config.colors.commands.secondary },
]
},
{ text: "Coords", color: config.colors.commands.primary },
{ text: `${info.location.lat}`, color: config.colors.integer },
{ text: `${info.location.lon}`, color: config.colors.integer },
{ text: "Time", color: config.colors.commands.primary },
{ text: `${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id, })}`, color: config.colors.commands.secondary },
{ text: `${info.location.tz_id}`, color: config.colors.commands.secondary },
{
translate: "%s: %s (%s), %s (%s)",
with: [
{ text: "Temp", color: config.colors.commands.primary },
{ text: `${Math.floor(info.current.temp_c)}`, color: config.colors.integer },
{ text: "\u00b0C", color: config.colors.commands.secondary },
{ text: `${Math.floor(info.current.temp_f)}`, color: config.colors.integer },
{ text: "\u00b0F", color: config.colors.commands.secondary }
]
},
{
translate: "%s: %s (%s, %s), %s (%s, %s)",
with: [
{ text: "Wind Speed", color: config.colors.commands.primary },
{ text: `${Math.floor(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: `${Math.floor(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: `${Math.floor(info.current.humidity)}`, color: config.colors.integer }
]
});
}
module.exports = {
data: {
name: "weather",
@@ -22,57 +72,30 @@ module.exports = {
try {
const url = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ').replaceAll(' ','&')}`);
const info = await url.body.json();
component.push({
translate: "%s\n%s: %s, %s\n%s: %s (%s)\n%s\n%s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{
translate: "%s: %s, %s %s",
with: [
{ text: "Location", color: config.colors.commands.primary },
{ text: `${info.location.name}`, color: config.colors.commands.secondary },
{ text: `${info.location.region}`, color: config.colors.commands.secondary },
{ text: `${info.location.country}`, color: config.colors.commands.secondary },
]
},
{ text: "Coords", color: config.colors.commands.primary },
{ text: `${info.location.lat}`, color: config.colors.integer },
{ text: `${info.location.lon}`, color: config.colors.integer },
{ text: "Time", color: config.colors.commands.primary },
{ text: `${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id, })}`, color: config.colors.commands.secondary },
{ text: `${info.location.tz_id}`, color: config.colors.commands.secondary },
{
translate: "%s: %s (%s), %s (%s)",
with: [
{ text: "Temp", color: config.colors.commands.primary },
{ text: `${Math.floor(info.current.temp_c)}`, color: config.colors.integer },
{ text: "\u00b0C", color: config.colors.commands.secondary },
{ text: `${Math.floor(info.current.temp_f)}`, color: config.colors.integer },
{ text: "\u00b0F", color: config.colors.commands.secondary }
]
},
{
translate: "%s: %s (%s, %s), %s (%s, %s)",
with: [
{ text: "Wind Speed", color: config.colors.commands.primary },
{ text: `${Math.floor(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: `${Math.floor(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: `${Math.floor(info.current.humidity)}`, color: config.colors.integer }
]
});
components(config, info, component);
bot.tellraw("@a", component);
} catch (e) {
bot.chat.message(e.toString());
}
},
async discordExecute (context) {
const config = context.config;
const bot = context.bot;
const fixansi = context.fixansi;
const args = context.arguments;
let component = [];
try {
const url = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ').replaceAll(' ','&')}`);
const info = await url.body.json();
components(config, info, component);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
} catch (e) {
bot?.discord?.message?.reply(e.toString());
}
}
}
}
+19 -8
View File
@@ -39,17 +39,28 @@ module.exports = {
bot.tellraw(`@a`, `${e.toString()}`)
}
}
},
async discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const fixansi = context.fixansi;
/* try {
const page = await wiki.page(args.join(' '))
let component = [];
try {
const page = await wiki.page(args.join(' '));
const summary = await page.intro();
bot.tellraw(`@a`, { text: `${summary}`, color: 'gray' });
} catch (error) {
if (error.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')") {
bot.chat.message('&cArticle not found!');
components(config, summary, component);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
} catch (e) {
if (e.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')") {
bot?.discord?.message?.reply('Article not found!');
} else {
bot.tellraw(`@a`, `${error.toString()}`)
bot?.discord?.message?.reply(`${e.toString()}`);
}
}*/
}
}
}
+2 -2
View File
@@ -1,8 +1,8 @@
{
"buildstring": {
"build": "2030",
"build": "2050",
"codename": "§aGame §aTheory",
"version": "v7.0.0-beta",
"version": "v7.0.0",
"url":"https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot"
}
}