@zerospacegg/vynthra
Version:
Discord bot for ZeroSpace.gg data
186 lines (176 loc) ⢠9.1 kB
JavaScript
/**
* Test different display formats for tech trees in Discord
*/
function generateTestFormats() {
// Sample tech tree data for testing
const sampleData = {
faction: "Protectorate",
emoji: "š¤",
tree: {
"Operating Tower": {
children: [
{
name: "Supply Platform",
children: [
{
name: "Prot Barracks",
children: [
{ name: "Factory", children: [{ name: "Advanced Factory", children: [] }] },
{ name: "Ranger", children: [] },
{ name: "Sentry", children: [] }
]
}
]
},
{
name: "Research Lab",
children: [
{ name: "Specialized Research Lab", children: [] },
{ name: "Mechanical Research Lab", children: [] }
]
}
]
}
}
};
const formats = {};
// FORMAT 1: Simple Bullet Lists with Emojis
formats["bullet_lists"] = `š¤ **PROTECTORATE TECH TREE** š¤
š **Operating Tower** - <https://zerospace.gg/library/operating-tower>
āļø šļø **Supply Platform** - <https://zerospace.gg/library/supply-platform>
ā āļø š° **Prot Barracks** - <https://zerospace.gg/library/prot-barracks>
ā āļø š **Factory** - <https://zerospace.gg/library/factory>
ā ā āļø š **Advanced Factory** - <https://zerospace.gg/library/advanced-factory>
ā āļø šÆ **Ranger** - <https://zerospace.gg/library/ranger>
ā āļø š”ļø **Sentry** - <https://zerospace.gg/library/sentry>
āļø š¬ **Research Lab** - <https://zerospace.gg/library/research-lab>
āļø š¬ **Specialized Research Lab** - <https://zerospace.gg/library/specialized-research-lab>
āļø š§ **Mechanical Research Lab** - <https://zerospace.gg/library/mechanical-research-lab>`;
// FORMAT 2: Code Block with ASCII
formats["code_block"] = `š¤ **PROTECTORATE TECH TREE** š¤
\`\`\`
Operating Tower
āā Supply Platform
ā āā Prot Barracks
ā āā Factory
ā ā āā Advanced Factory
ā āā Ranger
ā āā Sentry
āā Research Lab
āā Specialized Research Lab
āā Mechanical Research Lab
\`\`\`
**Links:**
⢠Operating Tower: <https://zerospace.gg/library/operating-tower>
⢠Supply Platform: <https://zerospace.gg/library/supply-platform>
⢠Prot Barracks: <https://zerospace.gg/library/prot-barracks>
⢠Factory: <https://zerospace.gg/library/factory>
⢠Advanced Factory: <https://zerospace.gg/library/advanced-factory>
⢠Ranger: <https://zerospace.gg/library/ranger>
⢠Sentry: <https://zerospace.gg/library/sentry>
⢠Research Lab: <https://zerospace.gg/library/research-lab>
⢠Specialized Research Lab: <https://zerospace.gg/library/specialized-research-lab>
⢠Mechanical Research Lab: <https://zerospace.gg/library/mechanical-research-lab>`;
// FORMAT 3: Simple Indented Lists
formats["indented_lists"] = `š¤ **PROTECTORATE TECH TREE** š¤
**š Operating Tower** <https://zerospace.gg/library/operating-tower>
**šļø Supply Platform** <https://zerospace.gg/library/supply-platform>
**š° Prot Barracks** <https://zerospace.gg/library/prot-barracks>
**š Factory** <https://zerospace.gg/library/factory>
**š Advanced Factory** <https://zerospace.gg/library/advanced-factory>
**šÆ Ranger** <https://zerospace.gg/library/ranger>
**š”ļø Sentry** <https://zerospace.gg/library/sentry>
**š¬ Research Lab** <https://zerospace.gg/library/research-lab>
**š¬ Specialized Research Lab** <https://zerospace.gg/library/specialized-research-lab>
**š§ Mechanical Research Lab** <https://zerospace.gg/library/mechanical-research-lab>`;
// FORMAT 4: Emoji Tree Structure
formats["emoji_tree"] = `š¤ **PROTECTORATE TECH TREE** š¤
š Operating Tower <https://zerospace.gg/library/operating-tower>
ā£ā šļø Supply Platform <https://zerospace.gg/library/supply-platform>
ā āā š° Prot Barracks <https://zerospace.gg/library/prot-barracks>
ā ā£ā š Factory <https://zerospace.gg/library/factory>
ā ā āā š Advanced Factory <https://zerospace.gg/library/advanced-factory>
ā ā£ā šÆ Ranger <https://zerospace.gg/library/ranger>
ā āā š”ļø Sentry <https://zerospace.gg/library/sentry>
āā š¬ Research Lab <https://zerospace.gg/library/research-lab>
ā£ā š¬ Specialized Research Lab <https://zerospace.gg/library/specialized-research-lab>
āā š§ Mechanical Research Lab <https://zerospace.gg/library/mechanical-research-lab>`;
// FORMAT 5: Layered Approach
formats["layered"] = `š¤ **PROTECTORATE TECH TREE** š¤
**š Tier 1 - Foundation**
š Operating Tower <https://zerospace.gg/library/operating-tower>
**š Tier 2 - Infrastructure**
šļø Supply Platform <https://zerospace.gg/library/supply-platform> *(requires Operating Tower)*
š¬ Research Lab <https://zerospace.gg/library/research-lab> *(requires Operating Tower)*
**š Tier 3 - Military & Research**
š° Prot Barracks <https://zerospace.gg/library/prot-barracks> *(requires Supply Platform)*
š¬ Specialized Research Lab <https://zerospace.gg/library/specialized-research-lab> *(requires Research Lab)*
š§ Mechanical Research Lab <https://zerospace.gg/library/mechanical-research-lab> *(requires Research Lab)*
**š Tier 4 - Units & Advanced**
š Factory <https://zerospace.gg/library/factory> *(requires Prot Barracks)*
šÆ Ranger <https://zerospace.gg/library/ranger> *(requires Prot Barracks)*
š”ļø Sentry <https://zerospace.gg/library/sentry> *(requires Prot Barracks)*
**š Tier 5 - Elite**
š Advanced Factory <https://zerospace.gg/library/advanced-factory> *(requires Factory)*`;
return formats;
}
export const techTreeDisplayTestSubcommand = {
name: "tech-tree-test",
description: "Test different display formats for tech trees",
builder: (subcommand) => subcommand
.setName("tech-tree-test")
.setDescription("Test different display formats for tech trees")
.addStringOption((option) => option
.setName("format")
.setDescription("Display format to test")
.setRequired(true)
.addChoices({ name: "šø Bullet Lists with Emojis", value: "bullet_lists" }, { name: "š Code Block + Links", value: "code_block" }, { name: "š Simple Indented", value: "indented_lists" }, { name: "š² Emoji Tree Structure", value: "emoji_tree" }, { name: "š Layered by Tier", value: "layered" }))
.addBooleanOption((option) => option
.setName("public")
.setDescription("Show results to everyone (default: private)")
.setRequired(false)),
async execute(interaction) {
const format = interaction.options.getString("format", true);
const isPublic = interaction.options.getBoolean("public") ?? false;
try {
await interaction.deferReply({ ephemeral: !isPublic });
const formats = generateTestFormats();
const selectedFormat = formats[format];
if (!selectedFormat) {
await interaction.editReply("ā Invalid format selected");
return;
}
// Add format info header
const formatNames = {
bullet_lists: "šø Bullet Lists with Emojis",
code_block: "š Code Block + Links",
indented_lists: "š Simple Indented",
emoji_tree: "š² Emoji Tree Structure",
layered: "š Layered by Tier",
};
const response = `**TESTING: ${formatNames[format]}**\n\n${selectedFormat}`;
// Handle message length
if (response.length <= 2000) {
await interaction.editReply(response);
}
else {
// Split the message if too long
const chunks = response.match(/.{1,2000}(?=\s|$)/g) || [response];
await interaction.editReply(chunks[0]);
for (let i = 1; i < chunks.length; i++) {
await interaction.followUp({
content: chunks[i],
ephemeral: !isPublic,
});
}
}
}
catch (error) {
console.error("Tech tree display test failed:", error);
await interaction.editReply({
content: `ā Error: ${error instanceof Error ? error.message : "Unknown error"}`,
});
}
},
};
//# sourceMappingURL=tech-tree-display-test.js.map