droplet 1.1.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 dropsoft.org - 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.dropsoft.org/doxygen/html/bot
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 <map>
24#include <memory>
25#include <string>
26#include <vector>
27
28using ctx_t = std::unique_ptr<dpp::cluster>;
29using slash_commands_t = std::map<std::string, std::shared_ptr<IGlobalSlashCommand>>;
30using button_commands_t = std::vector<std::shared_ptr<IButtonCommand>>;
31using form_commands_t = std::vector<std::shared_ptr<IFormCommand>>;
32using member_commands_t = std::vector<std::shared_ptr<IMemberCommand>>;
33using message_commands_t = std::vector<std::shared_ptr<IMessageCommand>>;
34using reaction_commands_t = std::vector<std::shared_ptr<IReactionCommand>>;
35using ready_commands_t = std::vector<std::shared_ptr<IReady>>;
36
37class Bot {
38 public:
39 static ctx_t ctx;
47
48 public:
49 static void init(const std::string& token);
50 static void add_slash_command(const std::shared_ptr<IGlobalSlashCommand>& slash_command);
51 static void add_button_command(const std::shared_ptr<IButtonCommand>& button_command);
52 static void add_form_command(const std::shared_ptr<IFormCommand>& form_command);
53 static void add_member_command(const std::shared_ptr<IMemberCommand>& button_command);
54 static void add_message_command(const std::shared_ptr<IMessageCommand>& button_command);
55 static void add_reaction_command(const std::shared_ptr<IReactionCommand>& button_command);
56 static void add_ready_command(const std::shared_ptr<IReady>& ready_command);
57 static void run();
58};
std::vector< std::shared_ptr< IFormCommand > > form_commands_t
Definition Bot.hpp:31
std::vector< std::shared_ptr< IButtonCommand > > button_commands_t
Definition Bot.hpp:30
std::map< std::string, std::shared_ptr< IGlobalSlashCommand > > slash_commands_t
Definition Bot.hpp:29
std::unique_ptr< dpp::cluster > ctx_t
Definition Bot.hpp:28
std::vector< std::shared_ptr< IReactionCommand > > reaction_commands_t
Definition Bot.hpp:34
std::vector< std::shared_ptr< IMessageCommand > > message_commands_t
Definition Bot.hpp:33
std::vector< std::shared_ptr< IReady > > ready_commands_t
Definition Bot.hpp:35
std::vector< std::shared_ptr< IMemberCommand > > member_commands_t
Definition Bot.hpp:32
Definition Bot.hpp:37
static void add_slash_command(const std::shared_ptr< IGlobalSlashCommand > &slash_command)
registers new slash commands with the bot
Definition Bot.cpp:59
static slash_commands_t slash_commands
Definition Bot.hpp:42
static void add_message_command(const std::shared_ptr< IMessageCommand > &button_command)
registers new message commands with the bot
Definition Bot.cpp:99
static ctx_t ctx
Definition Bot.hpp:39
static void add_member_command(const std::shared_ptr< IMemberCommand > &button_command)
registers new member commands with the bot
Definition Bot.cpp:89
static void add_reaction_command(const std::shared_ptr< IReactionCommand > &button_command)
registers new reaction commands with the bot
Definition Bot.cpp:109
static form_commands_t form_commands
Definition Bot.hpp:41
static void add_form_command(const std::shared_ptr< IFormCommand > &form_command)
registers new form commands with the bot
Definition Bot.cpp:79
static reaction_commands_t reaction_commands
Definition Bot.hpp:45
static member_commands_t member_commands
Definition Bot.hpp:43
static void init(const std::string &token)
initializes our bot and sets the bot token
Definition Bot.cpp:40
static void add_button_command(const std::shared_ptr< IButtonCommand > &button_command)
registers new button commands with the bot
Definition Bot.cpp:69
static void run()
registeres all callbacks and starts the bot
Definition Bot.cpp:425
static message_commands_t message_commands
Definition Bot.hpp:44
static button_commands_t button_commands
Definition Bot.hpp:40
static void add_ready_command(const std::shared_ptr< IReady > &ready_command)
registers new ready commands with the bot
Definition Bot.cpp:119
static ready_commands_t ready_commands
Definition Bot.hpp:46