summaryrefslogtreecommitdiff
path: root/bot
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-04-10 21:59:10 +0500
committerilotterytea <iltsu@alright.party>2025-04-10 21:59:10 +0500
commit50d5c3d36c8f00e9d59073c3a0c710de805ead4e (patch)
treed202e70827652444b248607c8b28a78e94063dd3 /bot
parent5c2cd6d3e293dc524415893cb1b8950193dce3e2 (diff)
feat: !randompost command
Diffstat (limited to 'bot')
-rw-r--r--bot/src/config.cpp14
-rw-r--r--bot/src/config.hpp4
2 files changed, 18 insertions, 0 deletions
diff --git a/bot/src/config.cpp b/bot/src/config.cpp
index 010a0ec..714ff56 100644
--- a/bot/src/config.cpp
+++ b/bot/src/config.cpp
@@ -20,6 +20,11 @@ namespace bot {
cmds["join_allowed"] = this->commands.join_allowed;
cmds["join_allow_from_other_chats"] =
this->commands.join_allow_from_other_chats;
+ if (this->commands.rpost_path.has_value()) {
+ cmds["rpost_path"] = this->commands.rpost_path.value();
+ } else {
+ cmds["rpost_path"] = sol::nil;
+ }
o["commands"] = cmds;
// --- OWNER
@@ -48,6 +53,11 @@ namespace bot {
} else {
url["paste_service"] = sol::nil;
}
+ if (this->url.randompost.has_value()) {
+ url["randompost"] = this->url.randompost.value();
+ } else {
+ url["randompost"] = sol::nil;
+ }
o["url"] = url;
return o;
@@ -103,6 +113,8 @@ namespace bot {
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);
+ } else if (key == "commands.randompost.path") {
+ cmd_cfg.rpost_path = value;
}
else if (key == "owner.name") {
@@ -115,6 +127,8 @@ namespace bot {
url_cfg.help = value;
} else if (key == "url.chatters.paste_service") {
url_cfg.paste_service = value;
+ } else if (key == "url.randompost") {
+ url_cfg.randompost = value;
}
else if (key == "token.github") {
diff --git a/bot/src/config.hpp b/bot/src/config.hpp
index 11493d7..05ce0f0 100644
--- a/bot/src/config.hpp
+++ b/bot/src/config.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <optional>
+#include <sol/sol.hpp>
#include <string>
#define GET_DATABASE_CONNECTION_URL(c) \
@@ -30,6 +31,8 @@ namespace bot {
struct CommandConfiguration {
bool join_allowed = true;
bool join_allow_from_other_chats = false;
+
+ std::optional<std::string> rpost_path = std::nullopt;
};
struct OwnerConfiguration {
@@ -40,6 +43,7 @@ namespace bot {
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 {