Skip to content

Commit

Permalink
refactor: 👔 exit early if DISCORD_TOKEN is not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
Xminent committed Dec 11, 2023
1 parent 460ba0c commit 729e9ac
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
#include <iostream>
#include <saber/saber.hpp>

int main() {
auto saber = saber::Saber{std::getenv("DISCORD_TOKEN")};
const auto* token = std::getenv("DISCORD_TOKEN");

if (token == nullptr) {
std::cerr << "Missing DISCORD_TOKEN environment variable\n";
return 1;
}

auto saber = saber::Saber{token};

saber.run();
}

0 comments on commit 729e9ac

Please sign in to comment.