From d8142b4e20408e403a8e2b5706ed954bff37102f Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Wed, 16 Apr 2025 23:05:57 +0500 Subject: feat: event_flag to string and backwards --- bot/src/schemas/stream.cpp | 16 ++++++++++++++++ bot/src/schemas/stream.hpp | 2 ++ 2 files changed, 18 insertions(+) diff --git a/bot/src/schemas/stream.cpp b/bot/src/schemas/stream.cpp index dbd5929..7671de5 100644 --- a/bot/src/schemas/stream.cpp +++ b/bot/src/schemas/stream.cpp @@ -32,4 +32,20 @@ namespace bot::schemas { return "custom"; } } + + std::optional string_to_event_flag(const std::string &type) { + if (type == "massping") { + return MASSPING; + } + + return std::nullopt; + } + + std::optional event_flag_to_string(const int &type) { + if (type == MASSPING) { + return "massping"; + } + + return std::nullopt; + } } diff --git a/bot/src/schemas/stream.hpp b/bot/src/schemas/stream.hpp index 9763ba9..5c90872 100644 --- a/bot/src/schemas/stream.hpp +++ b/bot/src/schemas/stream.hpp @@ -8,5 +8,7 @@ namespace bot::schemas { std::string event_type_to_string(const int &type); enum EventFlag { MASSPING }; + std::optional string_to_event_flag(const std::string &type); + std::optional event_flag_to_string(const int &type); } -- cgit v1.2.3