mirror of
https://github.com/HappyTanuki/BumbleCee.git
synced 2025-10-26 09:55:14 +00:00
큐 완전 개혁
This commit is contained in:
@@ -2,25 +2,35 @@
|
||||
#include <dpp/dpp.h>
|
||||
#include <string>
|
||||
|
||||
namespace Commands {
|
||||
Repeat::Repeat(std::shared_ptr<BumbleCeepp> Bot) {
|
||||
this->Bot = Bot;
|
||||
commands::Repeat::Repeat(std::shared_ptr<dpp::cluster> botCluster, std::unordered_map<dpp::snowflake, std::shared_ptr<MusicQueue>> *queueMap)
|
||||
: ICommand(botCluster)
|
||||
{
|
||||
this->queueMap = queueMap;
|
||||
dpp::slashcommand command = dpp::slashcommand("r", "반복 켜기/끄기", botCluster->me.id);
|
||||
|
||||
dpp::slashcommand Command = dpp::slashcommand("r", "반복 켜기/끄기", Bot->BotCluster->me.id);
|
||||
commandObjectVector.push_back(command);
|
||||
}
|
||||
|
||||
CommandObjectVector.push_back(Command);
|
||||
void commands::Repeat::operator()(const dpp::slashcommand_t& event) {
|
||||
auto findResult = queueMap->find(event.command.guild_id);
|
||||
if (findResult == queueMap->end())
|
||||
{
|
||||
FMusicQueueID queueID;
|
||||
queueID.guild_id = event.command.guild_id;
|
||||
queueID.shard_id = event.from->shard_id;
|
||||
|
||||
(*queueMap)[queueID.guild_id] = std::make_shared<MusicQueue>(queueID);
|
||||
}
|
||||
std::shared_ptr<MusicQueue> queue = queueMap->find(event.command.guild_id)->second;
|
||||
|
||||
if (queue->repeat) {
|
||||
event.reply("반복을 껐습니다.");
|
||||
queue->repeat = false;
|
||||
}
|
||||
else {
|
||||
event.reply("반복을 켰습니다.");
|
||||
queue->repeat = true;
|
||||
}
|
||||
|
||||
void Repeat::operator()(std::list<FQueueElement>& MusicQueue, const dpp::slashcommand_t& Event) {
|
||||
if (Bot->Repeat) {
|
||||
Event.reply("반복을 껐습니다.");
|
||||
Bot->Repeat = false;
|
||||
}
|
||||
else {
|
||||
Event.reply("반복을 켰습니다.");
|
||||
Bot->Repeat = true;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
Reference in New Issue
Block a user