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

@@ -16,24 +16,26 @@ 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;
}
auto current = manager->getCurrentTrack();
if (!current) {
Void::Log::error("NowPlayingCommand", "{}",
Void::Log::error(
"NowPlayingCommand", "{}",
std::format("NowPlaying command failed: {}",
current.error().message));
ctx.reply("Couldn't get current track information.");
ctx.reply(
ctx.tr("Couldn't get current track information."));
return;
}
if (!current->has_value()) {
ctx.reply(std::format("Nothing is currently playing. "
"Add something with {}play !",
ctx.prefix));
ctx.reply(ctx.trf("Nothing is currently playing. "
"Add something with {}play !",
ctx.prefix));
return;
}
@@ -70,11 +72,21 @@ namespace Echoion::Core
escapeMarkdown(track.addedBy));
}
// Same at-a-glance status footer as !help and !list.
if (std::string status = playbackStatusLine(ctx);
!status.empty()) {
msg += "\n\n";
msg += status;
}
ctx.reply(msg);
} catch (const std::exception& e) {
Void::Log::error("NowPlayingCommand", "{}", std::format(
"NowPlaying command exception: {}", e.what()));
ctx.reply("Something went wrong. Please try again.");
Void::Log::error(
"NowPlayingCommand", "{}",
std::format("NowPlaying command exception: {}",
e.what()));
ctx.reply(
ctx.tr("Something went wrong. Please try again."));
}
}
@@ -92,22 +104,6 @@ namespace Echoion::Core
{
return {"np", "current", "playing"};
}
private:
static std::string
formatDuration(std::chrono::milliseconds duration)
{
auto totalSeconds = duration.count() / 1000;
auto hours = totalSeconds / 3600;
auto mins = (totalSeconds % 3600) / 60;
auto secs = totalSeconds % 60;
if (hours > 0) {
return std::format("{}:{:02}:{:02}", hours, mins, secs);
}
return std::format("{}:{:02}", mins, secs);
}
};
} // namespace Echoion::Core