32 lines
920 B
C++
32 lines
920 B
C++
#include <dpp/dpp.h>
|
|
#include "listeners/ready.h"
|
|
#include "listeners/slash.h"
|
|
#include "listeners/global.h"
|
|
#include "api/config.h"
|
|
#include "api/util.h"
|
|
#include <mariadb/conncpp.hpp>
|
|
|
|
#define CONFIG_PATH "config.json"
|
|
|
|
using json = nlohmann::json;
|
|
|
|
using namespace dpp;
|
|
using namespace sql;
|
|
|
|
int main(int argc, char **argv) {
|
|
json configuration = config::read_config(argc < 2 ? CONFIG_PATH : argv[1]);
|
|
|
|
Connection *con = util::createConnection(configuration["database"]);
|
|
|
|
cluster bot(configuration["token"], dpp::i_default_intents | dpp::i_message_content);
|
|
|
|
bot.on_slashcommand([&bot, &con](const slashcommand_t &event) { slash::execute(*con, bot, event); });
|
|
|
|
bot.on_message_create([&bot, &con](const message_create_t &event) { global::execute(*con, bot, event); });
|
|
|
|
bot.on_ready([&bot](const ready_t &event) { ready::execute(bot, event); });
|
|
|
|
bot.start(dpp::st_wait);
|
|
|
|
return 0;
|
|
} |