F1 (reload commands): Core registers itself as Api::ICoreInterface in the service registry; !reloadconfig and !reload resolve it via ctx.service and call Core::reloadConfig() (which reloads config.json from disk), replacing the old placeholder replies. F2 (SOCKS5 playback): ffmpeg can't use a SOCKS5 proxy, so it connected directly to the IP-locked googlevideo URL and timed out; the fallback then buffered the whole (705 MB) body in memory and tripped Void::Net's body limit. New YouTubeClient::downloadAudioToFile() re-downloads the audio with yt-dlp (which handles SOCKS5 + writes to disk) by video id and ffmpeg opens the local file. MusicManager::downloadAudioForPlayback now uses it, and the play-open path short-circuits straight to the download when the proxy is SOCKS5 (skipping the doomed ~15 s ffmpeg attempt); HTTP/no-proxy keeps stream-first-then-download. F3 (API fallback): YouTubeClient::search() now falls back to yt-dlp when the Data API path errors (bad/expired key, quota, network), mirroring what fetchPlaylistItems already did. Build green; runtime behaviour to be verified on the live bot. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
56 lines
1.3 KiB
C++
56 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include "Command.hpp"
|
|
#include <CoreInterface.hpp>
|
|
#include <Void/Log/Log.hpp>
|
|
#include <format>
|
|
|
|
namespace Echoion::Core
|
|
{
|
|
|
|
class ReloadCommand : public Command
|
|
{
|
|
public:
|
|
|
|
void execute(const CommandContext& ctx) override
|
|
{
|
|
Void::Log::info("ReloadCommand", "{}",
|
|
"Reload requested by user");
|
|
|
|
// Reload configuration from disk. A full core/plugin reload is
|
|
// driven from the TS plugin menu (that lives in the plugin).
|
|
if (auto core = ctx.service<Api::ICoreInterface>()) {
|
|
auto result = core->reloadConfig();
|
|
if (result) {
|
|
ctx.reply("✅ Configuration reloaded. For a full core "
|
|
"reload, use the TS plugin menu.");
|
|
} else {
|
|
ctx.reply(std::string("❌ Config reload failed: ") +
|
|
result.error().message);
|
|
}
|
|
} else {
|
|
ctx.reply("Reload is handled by the plugin. Use the TS "
|
|
"plugin menu to reload the core.");
|
|
}
|
|
}
|
|
|
|
std::string_view getDescription() const override
|
|
{
|
|
return "Shows information about reloading the bot.";
|
|
}
|
|
|
|
CommandCategory getCategory() const override
|
|
{
|
|
return CommandCategory::Admin;
|
|
}
|
|
|
|
bool requiresAdmin() const override { return true; }
|
|
|
|
std::vector<std::string_view> getAliases() const override
|
|
{
|
|
return {"restart", "r"};
|
|
}
|
|
};
|
|
|
|
} // namespace Echoion::Core
|