droplet 1.3.0
A multipurpose Discord bot with the hacker in mind
Loading...
Searching...
No Matches
Bot.hpp
Go to the documentation of this file.
1/*
2 * (c) Copyright erarnitox.de - All rights reserved
3 * Author: Erarnitox <david@erarnitox.de>
4 *
5 * License: MIT License
6 *
7 * Description: This class handles the execution of the
8 * bot and delegats events to registerd commands.
9 *
10 * Documentation: https://droplet.erarnitox.de/doxygen/html/
11 */
12
13#pragma once
14
15#include <Core.hpp>
16#include <IButtonCommand.hpp>
17#include <IFormCommand.hpp>
19#include <IMemberCommand.hpp>
20#include <IMessageCommand.hpp>
21#include <IReactionCommand.hpp>
22#include <IReady.hpp>
23#include <memory>
24#include <string>
25#include <vector>
26
27using ctx_t = std::unique_ptr<dpp::cluster>;
28using slash_commands_t = std::map<std::string, std::shared_ptr<IGlobalSlashCommand>>;
29using button_commands_t = std::vector<std::shared_ptr<IButtonCommand>>;
30using form_commands_t = std::vector<std::shared_ptr<IFormCommand>>;
31using member_commands_t = std::vector<std::shared_ptr<IMemberCommand>>;
32using message_commands_t = std::vector<std::shared_ptr<IMessageCommand>>;
33using reaction_commands_t = std::vector<std::shared_ptr<IReactionCommand>>;
34using ready_commands_t = std::vector<std::shared_ptr<IReady>>;
35
36class Bot {
37 public:
38 static ctx_t ctx;
46
47 public:
48 static void init(const std::string& token);
49 static void add_slash_command(const std::shared_ptr<IGlobalSlashCommand>& slash_command);
50 static void add_button_command(const std::shared_ptr<IButtonCommand>& button_command);
51 static void add_form_command(const std::shared_ptr<IFormCommand>& form_command);
52 static void add_member_command(const std::shared_ptr<IMemberCommand>& button_command);
53 static void add_message_command(const std::shared_ptr<IMessageCommand>& button_command);
54 static void add_reaction_command(const std::shared_ptr<IReactionCommand>& button_command);
55 static void add_ready_command(const std::shared_ptr<IReady>& ready_command);
56 static void run();
57};
std::vector< std::shared_ptr< IFormCommand > > form_commands_t
Definition Bot.hpp:30
std::vector< std::shared_ptr< IButtonCommand > > button_commands_t
Definition Bot.hpp:29
std::map< std::string, std::shared_ptr< IGlobalSlashCommand > > slash_commands_t
Definition Bot.hpp:28
std::unique_ptr< dpp::cluster > ctx_t
Definition Bot.hpp:27
std::vector< std::shared_ptr< IReactionCommand > > reaction_commands_t
Definition Bot.hpp:33
std::vector< std::shared_ptr< IMessageCommand > > message_commands_t
Definition Bot.hpp:32
std::vector< std::shared_ptr< IReady > > ready_commands_t
Definition Bot.hpp:34
std::vector< std::shared_ptr< IMemberCommand > > member_commands_t
Definition Bot.hpp:31
Definition Bot.hpp:36
static void add_slash_command(const std::shared_ptr< IGlobalSlashCommand > &slash_command)
registers new slash commands with the bot
Definition Bot.cpp:57
static slash_commands_t slash_commands
Definition Bot.hpp:41
static void add_message_command(const std::shared_ptr< IMessageCommand > &button_command)
registers new message commands with the bot
Definition Bot.cpp:93
static ctx_t ctx
Definition Bot.hpp:38
static void add_member_command(const std::shared_ptr< IMemberCommand > &button_command)
registers new member commands with the bot
Definition Bot.cpp:84
static void add_reaction_command(const std::shared_ptr< IReactionCommand > &button_command)
registers new reaction commands with the bot
Definition Bot.cpp:102
static form_commands_t form_commands
Definition Bot.hpp:40
static void add_form_command(const std::shared_ptr< IFormCommand > &form_command)
registers new form commands with the bot
Definition Bot.cpp:75
static reaction_commands_t reaction_commands
Definition Bot.hpp:44
static member_commands_t member_commands
Definition Bot.hpp:42
static void init(const std::string &token)
initializes our bot and sets the bot token
Definition Bot.cpp:39
static void add_button_command(const std::shared_ptr< IButtonCommand > &button_command)
registers new button commands with the bot
Definition Bot.cpp:66
static void run()
registeres all callbacks and starts the bot
Definition Bot.cpp:402
static message_commands_t message_commands
Definition Bot.hpp:43
static button_commands_t button_commands
Definition Bot.hpp:39
static void add_ready_command(const std::shared_ptr< IReady > &ready_command)
registers new ready commands with the bot
Definition Bot.cpp:111
static ready_commands_t ready_commands
Definition Bot.hpp:45