From 9fa59479aa73b3ca57c1ce38b8e4248b7ec170df Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Sun, 8 Nov 2020 20:52:29 -0500 Subject: bug fix moment --- discord/snowflake.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'discord/snowflake.cpp') diff --git a/discord/snowflake.cpp b/discord/snowflake.cpp index 6923395..5528819 100644 --- a/discord/snowflake.cpp +++ b/discord/snowflake.cpp @@ -24,9 +24,13 @@ bool Snowflake::IsValid() const { } void from_json(const nlohmann::json &j, Snowflake &s) { - std::string tmp; - j.get_to(tmp); - s.m_num = std::stoull(tmp); + if (j.is_string()) { + std::string tmp; + j.get_to(tmp); + s.m_num = std::stoull(tmp); + } else { + j.get_to(s.m_num); + } } void to_json(nlohmann::json &j, const Snowflake &s) { -- cgit v1.2.3