diff options
Diffstat (limited to 'discord/guild.cpp')
-rw-r--r-- | discord/guild.cpp | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/discord/guild.cpp b/discord/guild.cpp index 8b8a5c2..bf99943 100644 --- a/discord/guild.cpp +++ b/discord/guild.cpp @@ -13,29 +13,29 @@ void from_json(const nlohmann::json &j, GuildData &m) { JS_N("splash", m.Splash); JS_ON("discovery_splash", m.DiscoverySplash); JS_O("owner", m.IsOwner); - JS_D("owner_id", m.OwnerID); + JS_O("owner_id", m.OwnerID); std::optional<std::string> tmp; JS_O("permissions", tmp); if (tmp.has_value()) m.Permissions = std::stoull(*tmp); - JS_D("region", m.VoiceRegion); - JS_N("afk_channel_id", m.AFKChannelID); - JS_D("afk_timeout", m.AFKTimeout); + JS_O("region", m.VoiceRegion); + JS_ON("afk_channel_id", m.AFKChannelID); + JS_O("afk_timeout", m.AFKTimeout); JS_O("embed_enabled", m.IsEmbedEnabled); JS_ON("embed_channel_id", m.EmbedChannelID); - JS_D("verification_level", m.VerificationLevel); - JS_D("default_message_notifications", m.DefaultMessageNotifications); - JS_D("explicit_content_filter", m.ExplicitContentFilter); - JS_D("roles", m.Roles); - JS_D("emojis", m.Emojis); - JS_D("features", m.Features); - JS_D("mfa_level", m.MFALevel); - JS_N("application_id", m.ApplicationID); + JS_O("verification_level", m.VerificationLevel); + JS_O("default_message_notifications", m.DefaultMessageNotifications); + JS_O("explicit_content_filter", m.ExplicitContentFilter); + JS_O("roles", m.Roles); + JS_O("emojis", m.Emojis); + JS_O("features", m.Features); + JS_O("mfa_level", m.MFALevel); + JS_ON("application_id", m.ApplicationID); JS_O("widget_enabled", m.IsWidgetEnabled); JS_ON("widget_channel_id", m.WidgetChannelID); - JS_N("system_channel_id", m.SystemChannelID); - JS_D("system_channel_flags", m.SystemChannelFlags); - JS_N("rules_channel_id", m.RulesChannelID); + JS_ON("system_channel_id", m.SystemChannelID); + JS_O("system_channel_flags", m.SystemChannelFlags); + JS_ON("rules_channel_id", m.RulesChannelID); JS_O("joined_at", m.JoinedAt); JS_O("large", m.IsLarge); JS_O("unavailable", m.IsUnavailable); @@ -46,13 +46,13 @@ void from_json(const nlohmann::json &j, GuildData &m) { // JS_O("presences", m.Presences); JS_ON("max_presences", m.MaxPresences); JS_O("max_members", m.MaxMembers); - JS_N("vanity_url_code", m.VanityURL); - JS_N("description", m.Description); - JS_N("banner", m.BannerHash); - JS_D("premium_tier", m.PremiumTier); + JS_ON("vanity_url_code", m.VanityURL); + JS_ON("description", m.Description); + JS_ON("banner", m.BannerHash); + JS_O("premium_tier", m.PremiumTier); JS_O("premium_subscription_count", m.PremiumSubscriptionCount); - JS_D("preferred_locale", m.PreferredLocale); - JS_N("public_updates_channel_id", m.PublicUpdatesChannelID); + JS_O("preferred_locale", m.PreferredLocale); + JS_ON("public_updates_channel_id", m.PublicUpdatesChannelID); JS_O("max_video_channel_users", m.MaxVideoChannelUsers); JS_O("approximate_member_count", tmp); if (tmp.has_value()) @@ -119,7 +119,8 @@ void GuildData::update_from_json(const nlohmann::json &j) { } bool GuildData::HasFeature(const std::string &search_feature) { - for (const auto &feature : Features) + if (!Features.has_value()) return false; + for (const auto &feature : *Features) if (search_feature == feature) return true; return false; |