#pragma once #include "../MusicManager.hpp" #include "Command.hpp" #include namespace Echoion::Core { // !announce — admin-only. Stores the announcement and delivers it // as a private message to each subscriber exactly once: to those online // now, and to others the next time they connect. Persisted per-uid, so a // bot restart never re-sends, and re-running !announce with new text // reaches everyone once more. class AnnounceCommand : public Command { public: void execute(const CommandContext& ctx) override { auto manager = ctx.musicManager.lock(); if (!manager) { ctx.reply( ctx.tr("The music service is currently unavailable.")); return; } if (ctx.args.empty()) { ctx.reply( ctx.trf("Usage: {}announce ", ctx.prefix)); return; } const size_t reached = manager->setAnnouncement(ctx.args); ctx.reply(ctx.trf( "Announcement saved and delivered to {} online " "subscriber(s). Offline subscribers get it on their " "next connect.", reached)); } std::string_view getDescription() const override { return "Send an announcement to all subscribers (admin)."; } std::string_view getUsage() const override { return ""; } CommandCategory getCategory() const override { return CommandCategory::Admin; } bool requiresAdmin() const override { return true; } }; } // namespace Echoion::Core