54 lines
1.4 KiB
C++
54 lines
1.4 KiB
C++
#include "../../languages/locale_en.hpp"
|
|
#include "../../token.h"
|
|
#include "../Commands.hpp"
|
|
#include "SQL.hpp"
|
|
|
|
#include <dpp/cluster.h>
|
|
#include <dpp/dispatcher.h>
|
|
#include <dpp/dpp.h>
|
|
#include <dpp/once.h>
|
|
#include <string>
|
|
|
|
int main(int argc, char **argv) {
|
|
// SQL database set up
|
|
sqlite3_open("discordServer.db", &database);
|
|
|
|
// Fuck dude capitalism 😔😔😔
|
|
execSQL("CREATE TABLE IF NOT EXISTS MONEY("
|
|
"UID INT PRIMARY KEY NOT NULL,"
|
|
"Cash INT NOT NULL DEFAULT 0)");
|
|
|
|
// Bot setup bullshit
|
|
dpp::cluster bot(TOKEN);
|
|
|
|
// Neat utility
|
|
bot.on_log(dpp::utility::cout_logger());
|
|
|
|
bot.on_slashcommand([](const dpp::slashcommand_t &event) {
|
|
auto command = Commands.find(event.command.get_command_name());
|
|
if (command != Commands.end()) {
|
|
command->second(event);
|
|
return;
|
|
}
|
|
event.reply("Could not find that command :(");
|
|
});
|
|
|
|
bot.on_ready([&bot](const dpp::ready_t &event) {
|
|
if (dpp::run_once<struct register_bot_commands>()) {
|
|
bot.global_command_create(
|
|
dpp::slashcommand("ping", "Ping-pong test", bot.me.id));
|
|
bot.guild_command_create(
|
|
dpp::slashcommand("balance", COMMAND_BALANCE_DESCRIPTION, bot.me.id),
|
|
GUILD);
|
|
}
|
|
|
|
if (dpp::run_once<struct clear_bot_commands>()) {
|
|
// bot.global_command_delete(1395839332220408051);
|
|
}
|
|
});
|
|
|
|
// Remove dpp::st_wait if you want it to return execution
|
|
// (so like async I assume?)
|
|
bot.start(dpp::st_wait);
|
|
}
|