From 25bc817bc4a68b81a0ff0c2485c2c903a8e3851f Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 25 Aug 2018 08:51:41 -0400 Subject: Created bot --- main.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 main.cpp (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..e1cdb8b --- /dev/null +++ b/main.cpp @@ -0,0 +1,38 @@ +#include "fanmail.h" +#include + +int main(int argc, char** argv) +{ + Magick::InitializeMagick(nullptr); + + std::random_device randomDevice; + std::mt19937 rng(randomDevice()); + + // We also have to seed the C-style RNG because librawr uses it. + srand(time(NULL)); + rand(); rand(); rand(); rand(); + + if (argc != 2) + { + std::cout << "usage: fanmail [configfile]" << std::endl; + return -1; + } + + std::string configfile(argv[1]); + + try + { + fanmail bot(configfile, rng); + + try + { + bot.run(); + } catch (const std::exception& ex) + { + std::cout << "Error running bot: " << ex.what() << std::endl; + } + } catch (const std::exception& ex) + { + std::cout << "Error initializing bot: " << ex.what() << std::endl; + } +} -- cgit 1.4.1