summary refs log tree commit diff stats
path: root/main.cpp
blob: 36611059b88d393ed84942e4fa16400025f920d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "advice.h"

int main(int argc, char** argv)
{
  Magick::InitializeMagick(nullptr);

  std::random_device random_device;
  std::mt19937 random_engine{random_device()};

  if (argc != 2)
  {
    std::cout << "usage: advice [configfile]" << std::endl;
    return -1;
  }

  std::string configfile(argv[1]);

  try
  {
    advice bot(configfile, random_engine);

    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;
  }
}