mirror of
https://github.com/HappyTanuki/BumbleCee.git
synced 2025-12-17 04:53:27 +00:00
완성?
This commit is contained in:
39
src/Commands/Delete.cpp
Normal file
39
src/Commands/Delete.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include <Commands/Delete.hpp>
|
||||
#include <iostream>
|
||||
|
||||
namespace Commands {
|
||||
Delete::Delete(std::shared_ptr<BumbleCeepp> Bot) {
|
||||
this->Bot = Bot;
|
||||
|
||||
dpp::slashcommand Command = dpp::slashcommand("d", "큐의 해당하는 번호의 노래를 지웁니다", Bot->BotCluster->me.id);
|
||||
|
||||
Command.add_option(
|
||||
dpp::command_option(dpp::co_string, "pos", "큐 번호", Bot->BotCluster->me.id)
|
||||
);
|
||||
|
||||
CommandObjectVector.push_back(Command);
|
||||
}
|
||||
|
||||
void Delete::operator()(std::list<FQueueElement>& MusicQueue, const dpp::slashcommand_t& Event) {
|
||||
std::string Pos = std::get<std::string>(Event.get_parameter("pos"));
|
||||
if (!atoi(Pos.c_str())) {
|
||||
dpp::message msg(Event.command.channel_id, "현재 재생중인 곡은 삭제할 수 없습니다!");
|
||||
Event.reply(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
auto PopedElement = Bot->QueueDelete(atoi(Pos.c_str()));
|
||||
|
||||
dpp::embed embed = dpp::embed()
|
||||
.set_title(PopedElement.title)
|
||||
.set_description(PopedElement.description)
|
||||
.set_color(dpp::colors::sti_blue)
|
||||
.set_image(PopedElement.thumbnail)
|
||||
.set_timestamp(time(0));
|
||||
|
||||
dpp::message msg(Event.command.channel_id, "다음 항목을 큐에서 삭제했습니다!:");
|
||||
msg.add_embed(embed);
|
||||
|
||||
Event.reply(msg);
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,9 @@ namespace Commands {
|
||||
Leave::Leave(std::shared_ptr<BumbleCeepp> Bot) {
|
||||
this->Bot = Bot;
|
||||
|
||||
dpp::slashcommand Command = dpp::slashcommand("leave", "음챗을 떠납니다", Bot->BotCluster->me.id);
|
||||
dpp::slashcommand Alias = dpp::slashcommand("l", "음챗을 떠납니다", Bot->BotCluster->me.id);
|
||||
dpp::slashcommand Command = dpp::slashcommand("l", "음챗을 떠납니다", Bot->BotCluster->me.id);
|
||||
|
||||
CommandObjectVector.push_back(Command);
|
||||
CommandObjectVector.push_back(Alias);
|
||||
}
|
||||
|
||||
void Leave::operator()(std::list<FQueueElement>& MusicQueue, const dpp::slashcommand_t& Event) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// #include <Python.h>
|
||||
#include <Commands/Play.hpp>
|
||||
#include <dpp/dpp.h>
|
||||
#include <dpp/nlohmann/json.hpp>
|
||||
@@ -11,20 +10,13 @@ namespace Commands {
|
||||
Play::Play(std::shared_ptr<BumbleCeepp> Bot) {
|
||||
this->Bot = Bot;
|
||||
|
||||
dpp::slashcommand Command = dpp::slashcommand("play", "노래 재생", Bot->BotCluster->me.id);
|
||||
dpp::slashcommand Command = dpp::slashcommand("p", "노래 재생", Bot->BotCluster->me.id);
|
||||
|
||||
Command.add_option(
|
||||
dpp::command_option(dpp::co_string, "query", "링크 또는 검색어", Bot->BotCluster->me.id)
|
||||
);
|
||||
|
||||
dpp::slashcommand Alias = dpp::slashcommand("p", "노래 재생", Bot->BotCluster->me.id);
|
||||
|
||||
Alias.add_option(
|
||||
dpp::command_option(dpp::co_string, "query", "링크 또는 검색어", Bot->BotCluster->me.id)
|
||||
);
|
||||
|
||||
CommandObjectVector.push_back(Command);
|
||||
CommandObjectVector.push_back(Alias);
|
||||
}
|
||||
|
||||
void Play::operator()(std::list<FQueueElement>& MusicQueue, const dpp::slashcommand_t& Event) {
|
||||
|
||||
@@ -5,26 +5,69 @@ namespace Commands {
|
||||
Queue::Queue(std::shared_ptr<BumbleCeepp> Bot) {
|
||||
this->Bot = Bot;
|
||||
|
||||
dpp::slashcommand Command = dpp::slashcommand("queue", "노래 예약 큐 확인", Bot->BotCluster->me.id);
|
||||
dpp::slashcommand Alias = dpp::slashcommand("q", "노래 예약 큐 확인", Bot->BotCluster->me.id);
|
||||
dpp::slashcommand Command = dpp::slashcommand("q", "노래 예약 큐 확인", Bot->BotCluster->me.id);
|
||||
|
||||
CommandObjectVector.push_back(Command);
|
||||
CommandObjectVector.push_back(Alias);
|
||||
}
|
||||
|
||||
void Queue::operator()(std::list<FQueueElement>& MusicQueue, const dpp::slashcommand_t& Event) {
|
||||
if (MusicQueue.empty()) {
|
||||
dpp::embed embed = dpp::embed()
|
||||
.set_title("큐가 비었습니다!")
|
||||
.set_color(dpp::colors::sti_blue)
|
||||
.set_timestamp(time(0));
|
||||
|
||||
if (Bot->Repeat)
|
||||
embed.add_field(":repeat:","");
|
||||
|
||||
dpp::message msg(Event.command.channel_id, "현재 큐에 있는 항목:");
|
||||
msg.add_embed(embed);
|
||||
|
||||
Event.reply(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
dpp::embed embed = dpp::embed()
|
||||
.set_title("큐 항목:")
|
||||
.set_color(dpp::colors::sti_blue)
|
||||
.set_timestamp(time(0));
|
||||
|
||||
int i = 0;
|
||||
char number[30] = {0, };
|
||||
|
||||
for (auto iter = MusicQueue.begin(); iter != MusicQueue.end(); iter++) {
|
||||
if (!i) {
|
||||
embed.add_field(
|
||||
"현재 재생 중",
|
||||
"",
|
||||
true
|
||||
);
|
||||
}
|
||||
else {
|
||||
sprintf(number, "%d", i);
|
||||
embed.add_field(
|
||||
number,
|
||||
"",
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
embed.add_field(
|
||||
iter->title,
|
||||
iter->description
|
||||
iter->description,
|
||||
true
|
||||
)
|
||||
.add_field(
|
||||
"",
|
||||
""
|
||||
);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
if (Bot->Repeat)
|
||||
embed.add_field(":repeat:","");
|
||||
|
||||
dpp::message msg(Event.command.channel_id, "현재 큐에 있는 항목:");
|
||||
msg.add_embed(embed);
|
||||
|
||||
|
||||
@@ -6,11 +6,9 @@ namespace Commands {
|
||||
Repeat::Repeat(std::shared_ptr<BumbleCeepp> Bot) {
|
||||
this->Bot = Bot;
|
||||
|
||||
dpp::slashcommand Command = dpp::slashcommand("repeat", "반복 켜기/끄기", Bot->BotCluster->me.id);
|
||||
dpp::slashcommand Alias = dpp::slashcommand("r", "반복 켜기/끄기", Bot->BotCluster->me.id);
|
||||
dpp::slashcommand Command = dpp::slashcommand("r", "반복 켜기/끄기", Bot->BotCluster->me.id);
|
||||
|
||||
CommandObjectVector.push_back(Command);
|
||||
CommandObjectVector.push_back(Alias);
|
||||
}
|
||||
|
||||
void Repeat::operator()(std::list<FQueueElement>& MusicQueue, const dpp::slashcommand_t& Event) {
|
||||
|
||||
@@ -6,11 +6,9 @@ namespace Commands {
|
||||
Skip::Skip(std::shared_ptr<BumbleCeepp> Bot) {
|
||||
this->Bot = Bot;
|
||||
|
||||
dpp::slashcommand Command = dpp::slashcommand("skip", "현재곡 스킵", Bot->BotCluster->me.id);
|
||||
dpp::slashcommand Alias = dpp::slashcommand("s", "현재곡 스킵", Bot->BotCluster->me.id);
|
||||
dpp::slashcommand Command = dpp::slashcommand("s", "현재곡 스킵", Bot->BotCluster->me.id);
|
||||
|
||||
CommandObjectVector.push_back(Command);
|
||||
CommandObjectVector.push_back(Alias);
|
||||
}
|
||||
|
||||
void Skip::operator()(std::list<FQueueElement>& MusicQueue, const dpp::slashcommand_t& Event) {
|
||||
|
||||
Reference in New Issue
Block a user