diff options
| author | ilotterytea <iltsu@alright.party> | 2024-05-08 22:07:24 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-05-08 22:07:24 +0500 |
| commit | ef028f6535c8aac9367d2375cdd9556a1dcfe4f7 (patch) | |
| tree | 409c325a23e460af41c1c0a1177fb61a55be7d4c /src | |
| parent | 8c83c83184cc2daf5fb10bbcd01d92dee0bfbb26 (diff) | |
feat: owner configuration
Diffstat (limited to 'src')
| -rw-r--r-- | src/config.cpp | 8 | ||||
| -rw-r--r-- | src/config.hpp | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/config.cpp b/src/config.cpp index d5a3f1d..977b92c 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -22,6 +22,7 @@ namespace bot { TwitchCredentialsConfiguration ttv_crd_cfg; DatabaseConfiguration db_cfg; CommandConfiguration cmd_cfg; + OwnerConfiguration owner_cfg; std::string line; while (std::getline(ifs, line, '\n')) { @@ -57,8 +58,15 @@ namespace bot { } else if (key == "commands.join_allow_from_other_chats") { cmd_cfg.join_allow_from_other_chats = std::stoi(value); } + + else if (key == "owner.name") { + owner_cfg.name = value; + } else if (key == "owner.id") { + owner_cfg.id = std::stoi(value); + } } + cfg.owner = owner_cfg; cfg.commands = cmd_cfg; cfg.twitch_credentials = ttv_crd_cfg; cfg.database = db_cfg; diff --git a/src/config.hpp b/src/config.hpp index 69b906d..25519c3 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -27,10 +27,16 @@ namespace bot { bool join_allow_from_other_chats = false; }; + struct OwnerConfiguration { + std::optional<std::string> name = std::nullopt; + std::optional<int> id = std::nullopt; + }; + struct Configuration { TwitchCredentialsConfiguration twitch_credentials; DatabaseConfiguration database; CommandConfiguration commands; + OwnerConfiguration owner; }; std::optional<Configuration> parse_configuration_from_file( |
