summaryrefslogtreecommitdiff
path: root/discord/json.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'discord/json.hpp')
-rw-r--r--discord/json.hpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/discord/json.hpp b/discord/json.hpp
new file mode 100644
index 0000000..1cd4a14
--- /dev/null
+++ b/discord/json.hpp
@@ -0,0 +1,23 @@
+#pragma once
+#include <nlohmann/json.hpp>
+
+#define JS_D(k, t) \
+ do { \
+ j.at(k).get_to(t); \
+ } while (0)
+
+#define JS_O(k, t) \
+ do { \
+ if (j.contains(k)) j.at(k).get_to(t); \
+ } while (0)
+
+#define JS_N(k, t) \
+ do { \
+ if (!j.at(k).is_null()) j.at(k).get_to(t); \
+ } while (0)
+
+#define JS_ON(k, t) \
+ do { \
+ if (j.contains(k) && !j.at(k).is_null()) \
+ j.at(k).get_to(t); \
+ } while (0)