summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2024-05-06 00:43:06 +0500
committerilotterytea <iltsu@alright.party>2024-05-06 00:43:06 +0500
commit28a63d9819c05d2576355117e54acc3f466bf926 (patch)
tree979a4e286f699412032be099ca3f4425b650f435
parent84bb9ad288d88ce4777137be402ecddf6c3f9a0e (diff)
feat: method for converting strings to event types
-rw-r--r--src/schemas/stream.cpp17
-rw-r--r--src/schemas/stream.hpp5
2 files changed, 22 insertions, 0 deletions
diff --git a/src/schemas/stream.cpp b/src/schemas/stream.cpp
new file mode 100644
index 0000000..6ef10dc
--- /dev/null
+++ b/src/schemas/stream.cpp
@@ -0,0 +1,17 @@
+#include "stream.hpp"
+
+namespace bot::schemas {
+ EventType string_to_event_type(const std::string &type) {
+ if (type == "live") {
+ return EventType::LIVE;
+ } else if (type == "offline") {
+ return EventType::OFFLINE;
+ } else if (type == "title") {
+ return EventType::TITLE;
+ } else if (type == "game") {
+ return EventType::GAME;
+ } else {
+ return EventType::CUSTOM;
+ }
+ }
+}
diff --git a/src/schemas/stream.hpp b/src/schemas/stream.hpp
index bfb60b5..a636ea5 100644
--- a/src/schemas/stream.hpp
+++ b/src/schemas/stream.hpp
@@ -1,6 +1,11 @@
#pragma once
+#include <string>
+
namespace bot::schemas {
enum EventType { LIVE, OFFLINE, TITLE, GAME, CUSTOM = 99 };
+ EventType string_to_event_type(const std::string &type);
+
enum EventFlag { MASSPING };
+
}