ginore
parent
4a2807dfb3
commit
c251ef0c34
23
src/main.cpp
23
src/main.cpp
|
@ -7,26 +7,41 @@
|
||||||
int main(int argc, const char** argv)
|
int main(int argc, const char** argv)
|
||||||
{
|
{
|
||||||
blt::arg_parse parser;
|
blt::arg_parse parser;
|
||||||
parser.addArgument(blt::arg_builder("--token").setRequired().build());
|
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]);
|
||||||
|
|
||||||
auto args = parser.parse_args(argc, argv);
|
auto args = parser.parse_args(argc, argv);
|
||||||
|
|
||||||
dpp::cluster bot(args.get<std::string>("--token"));
|
BLT_TRACE(args.get<std::string>("--token"));
|
||||||
|
BLT_TRACE(argv[argc-1]);
|
||||||
|
dpp::cluster bot(argv[argc-1]);
|
||||||
|
|
||||||
bot.on_slashcommand([](auto event) {
|
bot.on_slashcommand([](auto event) {
|
||||||
if (event.command.get_command_name() == "ping") {
|
if (event.command.get_command_name() == "ping")
|
||||||
|
{
|
||||||
event.reply("Pong!");
|
event.reply("Pong!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bot.on_ready([&bot](auto event) {
|
bot.on_ready([&bot](auto event) {
|
||||||
if (dpp::run_once<struct register_bot_commands>()) {
|
if (dpp::run_once<struct register_bot_commands>())
|
||||||
|
{
|
||||||
bot.global_command_create(
|
bot.global_command_create(
|
||||||
dpp::slashcommand("ping", "Ping pong!", bot.me.id)
|
dpp::slashcommand("ping", "Ping pong!", bot.me.id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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 == "")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
bot.start(dpp::st_wait);
|
bot.start(dpp::st_wait);
|
||||||
return 0;
|
return 0;
|
||||||
std::cout << "Hello, World!" << std::endl;
|
std::cout << "Hello, World!" << std::endl;
|
||||||
|
|
Loading…
Reference in New Issue