2024-02-22 16:09:56 -05:00
|
|
|
#include <iostream>
|
|
|
|
#include <dpp/dpp.h>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <blt/std/logging.h>
|
|
|
|
#include <blt/parse/argparse.h>
|
|
|
|
|
|
|
|
int main(int argc, const char** argv)
|
|
|
|
{
|
|
|
|
blt::arg_parse parser;
|
2024-02-22 16:22:48 -05:00
|
|
|
parser.addArgument(blt::arg_builder("-t", "--token").setDefault("uWU").setAction(blt::arg_action_t::STORE).setHelp("The discord bot token").setRequired().build());
|
|
|
|
|
|
|
|
// for (int i = 0; i < argc; i++)
|
|
|
|
// BLT_TRACE(argv[i]);
|
2024-02-22 16:09:56 -05:00
|
|
|
|
|
|
|
auto args = parser.parse_args(argc, argv);
|
|
|
|
|
2024-02-22 16:22:48 -05:00
|
|
|
BLT_TRACE(args.get<std::string>("--token"));
|
|
|
|
BLT_TRACE(argv[argc-1]);
|
|
|
|
dpp::cluster bot(argv[argc-1]);
|
2024-02-22 16:09:56 -05:00
|
|
|
|
|
|
|
bot.on_slashcommand([](auto event) {
|
2024-02-22 16:22:48 -05:00
|
|
|
if (event.command.get_command_name() == "ping")
|
|
|
|
{
|
2024-02-22 16:09:56 -05:00
|
|
|
event.reply("Pong!");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
bot.on_ready([&bot](auto event) {
|
2024-02-22 16:22:48 -05:00
|
|
|
if (dpp::run_once<struct register_bot_commands>())
|
|
|
|
{
|
2024-02-22 16:09:56 -05:00
|
|
|
bot.global_command_create(
|
|
|
|
dpp::slashcommand("ping", "Ping pong!", bot.me.id)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2024-02-22 16:22:48 -05:00
|
|
|
bot.on_message_create([&bot](auto event) {
|
|
|
|
BLT_TRACE("(%s)> %s", event.msg.author.username.c_str(), event.msg.content.c_str());
|
|
|
|
if (event.msg.author.username == "")
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2024-02-22 16:09:56 -05:00
|
|
|
bot.start(dpp::st_wait);
|
|
|
|
return 0;
|
|
|
|
std::cout << "Hello, World!" << std::endl;
|
|
|
|
return 0;
|
|
|
|
}
|