2024-03-30 22:44:52 -03:00
|
|
|
// SPDX-FileCopyrightText: 2024 Yury Gubich <blue@macaw.me>
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
#include "jay.h"
|
|
|
|
#include "logger.h"
|
|
|
|
|
|
|
|
#include <string>
|
2025-02-21 23:01:11 +02:00
|
|
|
#include <sstream>
|
2024-03-30 22:44:52 -03:00
|
|
|
#include <iostream>
|
|
|
|
|
2025-02-21 23:01:11 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2025-02-22 21:03:21 +02:00
|
|
|
int main(int argc, char* argv[]) {
|
|
|
|
if (argc < 2) {
|
|
|
|
std::cerr << "Usage: " << argv[0] << " <config.yaml>" << std::endl;
|
|
|
|
return EXIT_FAILURE;
|
2025-02-21 23:01:11 +02:00
|
|
|
}
|
2024-03-30 22:44:52 -03:00
|
|
|
|
2025-02-22 21:03:21 +02:00
|
|
|
Jay bot(argv[1]);
|
|
|
|
if (!bot.isConfigValid()) {
|
|
|
|
std::cerr << "Invalid config, can not proceed, quitting" << std::endl;
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2025-02-21 23:01:11 +02:00
|
|
|
|
2024-03-30 22:44:52 -03:00
|
|
|
bot.run();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|