Exemple #1
0
        internal DiscordInvite(DiscordHttpClient http, DiscordApiData data)
        {
            this.http = http;

            Code                     = data.GetString("code");
            TargetUserType           = (DiscordInviteTargetUserType?)data.GetInteger("target_user_type");
            ApproximatePresenceCount = data.GetInteger("approximate_presence_count");
            ApproximateMemberCount   = data.GetInteger("approximate_member_count");

            DiscordApiData guildData = data.Get("guild");

            if (guildData != null)
            {
                Guild = new DiscordInviteGuild(guildData);
            }

            DiscordApiData channelData = data.Get("channel");

            if (channelData != null)
            {
                Channel = new DiscordInviteChannel(channelData);
            }

            DiscordApiData userData = data.Get("target_user");

            if (userData != null)
            {
                TargetUser = new DiscordUser(isWebhookUser: false, userData);
            }
        }
Exemple #2
0
        internal DiscordInvite(DiscordHttpClient http, DiscordApiData data)
        {
            this.http = http;

            Code = data.GetString("code");

            DiscordApiData guildData = data.Get("guild");

            if (guildData != null)
            {
                Guild = new DiscordInviteGuild(guildData);
            }

            DiscordApiData channelData = data.Get("channel");

            if (channelData != null)
            {
                Channel = new DiscordInviteChannel(channelData);
            }
        }