2024-11-06 11:50:24 -05:00
|
|
|
const bots = require('../../data/bots.json');
|
|
|
|
const CommandError = require('../../util/command_error')
|
2024-07-07 15:44:16 -04:00
|
|
|
module.exports = {
|
2024-11-06 11:50:24 -05:00
|
|
|
data: {
|
|
|
|
name: "bots",
|
|
|
|
description: "shows a list of known bots",
|
|
|
|
aliases: [
|
|
|
|
"knownbots"
|
|
|
|
],
|
|
|
|
trustLevel: 0,
|
|
|
|
usages: [
|
|
|
|
""
|
|
|
|
],
|
|
|
|
},
|
|
|
|
async execute(context) {
|
2024-07-20 20:27:17 -04:00
|
|
|
const query = context.arguments.join(" ").toLowerCase();
|
2024-07-07 15:44:16 -04:00
|
|
|
const bot = context.bot;
|
|
|
|
if (query.length === 0) {
|
2024-07-20 20:27:17 -04:00
|
|
|
const list = [];
|
2024-07-07 15:44:16 -04:00
|
|
|
for (const info of bots) {
|
2024-07-20 20:27:17 -04:00
|
|
|
if (list.length !== 0) {
|
|
|
|
list.push({ text: ", ", color: "gray" });
|
|
|
|
}
|
|
|
|
list.push(info.name);
|
2024-07-07 15:44:16 -04:00
|
|
|
|
2024-07-20 20:27:17 -04:00
|
|
|
}
|
|
|
|
bot.tellraw("@a",
|
2024-09-07 21:13:24 -04:00
|
|
|
["Known bots (", { text: JSON.stringify(bots.length), color: 'gold' }, { text: ") - ", color: 'gray' }, ...list],
|
2024-07-20 20:27:17 -04:00
|
|
|
false,
|
|
|
|
);
|
|
|
|
return;
|
2024-07-07 15:44:16 -04:00
|
|
|
}
|
|
|
|
for (const info of bots) {
|
2024-07-20 20:27:17 -04:00
|
|
|
const plainName = String(
|
|
|
|
context.bot.getMessageAsPrismarine(info.name),
|
|
|
|
).toLowerCase();
|
|
|
|
if (plainName.includes(query)) this.sendBotInfo(info, context.bot);
|
2024-07-07 15:44:16 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2024-07-20 20:27:17 -04:00
|
|
|
sendBotInfo(info, bot) {
|
|
|
|
const component = [""];
|
|
|
|
component.push("Name: ", info.name);
|
|
|
|
if (info.exclaimer) component.push("\n", "Exclaimer: ", info.exclaimer);
|
2024-07-07 15:44:16 -04:00
|
|
|
if (info.authors && info.authors.length !== 0) {
|
2024-07-20 20:27:17 -04:00
|
|
|
component.push("\n", "Authors: ");
|
2024-07-07 15:44:16 -04:00
|
|
|
for (const author of info.authors) {
|
2024-07-20 20:27:17 -04:00
|
|
|
component.push(author, { text: ", ", color: "gray" });
|
2024-07-07 15:44:16 -04:00
|
|
|
}
|
2024-07-20 20:27:17 -04:00
|
|
|
component.pop();
|
2024-07-07 15:44:16 -04:00
|
|
|
}
|
2024-07-20 20:27:17 -04:00
|
|
|
if (info.foundation) component.push("\n", "Foundation: ", info.foundation);
|
2024-07-07 15:44:16 -04:00
|
|
|
if (info.prefixes && info.prefixes.length !== 0) {
|
2024-07-20 20:27:17 -04:00
|
|
|
component.push("\n", "Prefixes: ");
|
2024-07-07 15:44:16 -04:00
|
|
|
for (const prefix of info.prefixes) {
|
2024-07-20 20:27:17 -04:00
|
|
|
component.push(prefix, { text: ", ", color: "gray" });
|
2024-07-07 15:44:16 -04:00
|
|
|
}
|
2024-07-20 20:27:17 -04:00
|
|
|
component.pop();
|
2024-07-07 15:44:16 -04:00
|
|
|
}
|
2024-07-20 20:27:17 -04:00
|
|
|
bot.tellraw("@a", [component]);
|
|
|
|
},
|
|
|
|
};
|
|
|
|
//it doing it just for the ones i added lol
|
2024-08-09 22:08:42 -04:00
|
|
|
// prob a replit moment, it probably thinks there are regexes in the strings
|