#pragma once #include "Command.hpp" #include #include #include namespace Echoion::Core { class ReloadConfigCommand : public Command { public: void execute(const CommandContext& ctx) override { try { auto core = ctx.service(); if (!core) { ctx.reply("Config reload is unavailable right now."); return; } auto result = core->reloadConfig(); if (result) { ctx.reply("✅ Configuration reloaded from disk."); } else { ctx.reply(std::string("❌ Failed to reload config: ") + result.error().message); } } catch (const std::exception& e) { Void::Log::error("ReloadConfigCommand", "{}", std::format( "ReloadConfig command exception: {}", e.what())); ctx.reply("Something went wrong. Please try again."); } } std::string_view getDescription() const override { return "Reloads the bot configuration from file."; } CommandCategory getCategory() const override { return CommandCategory::Admin; } bool requiresAdmin() const override { return true; } std::vector getAliases() const override { return {"reloadcfg", "rlcfg"}; } }; } // namespace Echoion::Core