making WEB

Signed-off-by: faumaray <faumaray@gmail.com>
This commit is contained in:
faumaray committed 2026-07-11 00:45:17 +03:00
1 parent d146f11f02
commit 5c036d91fb
72 files changed
+5875 -1243

No files matched your search

+22 -16
View File
@@ -20,34 +20,38 @@ namespace Echoion::Core
try {
auto manager = ctx.musicManager.lock();
if (!manager) {
ctx.reply(
"The music service is currently unavailable.");
ctx.reply(ctx.tr(
"The music service is currently unavailable."));
return;
}
if (ctx.args.empty()) {
ctx.reply(std::format("Usage: {} <query>", label()));
ctx.reply(ctx.trf("Usage: {} <query>", label()));
return;
}
auto result = manager->search(ctx.args, scope());
if (!result) {
Void::Log::error("SearchCommand", "{}",
Void::Log::error(
"SearchCommand", "{}",
std::format("Search failed for '{}': {}", ctx.args,
result.error().message));
if (result.error().code ==
Api::ErrorCode::NetworkError) {
ctx.reply("Couldn't connect to search service. "
"Please check your connection.");
ctx.reply(
ctx.tr("Couldn't connect to search service. "
"Please check your connection."));
} else {
ctx.reply("Search failed. Please try again later.");
ctx.reply(ctx.tr(
"Search failed. Please try again later."));
}
return;
}
if (result->tracks.empty()) {
ctx.reply("No results found. Try different keywords.");
ctx.reply(ctx.tr(
"No results found. Try different keywords."));
return;
}
@@ -55,7 +59,8 @@ namespace Echoion::Core
manager->storePendingSearch(ctx.clientId, result->tracks);
std::stringstream msg;
msg << "Search results for \"" << ctx.args << "\":\n\n";
msg << ctx.tr("Search results for \"") << ctx.args
<< ctx.tr("\":\n\n");
for (size_t i = 0; i < result->tracks.size() && i < 5;
++i) {
@@ -67,26 +72,27 @@ namespace Echoion::Core
}
// [escaped title](url) · duration (no [] around the
// duration: TeamSpeak parses [..] as a link reference).
msg << std::format(
msg << ctx.trf(
"{}. {}", i + 1,
markdownLink(displayText, trackLinkUrl(track)));
if (track.duration.has_value()) {
msg << " " << kDot << " "
<< formatDuration(*track.duration);
}
msg << "\n";
msg << ctx.tr("\n");
}
msg << std::format(
"\nUse {}select <number> to play a result.",
ctx.prefix);
msg << ctx.trf("\nUse {}select <number> to play a result.",
ctx.prefix);
ctx.reply(msg.str());
} catch (const std::exception& e) {
Void::Log::error("SearchCommand", "{}",
Void::Log::error(
"SearchCommand", "{}",
std::format("Search command exception: {}", e.what()));
ctx.reply("Something went wrong. Please try again.");
ctx.reply(
ctx.tr("Something went wrong. Please try again."));
}
}