42 lines
955 B
C++
42 lines
955 B
C++
#pragma once
|
|
#include <Command/Interface.hpp>
|
|
#include <Logger.hpp>
|
|
#include <format>
|
|
#include <ts6bot/MusicManager.hpp>
|
|
|
|
// --- Play Command ---
|
|
class Subscribe : public Command
|
|
{
|
|
public:
|
|
|
|
void execute(const CommandContext& ctx) override
|
|
{
|
|
if (ctx.musicManager.expired()) {
|
|
LOG_ERROR("MusicManager is expired");
|
|
return;
|
|
}
|
|
|
|
std::string args(ctx.args);
|
|
std::string invoker(ctx.invokerName);
|
|
|
|
if (ctx.musicManager.lock()->subscribe(ctx.clientID)) {
|
|
ctx.reply("You are now subscribed to the music bot.");
|
|
} else {
|
|
ctx.reply("Already subscribed to the music bot.");
|
|
}
|
|
}
|
|
CommandCategory getCategory() const override
|
|
{
|
|
return CommandCategory::Session;
|
|
}
|
|
std::vector<std::string_view> getAliases() const override
|
|
{
|
|
return {"sub"};
|
|
}
|
|
std::string_view getDescription() const override
|
|
{
|
|
return "Subscribe on playback from bot.";
|
|
}
|
|
std::string_view getUsage() const override { return ""; }
|
|
};
|