diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-02-03 13:56:19 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-02-03 13:56:19 -0500 |
commit | 18742d79e1de863889521c492e938491489316fe (patch) | |
tree | 9930ef168c81c01e1c947b47d697d494aa7ca0f2 /main.cpp | |
download | advice-18742d79e1de863889521c492e938491489316fe.tar.gz advice-18742d79e1de863889521c492e938491489316fe.tar.bz2 advice-18742d79e1de863889521c492e938491489316fe.zip |
Created bot
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..3661105 --- /dev/null +++ b/main.cpp | |||
@@ -0,0 +1,33 @@ | |||
1 | #include "advice.h" | ||
2 | |||
3 | int main(int argc, char** argv) | ||
4 | { | ||
5 | Magick::InitializeMagick(nullptr); | ||
6 | |||
7 | std::random_device random_device; | ||
8 | std::mt19937 random_engine{random_device()}; | ||
9 | |||
10 | if (argc != 2) | ||
11 | { | ||
12 | std::cout << "usage: advice [configfile]" << std::endl; | ||
13 | return -1; | ||
14 | } | ||
15 | |||
16 | std::string configfile(argv[1]); | ||
17 | |||
18 | try | ||
19 | { | ||
20 | advice bot(configfile, random_engine); | ||
21 | |||
22 | try | ||
23 | { | ||
24 | bot.run(); | ||
25 | } catch (const std::exception& ex) | ||
26 | { | ||
27 | std::cout << "Error running bot: " << ex.what() << std::endl; | ||
28 | } | ||
29 | } catch (const std::exception& ex) | ||
30 | { | ||
31 | std::cout << "Error initializing bot: " << ex.what() << std::endl; | ||
32 | } | ||
33 | } | ||