#pragma once #include #include #include #include class Playlist : 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 (args.find("http") == 0) { if (auto plId = ctx.musicManager.lock()->extractPlaylistId(args)) { if (ctx.musicManager.lock()->playPlaylist(*plId, invoker)) { ctx.reply("Added PlayList to queue."); } else { ctx.reply("Failed to add playlist into the queue"); } } } } CommandCategory getCategory() const override { return CommandCategory::Music; } std::vector getAliases() const override { return {}; } std::string_view getDescription() const override { return "Plays all songs from URL of YouTube playlist"; } std::string_view getUsage() const override { return ""; } };