Files
faumaray 5c036d91fb making WEB
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-11 00:45:17 +03:00

58 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(
ctx.tr("✅ 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(
ctx.tr("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