summaryrefslogtreecommitdiff
path: root/bot/src/commands/response.cpp
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2024-12-07 17:24:25 +0500
committerilotterytea <iltsu@alright.party>2024-12-07 17:24:25 +0500
commit52fd4ea8bad5cd7d3940a41df4f8f54b4e72beae (patch)
tree28f13892e7da8ec023f4b4d1113bef88795724ca /bot/src/commands/response.cpp
parente604d12282b8fa9f9023bb79161b36c9a8b0be55 (diff)
feat: a special class for command responses
Diffstat (limited to 'bot/src/commands/response.cpp')
-rw-r--r--bot/src/commands/response.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/bot/src/commands/response.cpp b/bot/src/commands/response.cpp
new file mode 100644
index 0000000..cf13009
--- /dev/null
+++ b/bot/src/commands/response.cpp
@@ -0,0 +1,40 @@
+#include "response.hpp"
+
+#include <optional>
+#include <string>
+#include <vector>
+
+namespace bot::command {
+ Response::Response() {
+ this->single = std::nullopt;
+ this->multiple = std::nullopt;
+ }
+
+ Response::Response(std::string single) {
+ this->single = single;
+ this->multiple = std::nullopt;
+ }
+
+ Response::Response(std::vector<std::string> multiple) {
+ this->single = std::nullopt;
+ this->multiple = multiple;
+ }
+
+ const std::string Response::get_single() const {
+ return this->single.value();
+ }
+
+ const std::vector<std::string> Response::get_multiple() const {
+ return this->multiple.value();
+ }
+
+ const bool Response::is_single() const { return this->single.has_value(); }
+
+ const bool Response::is_multiple() const {
+ return this->multiple.has_value();
+ }
+
+ const bool Response::is_empty() const {
+ return !this->single.has_value() && !this->multiple.has_value();
+ }
+} \ No newline at end of file