#pragma once #include "json.hpp" #include "snowflake.hpp" #include "role.hpp" #include "channel.hpp" #include "emoji.hpp" #include #include // a bot is apparently only supposed to receive the `id` and `unavailable` as false // but user tokens seem to get the full objects (minus users) struct GuildData { Snowflake ID; std::string Name; std::string Icon; // null std::string Splash; // null std::optional DiscoverySplash; // null std::optional IsOwner; Snowflake OwnerID; std::optional Permissions; std::optional PermissionsNew; std::optional VoiceRegion; Snowflake AFKChannelID; // null int AFKTimeout; std::optional IsEmbedEnabled; // deprecated std::optional EmbedChannelID; // null, deprecated int VerificationLevel; int DefaultMessageNotifications; int ExplicitContentFilter; std::vector Roles; // only access id std::vector Emojis; // only access id std::vector Features; int MFALevel; Snowflake ApplicationID; // null std::optional IsWidgetEnabled; std::optional WidgetChannelID; // null Snowflake SystemChannelID; // null int SystemChannelFlags; Snowflake RulesChannelID; // null std::optional JoinedAt; // * std::optional IsLarge; // * std::optional IsUnavailable; // * std::optional MemberCount; // * // std::vector VoiceStates; // opt* // std::vector Members; // opt* - incomplete anyways std::optional> Channels; // * // std::vector Presences; // opt* std::optional MaxPresences; // null std::optional MaxMembers; std::string VanityURL; // null std::string Description; // null std::string BannerHash; // null int PremiumTier; std::optional PremiumSubscriptionCount; std::string PreferredLocale; Snowflake PublicUpdatesChannelID; // null std::optional MaxVideoChannelUsers; std::optional ApproximateMemberCount; std::optional ApproximatePresenceCount; // undocumented // std::map GuildHashes; bool IsLazy = false; // * - documentation says only sent in GUILD_CREATE, but these can be sent anyways in the READY event friend void from_json(const nlohmann::json &j, GuildData &m); void update_from_json(const nlohmann::json &j); bool HasIcon() const; bool HasAnimatedIcon() const; std::string GetIconURL(std::string ext = "png", std::string size = "32") const; std::vector GetSortedChannels(Snowflake ignore = Snowflake::Invalid) const; };