DiscordCoreAPI
A Discord bot library written in C++, with custom asynchronous coroutines.
Loading...
Searching...
No Matches
Listening for a Discord Event

/// main.cpp-main entry point.
/// https://github.com/RealTimeChris/DiscordCoreAPI
#include <index.hpp>
co_routine<void> onGuildCreation(on_guild_creation_data dataPackage) {
co_await newThreadAwaitable<void>();
std::cout << "guild_data name: " << dataPackage.guild_data.data.name << std::endl;
co_return;
}
int32_t main() {
jsonifier::string botToken {"YOUR_BOT_TOKEN_HERE"};
auto ptr = makeUnique<discord_core_client>(botToken, "!");
ptr->eventManager->onGuildCreation(&onGuildCreation);
ptr->runBot();
return 0;
}