join, play 구현

This commit is contained in:
2023-12-12 22:20:01 +09:00
parent 8b0d0bbff7
commit b2f40f21cf
26 changed files with 526 additions and 108 deletions

View File

@@ -1,6 +0,0 @@
#include <Bot.hpp>
#include <iostream>
void IBot::test() {
std::cout << "작동함";
}

View File

@@ -1,9 +1,19 @@
#pragma once
#include "CommandType.hpp"
#include <dpp/dpp.h>
#include <memory>
class IBot{
class IBot {
private:
public:
void test();
IBot(std::string Token);
void AddCommand(ICommand &Command);
void Start();
std::shared_ptr<dpp::cluster> bot;
protected:
virtual void OnReady(const dpp::ready_t& event);
virtual void OnCommand(const dpp::slashcommand_t& event);
std::vector<ICommand*> CommandsArray;
};

View File

@@ -1,2 +0,0 @@
#include <BumbleCee.hpp>
#include <iostream>

View File

@@ -1,15 +0,0 @@
#pragma once
#include <Bot.hpp>
class BumbleCee : public IBot {
public:
static BumbleCee* getInstance() {
static BumbleCee instance;
return &instance;
}
protected:
private:
BumbleCee() {}
BumbleCee(const BumbleCee& ref) {}
~BumbleCee() {}
};

20
include/BumbleCeepp.hpp Normal file
View File

@@ -0,0 +1,20 @@
#pragma once
#include "Bot.hpp"
#include <string>
#include <list>
class BumbleCeepp : public IBot {
public:
static BumbleCeepp* GetInstance(std::string Token) {
static BumbleCeepp Instance(Token);
return &Instance;
}
void enqueue(std::string);
std::string dequeue();
protected:
std::list<std::string> MusicQueue;
private:
BumbleCeepp(std::string Token);
void OnCommand(const dpp::slashcommand_t& Event);
};

12
include/CommandType.hpp Normal file
View File

@@ -0,0 +1,12 @@
#pragma once
#include <dpp/dpp.h>
#include <vector>
#include <list>
class ICommand {
public:
virtual void operator() (const dpp::slashcommand_t& Event) = 0;
virtual void operator() (std::list<std::string>& MusicQueue, const dpp::slashcommand_t& Event) = 0;
std::vector<dpp::slashcommand> CommandObjectVector;
};

4
include/Commands.hpp Normal file
View File

@@ -0,0 +1,4 @@
#pragma once
#include "Commands/Play.hpp"
#include "Commands/Queue.hpp"
#include "Commands/Join.hpp"

10
include/Commands/Join.hpp Normal file
View File

@@ -0,0 +1,10 @@
#pragma once
#include "../CommandType.hpp"
class Join : public ICommand {
public:
Join(dpp::snowflake Id);
void operator()(const dpp::slashcommand_t& Event) {}
void operator()(std::list<std::string>& MusicQueue, const dpp::slashcommand_t& Event);
};

10
include/Commands/Play.hpp Normal file
View File

@@ -0,0 +1,10 @@
#pragma once
#include "../CommandType.hpp"
class Play : public ICommand {
public:
Play(dpp::snowflake Id);
void operator()(const dpp::slashcommand_t& Event) {}
void operator()(std::list<std::string>& MusicQueue, const dpp::slashcommand_t& Event);
};

View File

@@ -0,0 +1,10 @@
#pragma once
#include "../CommandType.hpp"
class Queue : public ICommand {
public:
Queue(dpp::snowflake Id);
void operator()(const dpp::slashcommand_t& Event) {}
void operator()(std::list<std::string>& MusicQueue, const dpp::slashcommand_t& Event);
};