02 - 01 - 02
Build / Build (push) Failing after 34s

This commit is contained in:
2026-09-24 10:34:56 -04:00
parent 82005881c7
commit 686fe4247c
@@ -1,6 +1,37 @@
#include <cluster.h>
#include <dispatcher.h>
#include <dotenv.h>
#include <exception.h>
#include <iostream>
int main() {
std::cout << "WIP" << std::endl;
// Load the .env file into the environment
dotenv::init();
// Make sure the DISCORD_TOKEN env var exists
if (!std::getenv("DISCORD_TOKEN") || !std::getenv("DISCORD_GUILD")) {
std::cout << "Failed to get DISCORD_TOKEN or DISCORD_GUILD from .env or environment" << std::endl;
return 0;
}
// Load in the bot token
std::string botToken = std::getenv("DISCORD_TOKEN");
// Load in the guild id
std::string guildId = std::getenv("DISCORD_GUILD");
// Create the bot
dpp::cluster bot(botToken);
// Register a cout_logger
bot.on_log(dpp::utility::cout_logger());
// Create a lambda to be called when the bot is ready
bot.on_ready([&bot, &guildId](const dpp::ready_t& event) {
// Bulk delete any globally registered commands
bot.global_bulk_command_delete();
// Bulk delete any guild commands registered to the passed in guild id
bot.guild_bulk_command_delete(guildId);
});
// Start the bot
bot.start(dpp::st_wait);
return 0;
}