jay/main.cpp

34 lines
756 B
C++

// SPDX-FileCopyrightText: 2024 Yury Gubich <blue@macaw.me>
// SPDX-License-Identifier: GPL-3.0-or-later
#include "jay.h"
#include <string>
#include <sstream>
#include <iostream>
std::string readEnv(const std::string& key, const std::string& defaultValue = "") {
const char* val = std::getenv(key.data());
if (val)
return std::string(val);
return defaultValue;
}
int main(int argc, char* argv[]) {
if (argc < 2) {
std::cerr << "Usage: " << argv[0] << " <config.yaml>" << std::endl;
return EXIT_FAILURE;
}
Jay bot(argv[1]);
if (!bot.isConfigValid()) {
std::cerr << "Invalid config, can not proceed, quitting" << std::endl;
return EXIT_FAILURE;
}
bot.run();
return 0;
}