Example #1
0
        internal SocketGuildInvite(DiscordSocketClient _client, SocketGuild guild, SocketGuildChannel channel, string inviteCode, InviteUpdate Update) : base(_client, inviteCode)
        {
            Code    = inviteCode;
            Guild   = guild;
            Channel = channel;

            if (Update.RawTimestamp.IsSpecified)
            {
                CreatedAt = Update.RawTimestamp.Value;
            }
            else
            {
                CreatedAt = DateTimeOffset.Now;
            }

            if (Update.inviter.IsSpecified)
            {
                Inviter = guild.GetUser(Update.inviter.Value.Id);
            }

            Temporary = Update.TempInvite;
            MaxUses   = Update.MaxUsers;
            MaxAge    = TimeSpan.FromSeconds(Update.RawAge);
        }
Example #2
0
        internal static SocketGuildInvite Create(DiscordSocketClient _client, SocketGuild guild, SocketGuildChannel channel, string inviteCode, InviteUpdate Update)
        {
            var invite = new SocketGuildInvite(_client, guild, channel, inviteCode, Update);

            return(invite);
        }