Release 1.0.0

Signed-off-by: faumaray <faumaray@gmail.com>
This commit is contained in:
faumaray committed 2026-07-04 01:49:28 +03:00
1 parent df99b6ea7f
commit d146f11f02
63 files changed
+8331 -2709

No files matched your search

@@ -0,0 +1,55 @@
#pragma once
#include "../MusicManager.hpp"
#include "Command.hpp"
#include <format>
namespace Echoion::Core
{
// !announce <text> — 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("The music service is currently unavailable.");
return;
}
if (ctx.args.empty()) {
ctx.reply(std::format(
"Usage: {}announce <message>", ctx.prefix));
return;
}
const size_t reached = manager->setAnnouncement(ctx.args);
ctx.reply(std::format(
"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 "<message>"; }
CommandCategory getCategory() const override
{
return CommandCategory::Admin;
}
bool requiresAdmin() const override { return true; }
};
} // namespace Echoion::Core
@@ -0,0 +1,81 @@
#pragma once
#include "../MusicManager.hpp"
#include "Command.hpp"
#include <Void/Log/Log.hpp>
#include <algorithm>
#include <format>
#include <string>
namespace Echoion::Core
{
// !autoplay [on|off] / !radio — toggle endless related-track playback.
// With no argument it flips the current state. The choice is persisted so
// it survives restarts. Related tracks come from the same catalog as the
// last played track (YouTube radio mix or Yandex similar tracks).
class AutoplayCommand : public Command
{
public:
void execute(const CommandContext& ctx) override
{
try {
auto manager = ctx.musicManager.lock();
if (!manager) {
ctx.reply(
"The music service is currently unavailable.");
return;
}
bool enable = !manager->autoplayEnabled();
std::string arg(ctx.args);
std::transform(arg.begin(), arg.end(), arg.begin(),
[](unsigned char c) {
return static_cast<char>(std::tolower(c));
});
if (arg == "on" || arg == "true" || arg == "1" ||
arg == "enable") {
enable = true;
} else if (arg == "off" || arg == "false" || arg == "0" ||
arg == "disable") {
enable = false;
}
manager->setAutoplay(enable);
if (enable) {
ctx.reply(
"\xf0\x9f\x93\xbb Autoplay is ON \xe2\x80\x94 I'll "
"keep the music going with related tracks.");
} else {
ctx.reply("\xf0\x9f\x93\xbb Autoplay is OFF.");
}
} catch (const std::exception& e) {
Void::Log::error("AutoplayCommand", "{}",
std::format("Autoplay command exception: {}",
e.what()));
ctx.reply("Something went wrong. Please try again.");
}
}
std::string_view getDescription() const override
{
return "Toggles radio mode: auto-queues related tracks when "
"the queue runs out.";
}
std::string_view getUsage() const override { return "[on|off]"; }
CommandCategory getCategory() const override
{
return CommandCategory::Playback;
}
std::vector<std::string_view> getAliases() const override
{
return {"radio"};
}
};
} // namespace Echoion::Core
+42 -1
View File
@@ -18,11 +18,26 @@ namespace Echoion::Core
class MusicManager;
enum class CommandCategory { Music, Queue, Playback, Utility, Admin };
// Declaration order also decides the order of the collapsible sections
// in !help (the help map is keyed by this enum). Play and Search lead so
// their related commands are grouped together up top.
enum class CommandCategory {
Play,
Search,
Music,
Queue,
Playback,
Utility,
Admin
};
inline std::string toString(CommandCategory category)
{
switch (category) {
case CommandCategory::Play:
return "Play";
case CommandCategory::Search:
return "Search";
case CommandCategory::Music:
return "Music";
case CommandCategory::Queue:
@@ -78,6 +93,32 @@ namespace Echoion::Core
return escapeMarkdown(text);
}
// The best public link for a track: the shortened faumaray link when
// available, otherwise the original source URL (e.g. the YouTube or
// Yandex Music page). Used so every list — search, queue, history,
// favorites, stats — links to the real track, never the CDN/stream URL.
inline std::optional<std::string> trackLinkUrl(const Api::TrackInfo& track)
{
if (track.shortenedUrl.has_value() && !track.shortenedUrl->empty()) {
return track.shortenedUrl;
}
if (!track.originalUrl.empty()) {
return track.originalUrl;
}
return std::nullopt;
}
// Render "Title by Artist" (or just Title) as a Markdown link to the
// track's best public URL.
inline std::string trackLink(const Api::TrackInfo& track)
{
std::string display = track.title;
if (!track.artist.empty()) {
display = std::format("{} by {}", track.title, track.artist);
}
return markdownLink(display, trackLinkUrl(track));
}
/**
* @brief Context passed to every command execution.
* Wraps all dependencies required to perform an action.
@@ -1,6 +1,8 @@
#pragma once
// New command system - header-only commands
#include "AnnounceCommand.hpp"
#include "AutoplayCommand.hpp"
#include "ClearCommand.hpp"
#include "Command.hpp"
#include "MoveCommand.hpp"
@@ -19,8 +21,15 @@
#include "SeekCommand.hpp"
#include "SelectCommand.hpp"
#include "ShuffleCommand.hpp"
#include "FavoriteCommand.hpp"
#include "HistoryCommand.hpp"
#include "SkipCommand.hpp"
#include "StatsCommand.hpp"
#include "StopCommand.hpp"
#include "YandexPlayCommand.hpp"
#include "YandexSearchCommand.hpp"
#include "YoutubePlayCommand.hpp"
#include "YoutubeSearchCommand.hpp"
#include "SubscribeCommand.hpp"
#include "SubscribersCommand.hpp"
#include "UnsubscribeAllCommand.hpp"
@@ -0,0 +1,206 @@
#pragma once
#include "../MusicManager.hpp"
#include "Command.hpp"
#include <Database.hpp>
#include <charconv>
#include <format>
#include <string>
namespace Echoion::Core
{
// !fav add | list | play <n> | remove <n> — per-user favorites keyed by
// the stable TS3 unique identifier (hashed to the database's uint64
// user key with FNV-1a; session client ids are NOT stable).
class FavoriteCommand : public Command
{
public:
void execute(const CommandContext& ctx) override
{
auto manager = ctx.musicManager.lock();
auto db = ctx.service<Api::Database>();
if (!manager || !db) {
ctx.reply("Favorites are unavailable.");
return;
}
auto uid = manager->clientUid(ctx.clientId);
if (!uid) {
ctx.reply("Couldn't identify you on the server.");
return;
}
const uint64_t userKey = fnv1a(*uid);
const auto [sub, rest] = splitFirstWord(ctx.args);
if (sub.empty() || sub == "list") {
listFavorites(ctx, *db, userKey);
} else if (sub == "add") {
addCurrent(ctx, *manager, *db, userKey);
} else if (sub == "play") {
playFavorite(ctx, *manager, *db, userKey, rest);
} else if (sub == "remove" || sub == "rm") {
removeFavorite(ctx, *db, userKey, rest);
} else {
ctx.reply(std::format(
"Usage: {}fav add | list | play <n> | remove <n>",
ctx.prefix));
}
}
std::string_view getDescription() const override
{
return "Manage your favorite tracks";
}
std::string_view getUsage() const override
{
return "add | list | play <n> | remove <n>";
}
CommandCategory getCategory() const override
{
return CommandCategory::Music;
}
std::vector<std::string_view> getAliases() const override
{
return {"favorite", "favorites"};
}
private:
[[nodiscard]] static uint64_t fnv1a(std::string_view text)
{
uint64_t hash = 14695981039346656037ull;
for (unsigned char c : text) {
hash ^= c;
hash *= 1099511628211ull;
}
return hash;
}
[[nodiscard]] static std::pair<std::string, std::string>
splitFirstWord(const std::string& text)
{
const auto start = text.find_first_not_of(' ');
if (start == std::string::npos) {
return {};
}
const auto end = text.find(' ', start);
if (end == std::string::npos) {
return {text.substr(start), {}};
}
const auto restStart = text.find_first_not_of(' ', end);
return {text.substr(start, end - start),
restStart == std::string::npos
? std::string{}
: text.substr(restStart)};
}
[[nodiscard]] static std::optional<size_t>
parseIndex(const std::string& text)
{
unsigned parsed = 0;
auto [_, ec] = std::from_chars(
text.data(), text.data() + text.size(), parsed);
if (ec != std::errc{} || parsed == 0) {
return std::nullopt;
}
return parsed;
}
static void listFavorites(const CommandContext& ctx,
Api::Database& db, uint64_t userKey)
{
auto favorites = db.getFavorites(userKey);
if (!favorites) {
ctx.reply("Couldn't read your favorites.");
return;
}
if (favorites->empty()) {
ctx.reply(std::format(
"You have no favorites yet. Save the current track "
"with {}fav add",
ctx.prefix));
return;
}
std::string msg = "Your favorites:";
size_t index = 1;
for (const auto& fav : *favorites) {
msg += std::format("\n{}. {}", index++,
trackLink(fav.track));
}
ctx.reply(msg);
}
static void addCurrent(const CommandContext& ctx,
MusicManager& manager, Api::Database& db,
uint64_t userKey)
{
auto current = manager.getCurrentTrack();
if (!current || !current->has_value()) {
ctx.reply("Nothing is playing right now.");
return;
}
const auto& track = (*current)->track;
if (db.addFavorite(userKey, track)) {
ctx.reply(std::format("Added to favorites: {}",
track.title));
} else {
ctx.reply("Couldn't save the favorite.");
}
}
static void playFavorite(const CommandContext& ctx,
MusicManager& manager, Api::Database& db,
uint64_t userKey, const std::string& arg)
{
auto index = parseIndex(arg);
if (!index) {
ctx.reply("Usage: fav play <number> (see fav list)");
return;
}
auto favorites = db.getFavorites(userKey);
if (!favorites || *index > favorites->size()) {
ctx.reply("No favorite with that number.");
return;
}
const auto& track = (*favorites)[*index - 1].track;
auto result =
manager.play(track.originalUrl, ctx.clientId);
if (result) {
ctx.reply(*result);
} else {
ctx.reply(std::format("Couldn't play it: {}",
result.error().message));
}
}
static void removeFavorite(const CommandContext& ctx,
Api::Database& db, uint64_t userKey,
const std::string& arg)
{
auto index = parseIndex(arg);
if (!index) {
ctx.reply("Usage: fav remove <number> (see fav list)");
return;
}
auto favorites = db.getFavorites(userKey);
if (!favorites || *index > favorites->size()) {
ctx.reply("No favorite with that number.");
return;
}
const auto& fav = (*favorites)[*index - 1];
if (db.removeFavorite(userKey, fav.track.originalUrl)) {
ctx.reply(std::format("Removed from favorites: {}",
fav.track.title));
} else {
ctx.reply("Couldn't remove the favorite.");
}
}
};
} // namespace Echoion::Core
@@ -0,0 +1,72 @@
#pragma once
#include "../MusicManager.hpp"
#include "Command.hpp"
#include <Database.hpp>
#include <charconv>
#include <format>
namespace Echoion::Core
{
// !history [n] — recently played tracks (global, deduplicated).
class HistoryCommand : public Command
{
public:
void execute(const CommandContext& ctx) override
{
auto db = ctx.service<Api::Database>();
if (!db) {
ctx.reply("History is unavailable (no database).");
return;
}
size_t limit = 10;
if (!ctx.args.empty()) {
unsigned parsed = 0;
auto [_, ec] = std::from_chars(
ctx.args.data(), ctx.args.data() + ctx.args.size(),
parsed);
if (ec == std::errc{} && parsed > 0) {
limit = std::min<size_t>(parsed, 25);
}
}
auto recent = db->getRecentlyPlayed(0, limit);
if (!recent) {
ctx.reply("Couldn't read the playback history.");
return;
}
if (recent->empty()) {
ctx.reply("Nothing has been played yet.");
return;
}
std::string msg = "Recently played:";
size_t index = 1;
for (const auto& track : *recent) {
msg += std::format("\n{}. {}", index++, trackLink(track));
}
ctx.reply(msg);
}
std::string_view getDescription() const override
{
return "Show recently played tracks";
}
std::string_view getUsage() const override { return "[count]"; }
CommandCategory getCategory() const override
{
return CommandCategory::Music;
}
std::vector<std::string_view> getAliases() const override
{
return {"recent"};
}
};
} // namespace Echoion::Core
@@ -46,7 +46,7 @@ namespace Echoion::Core
}
std::string msg = std::format(
"\xf0\x9f\x8e\xb5 {}",
markdownLink(displayText, trackInfo.shortenedUrl));
markdownLink(displayText, trackLinkUrl(trackInfo)));
// Show current position / total duration after a middot
// (no [] — TeamSpeak parses it as a link reference).
+59 -35
View File
@@ -1,5 +1,6 @@
#pragma once
#include "../MusicManager.hpp"
#include "Command.hpp"
#include <Void/Log/Log.hpp>
#include <format>
@@ -7,7 +8,12 @@
namespace Echoion::Core
{
class PlayCommand : public Command
// Shared play rendering. Concrete commands pick the catalog scope:
// !play (both), !pyt (YouTube), !pya (Yandex). A bare URL always plays
// directly regardless of scope; free text searches the chosen catalog(s)
// and, when there is more than one hit, shows a !select list — the same
// flow as the search commands.
class PlayCommandBase : public Command
{
public:
@@ -22,18 +28,20 @@ namespace Echoion::Core
}
if (ctx.args.empty()) {
ctx.reply("Usage: play <url or search query>\nExample: "
"play never gonna give you up");
ctx.reply(std::format(
"Usage: {} <url or search query>\nExample: {} never "
"gonna give you up",
label(), label()));
return;
}
// Check if it's a direct URL
// Direct URL: hand straight to the player.
if (ctx.args.find("http") == 0) {
auto result = manager->play(ctx.args, ctx.clientId);
if (!result) {
Void::Log::error("PlayCommand", "{}",
std::format("Play URL failed '{}': {}",
ctx.args, result.error().message));
Void::Log::error("PlayCommand", "{}",
std::format("Play URL failed '{}': {}", ctx.args,
result.error().message));
switch (result.error().code) {
case Api::ErrorCode::NetworkError:
@@ -52,15 +60,14 @@ namespace Echoion::Core
return;
}
// result contains the track title
ctx.reply(std::format("Added to queue: {}", *result));
return;
}
// Otherwise, treat as search query
auto searchResult = manager->search(ctx.args);
// Otherwise, search the chosen catalog(s).
auto searchResult = manager->search(ctx.args, scope());
if (!searchResult) {
Void::Log::error("PlayCommand", "{}",
Void::Log::error("PlayCommand", "{}",
std::format("Search failed for '{}': {}", ctx.args,
searchResult.error().message));
@@ -79,13 +86,13 @@ namespace Echoion::Core
return;
}
// Single result - play immediately
// Single result - queue immediately.
if (searchResult->tracks.size() == 1) {
const auto& track = searchResult->tracks[0];
auto playResult =
manager->queueTrack(track, ctx.clientId);
if (!playResult) {
Void::Log::error("PlayCommand", "{}",
Void::Log::error("PlayCommand", "{}",
std::format("Queue failed: {}",
playResult.error().message));
ctx.reply(
@@ -100,11 +107,11 @@ namespace Echoion::Core
}
ctx.reply(std::format(
"Added to queue: {}",
markdownLink(displayText, track.shortenedUrl)));
markdownLink(displayText, trackLinkUrl(track))));
return;
}
// Multiple results - store and show list
// Multiple results - store and show list.
manager->storePendingSearch(ctx.clientId,
searchResult->tracks);
@@ -119,11 +126,9 @@ namespace Echoion::Core
displayText = std::format("{} by {}", track.title,
track.artist);
}
// [escaped title](url) · duration (no [] around the
// duration: TeamSpeak parses [..] as a link reference).
msg += std::format(
"{}. {}", i + 1,
markdownLink(displayText, track.shortenedUrl));
markdownLink(displayText, trackLinkUrl(track)));
if (track.duration.has_value()) {
msg += std::format(" {} {}", kDot,
formatDuration(*track.duration));
@@ -134,33 +139,24 @@ namespace Echoion::Core
ctx.reply(msg);
} catch (const std::exception& e) {
Void::Log::error("PlayCommand", "{}",
Void::Log::error("PlayCommand", "{}",
std::format("Play command exception: {}", e.what()));
ctx.reply("Something went wrong while trying to play. "
"Please try again.");
}
}
std::string_view getDescription() const override
{
return "Plays a track from URL or searches and lets you "
"select.";
}
std::string_view getUsage() const override
{
return "<url or search query>";
}
CommandCategory getCategory() const override
{
return CommandCategory::Music;
return CommandCategory::Play;
}
std::vector<std::string_view> getAliases() const override
{
return {"p", "add"};
}
protected:
// The catalog(s) this command searches, and the command name used
// in usage text.
[[nodiscard]] virtual MusicManager::SearchScope scope() const = 0;
[[nodiscard]] virtual std::string_view label() const = 0;
private:
@@ -179,4 +175,32 @@ namespace Echoion::Core
}
};
// !play — both YouTube and Yandex Music.
class PlayCommand : public PlayCommandBase
{
public:
std::string_view getDescription() const override
{
return "Plays a track from URL, or searches YouTube and Yandex "
"Music and lets you select.";
}
std::string_view getUsage() const override
{
return "<url or search query>";
}
std::vector<std::string_view> getAliases() const override
{
return {"p", "add"};
}
protected:
MusicManager::SearchScope scope() const override
{
return MusicManager::SearchScope::All;
}
std::string_view label() const override { return "play"; }
};
} // namespace Echoion::Core
@@ -41,7 +41,7 @@ namespace Echoion::Core
if (page < 1) {
page = 1;
}
} catch (...) {
} catch (const std::exception&) {
page = 1;
}
}
@@ -96,7 +96,8 @@ namespace Echoion::Core
}
msg << std::format(
"\n**Now Playing:** {}{}\n",
markdownLink(displayText, trackInfo.shortenedUrl),
markdownLink(displayText,
trackLinkUrl(trackInfo)),
timeStr);
}
@@ -120,7 +121,7 @@ namespace Echoion::Core
msg << std::format(
"{}. {}", i + 1,
markdownLink(displayText,
trackInfo.shortenedUrl));
trackLinkUrl(trackInfo)));
if (trackInfo.duration.has_value()) {
msg << std::format(
" {} {}", kDot,
+39 -18
View File
@@ -1,5 +1,6 @@
#pragma once
#include "../MusicManager.hpp"
#include "Command.hpp"
#include <Void/Log/Log.hpp>
#include <format>
@@ -8,7 +9,9 @@
namespace Echoion::Core
{
class SearchCommand : public Command
// Shared search rendering. Concrete commands pick the catalog scope:
// !search (both), !youtube/!yb (YouTube), !ya/!yandex (Yandex).
class SearchCommandBase : public Command
{
public:
@@ -23,12 +26,11 @@ namespace Echoion::Core
}
if (ctx.args.empty()) {
ctx.reply("Usage: search <query>\nExample: search "
"never gonna give you up");
ctx.reply(std::format("Usage: {} <query>", label()));
return;
}
auto result = manager->search(ctx.args);
auto result = manager->search(ctx.args, scope());
if (!result) {
Void::Log::error("SearchCommand", "{}",
std::format("Search failed for '{}': {}", ctx.args,
@@ -67,7 +69,7 @@ namespace Echoion::Core
// duration: TeamSpeak parses [..] as a link reference).
msg << std::format(
"{}. {}", i + 1,
markdownLink(displayText, track.shortenedUrl));
markdownLink(displayText, trackLinkUrl(track)));
if (track.duration.has_value()) {
msg << " " << kDot << " "
<< formatDuration(*track.duration);
@@ -82,28 +84,23 @@ namespace Echoion::Core
ctx.reply(msg.str());
} catch (const std::exception& e) {
Void::Log::error("SearchCommand", "{}",
Void::Log::error("SearchCommand", "{}",
std::format("Search command exception: {}", e.what()));
ctx.reply("Something went wrong. Please try again.");
}
}
std::string_view getDescription() const override
{
return "Searches for tracks and shows results.";
}
std::string_view getUsage() const override { return "<query>"; }
CommandCategory getCategory() const override
{
return CommandCategory::Music;
return CommandCategory::Search;
}
std::vector<std::string_view> getAliases() const override
{
return {"find", "s"};
}
protected:
// The catalog(s) this command searches, and the command name
// used in usage text.
[[nodiscard]] virtual MusicManager::SearchScope scope() const = 0;
[[nodiscard]] virtual std::string_view label() const = 0;
private:
@@ -122,4 +119,28 @@ namespace Echoion::Core
}
};
// !search — both YouTube and Yandex Music.
class SearchCommand : public SearchCommandBase
{
public:
std::string_view getDescription() const override
{
return "Search YouTube and Yandex Music for tracks.";
}
std::string_view getUsage() const override { return "<query>"; }
std::vector<std::string_view> getAliases() const override
{
return {"find", "s"};
}
protected:
MusicManager::SearchScope scope() const override
{
return MusicManager::SearchScope::All;
}
std::string_view label() const override { return "search"; }
};
} // namespace Echoion::Core
@@ -0,0 +1,55 @@
#pragma once
#include "Command.hpp"
#include <Database.hpp>
#include <format>
namespace Echoion::Core
{
// !stats — global playback statistics.
class StatsCommand : public Command
{
public:
void execute(const CommandContext& ctx) override
{
auto db = ctx.service<Api::Database>();
if (!db) {
ctx.reply("Statistics are unavailable (no database).");
return;
}
auto stats = db->getStatistics(0);
if (!stats) {
ctx.reply("Couldn't read playback statistics.");
return;
}
const auto totalMinutes =
stats->totalPlaytimeMs / 1000 / 60;
std::string msg = std::format(
"\xf0\x9f\x93\x8a Plays: {} {} Unique tracks: {} {} "
"Playtime: {}h {}m",
stats->totalPlays, kDot, stats->totalTracks, kDot,
totalMinutes / 60, totalMinutes % 60);
if (stats->mostPlayedTrack) {
msg += std::format("\nMost played: {} ({}x)",
trackLink(*stats->mostPlayedTrack),
stats->mostPlayedCount);
}
ctx.reply(msg);
}
std::string_view getDescription() const override
{
return "Show playback statistics";
}
CommandCategory getCategory() const override
{
return CommandCategory::Utility;
}
};
} // namespace Echoion::Core
@@ -0,0 +1,35 @@
#pragma once
#include "PlayCommand.hpp"
namespace Echoion::Core
{
// !pya / !playya — play from Yandex Music only.
class YandexPlayCommand : public PlayCommandBase
{
public:
std::string_view getDescription() const override
{
return "Plays from Yandex Music only (URL or search).";
}
std::string_view getUsage() const override
{
return "<url or search query>";
}
std::vector<std::string_view> getAliases() const override
{
return {"playya"};
}
protected:
MusicManager::SearchScope scope() const override
{
return MusicManager::SearchScope::Yandex;
}
std::string_view label() const override { return "pya"; }
};
} // namespace Echoion::Core
@@ -0,0 +1,32 @@
#pragma once
#include "SearchCommand.hpp"
namespace Echoion::Core
{
// !yandex / !ya — search Yandex Music only.
class YandexSearchCommand : public SearchCommandBase
{
public:
std::string_view getDescription() const override
{
return "Search Yandex Music only for tracks.";
}
std::string_view getUsage() const override { return "<query>"; }
std::vector<std::string_view> getAliases() const override
{
return {"ya"};
}
protected:
MusicManager::SearchScope scope() const override
{
return MusicManager::SearchScope::Yandex;
}
std::string_view label() const override { return "yandex"; }
};
} // namespace Echoion::Core
@@ -0,0 +1,35 @@
#pragma once
#include "PlayCommand.hpp"
namespace Echoion::Core
{
// !pyt / !playyt — play from YouTube only.
class YoutubePlayCommand : public PlayCommandBase
{
public:
std::string_view getDescription() const override
{
return "Plays from YouTube only (URL or search).";
}
std::string_view getUsage() const override
{
return "<url or search query>";
}
std::vector<std::string_view> getAliases() const override
{
return {"playyt"};
}
protected:
MusicManager::SearchScope scope() const override
{
return MusicManager::SearchScope::YouTube;
}
std::string_view label() const override { return "pyt"; }
};
} // namespace Echoion::Core
@@ -0,0 +1,32 @@
#pragma once
#include "SearchCommand.hpp"
namespace Echoion::Core
{
// !youtube / !yb — search YouTube only.
class YoutubeSearchCommand : public SearchCommandBase
{
public:
std::string_view getDescription() const override
{
return "Search YouTube only for tracks.";
}
std::string_view getUsage() const override { return "<query>"; }
std::vector<std::string_view> getAliases() const override
{
return {"yb", "yt"};
}
protected:
MusicManager::SearchScope scope() const override
{
return MusicManager::SearchScope::YouTube;
}
std::string_view label() const override { return "youtube"; }
};
} // namespace Echoion::Core