blob: 1a094630ea9fab261da64b6e05d96cc225168f2a (
plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
#pragma once
#include <optional>
#include <sol/sol.hpp>
#include <string>
#define GET_DATABASE_CONNECTION_URL(c) \
"dbname = " + c.database.name + " user = " + c.database.user + \
" password = " + c.database.password + " host = " + c.database.host + \
" port = " + c.database.port
#define GET_DATABASE_CONNECTION_URL_POINTER(c) \
"dbname = " + c->database.name + " user = " + c->database.user + \
" password = " + c->database.password + " host = " + c->database.host + \
" port = " + c->database.port
namespace bot {
struct DatabaseConfiguration {
std::string name;
std::string user;
std::string password;
std::string host;
std::string port;
};
struct TwitchCredentialsConfiguration {
std::string client_id;
std::string token;
};
struct KickCredentialsConfiguration {
std::string client_id, client_secret;
};
struct CommandConfiguration {
bool join_allowed = true;
bool join_allow_from_other_chats = false;
std::optional<std::string> rpost_path = std::nullopt;
std::optional<std::string> paste_path = std::nullopt;
std::string paste_body_name = "paste";
std::string paste_title_name = "title";
};
struct OwnerConfiguration {
std::optional<std::string> name = std::nullopt;
std::optional<int> id = std::nullopt;
};
struct UrlConfiguration {
std::optional<std::string> help = std::nullopt;
std::optional<std::string> paste_service = std::nullopt;
std::optional<std::string> randompost = std::nullopt;
};
struct TokenConfiguration {
std::optional<std::string> github_token = std::nullopt;
};
struct RssConfiguration {
std::optional<std::string> bridge = std::nullopt;
int timeout = 60;
};
struct Configuration {
TwitchCredentialsConfiguration twitch_credentials;
KickCredentialsConfiguration kick_credentials;
DatabaseConfiguration database;
CommandConfiguration commands;
OwnerConfiguration owner;
UrlConfiguration url;
TokenConfiguration tokens;
RssConfiguration rss;
sol::table as_lua_table(std::shared_ptr<sol::state> luaState) const;
};
std::optional<Configuration> parse_configuration_from_file(
const std::string& file_path);
}
|