diff options
| author | ilotterytea <iltsu@alright.party> | 2024-05-08 22:05:21 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-05-08 22:05:21 +0500 |
| commit | 3a1e75ab3767139de0f381a04c44e92bb0d947de (patch) | |
| tree | 9de712a1ce2d5ddefed6037b7fba03587aca30ec /src | |
| parent | 08714a202d0eff3dfd31a4b0dd7f3311b0fd3f0e (diff) | |
feat: new placeholder
Diffstat (limited to 'src')
| -rw-r--r-- | src/config.cpp | 8 | ||||
| -rw-r--r-- | src/config.hpp | 6 | ||||
| -rw-r--r-- | src/localization/localization.cpp | 2 |
3 files changed, 15 insertions, 1 deletions
diff --git a/src/config.cpp b/src/config.cpp index 3af6e24..d5a3f1d 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -21,6 +21,7 @@ namespace bot { Configuration cfg; TwitchCredentialsConfiguration ttv_crd_cfg; DatabaseConfiguration db_cfg; + CommandConfiguration cmd_cfg; std::string line; while (std::getline(ifs, line, '\n')) { @@ -50,8 +51,15 @@ namespace bot { } else if (key == "db_port") { db_cfg.port = value; } + + else if (key == "commands.join_allowed") { + cmd_cfg.join_allowed = std::stoi(value); + } else if (key == "commands.join_allow_from_other_chats") { + cmd_cfg.join_allow_from_other_chats = std::stoi(value); + } } + 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 584fb09..69b906d 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -22,9 +22,15 @@ namespace bot { std::string token; }; + struct CommandConfiguration { + bool join_allowed = true; + bool join_allow_from_other_chats = false; + }; + struct Configuration { TwitchCredentialsConfiguration twitch_credentials; DatabaseConfiguration database; + CommandConfiguration commands; }; std::optional<Configuration> parse_configuration_from_file( diff --git a/src/localization/localization.cpp b/src/localization/localization.cpp index 9ac714f..2742602 100644 --- a/src/localization/localization.cpp +++ b/src/localization/localization.cpp @@ -115,7 +115,7 @@ namespace bot { std::map<std::string, std::string> token_map = { {"{sender.alias_name}", request.user.get_alias_name()}, {"{source.alias_name}", request.channel.get_alias_name()}, - }; + {"{default.prefix}", DEFAULT_PREFIX}}; for (const auto &pair : token_map) { int pos = line.find(pair.first); |
