help: collapsible sections with TS6 markdown

Rebuild the !help output using TeamSpeak 6 markdown: an H1 title, a > [!TIP]
callout for the prefix, and a collapsible <details>/<summary> block per command
category (with a category icon). Aliases are separated by a middot. Each
category folds away, keeping a long command list compact.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Opus 4.8 committed 2026-06-26 03:15:40 +03:00
1 parent b9c6c5dbc9
commit df99b6ea7f
1 file changed
+38 -16
+38 -16
View File
@@ -25,9 +25,12 @@ namespace Echoion::Core
try {
auto prefix = manager_.getPrefix();
std::string helpMsg = std::format(
"\xf0\x9f\x8e\xb5 **Echoion Bot Help**\n\n");
helpMsg += std::format("Prefix: `{}`\n\n", prefix);
std::string helpMsg =
"# \xf0\x9f\x8e\xb5 Echoion Bot Help\n\n";
helpMsg += std::format(
"> [!TIP]\n> Prefix is `{}` \xe2\x80\x94 e.g. "
"`{}play lofi`\n\n",
prefix, prefix);
// Get commands visible to this client
auto visibleCommands =
@@ -42,35 +45,52 @@ namespace Echoion::Core
grouped[cmd->getCategory()].push_back({name, cmd});
}
// Per-category icon for the collapsible section header.
auto categoryEmoji =
[](CommandCategory c) -> std::string_view {
switch (c) {
case CommandCategory::Music:
return "\xf0\x9f\x8e\xb5"; // music note
case CommandCategory::Queue:
return "\xf0\x9f\x93\x9c"; // scroll
case CommandCategory::Playback:
return "\xe2\x8f\xaf"; // play/pause
case CommandCategory::Utility:
return "\xf0\x9f\x94\xa7"; // wrench
case CommandCategory::Admin:
return "\xf0\x9f\x9b\xa0"; // tools
}
return "";
};
for (const auto& [cat, cmds] : grouped) {
helpMsg +=
std::format("**{} Commands**\n", toString(cat));
// Collapsible section per category (TS6 supports
// <details>/<summary>). Blank lines around the inner
// content let the Markdown render inside the block.
helpMsg += std::format(
"<details>\n<summary>{} {} Commands</summary>\n\n",
categoryEmoji(cat), toString(cat));
for (const auto& [name, cmd] : cmds) {
// Format: prefix!command usage
if (!cmd->getUsage().empty()) {
helpMsg += std::format("`{}{}` {}\n",
prefix,
name,
cmd->getUsage());
helpMsg += std::format("`{}{}` {}\n", prefix,
name, cmd->getUsage());
} else {
helpMsg +=
std::format("`{}{}`\n", prefix, name);
}
// Description
helpMsg +=
std::format("> {}\n", cmd->getDescription());
// Aliases
auto aliases = cmd->getAliases();
if (!aliases.empty()) {
helpMsg += "> Aliases: ";
for (size_t i = 0; i < aliases.size(); ++i) {
helpMsg += std::format(
"`{}{}`", prefix, aliases[i]);
if (i < aliases.size() - 1) {
helpMsg += ", ";
helpMsg += std::format("`{}{}`", prefix,
aliases[i]);
if (i + 1 < aliases.size()) {
helpMsg += " \xc2\xb7 "; // middot
}
}
helpMsg += "\n";
@@ -78,6 +98,8 @@ namespace Echoion::Core
helpMsg += "\n";
}
helpMsg += "</details>\n\n";
}
ctx.reply(helpMsg);