diff --git a/DisCatSharp/Entities/Invite/DiscordInvite.cs b/DisCatSharp/Entities/Invite/DiscordInvite.cs
index 55acfac3f..88188e553 100644
--- a/DisCatSharp/Entities/Invite/DiscordInvite.cs
+++ b/DisCatSharp/Entities/Invite/DiscordInvite.cs
@@ -1,195 +1,201 @@
// This file is part of the DisCatSharp project.
//
// Copyright (c) 2021 AITSYS
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using System.Threading.Tasks;
using Newtonsoft.Json;
using DisCatSharp.Enums.Discord;
namespace DisCatSharp.Entities
{
///
/// Represents a Discord invite.
///
public class DiscordInvite
{
///
/// Gets the base cloent.
///
internal BaseDiscordClient Discord { get; set; }
///
/// Gets the invite's code.
///
[JsonProperty("code", NullValueHandling = NullValueHandling.Ignore)]
public string Code { get; internal set; }
///
/// Gets the invite's url.
///
[JsonIgnore]
public string Url => DiscordDomain.GetDomain(CoreDomain.DiscordShortlink).Url + "/" + this.Code;
///
/// Gets the invite's url as Uri.
///
[JsonIgnore]
public Uri Uri => new(this.Url);
///
/// Gets the guild this invite is for.
///
[JsonProperty("guild", NullValueHandling = NullValueHandling.Ignore)]
public DiscordInviteGuild Guild { get; internal set; }
///
/// Gets the channel this invite is for.
///
[JsonProperty("channel", NullValueHandling = NullValueHandling.Ignore)]
public DiscordInviteChannel Channel { get; internal set; }
///
/// Gets the target type for the voice channel this invite is for.
///
[JsonProperty("target_type", NullValueHandling = NullValueHandling.Ignore)]
public TargetType? TargetType { get; internal set; }
///
/// Gets the user that is currently livestreaming.
///
[JsonProperty("target_user", NullValueHandling = NullValueHandling.Ignore)]
public DiscordUser TargetUser { get; internal set; }
///
/// Gets the embedded partial application to open for this voice channel.
///
[JsonProperty("target_application", NullValueHandling = NullValueHandling.Ignore)]
public DiscordApplication TargetApplication { get; internal set; }
///
/// Gets the approximate guild online member count for the invite.
///
[JsonProperty("approximate_presence_count", NullValueHandling = NullValueHandling.Ignore)]
public int? ApproximatePresenceCount { get; internal set; }
///
/// Gets the approximate guild total member count for the invite.
///
- [JsonProperty("approximate_member_count")]
+ [JsonProperty("approximate_member_count", NullValueHandling = NullValueHandling.Ignore)]
public int? ApproximateMemberCount { get; internal set; }
///
/// Gets the user who created the invite.
///
[JsonProperty("inviter", NullValueHandling = NullValueHandling.Ignore)]
public DiscordUser Inviter { get; internal set; }
///
/// Gets the number of times this invite has been used.
///
[JsonProperty("uses", NullValueHandling = NullValueHandling.Ignore)]
public int Uses { get; internal set; }
///
/// Gets the max number of times this invite can be used.
///
[JsonProperty("max_uses", NullValueHandling = NullValueHandling.Ignore)]
public int MaxUses { get; internal set; }
///
/// Gets duration in seconds after which the invite expires.
///
[JsonProperty("max_age", NullValueHandling = NullValueHandling.Ignore)]
public int MaxAge { get; internal set; }
///
/// Gets whether this invite only grants temporary membership.
///
[JsonProperty("temporary", NullValueHandling = NullValueHandling.Ignore)]
public bool IsTemporary { get; internal set; }
///
/// Gets the date and time this invite was created.
///
[JsonProperty("created_at", NullValueHandling = NullValueHandling.Ignore)]
public DateTimeOffset CreatedAt { get; internal set; }
///
/// Gets the date and time when this invite expires.
///
[JsonProperty("expires_at", NullValueHandling = NullValueHandling.Ignore)]
public DateTimeOffset ExpiresAt { get; internal set; }
///
/// Gets the date and time when this invite got expired.
///
[JsonProperty("expired_at", NullValueHandling = NullValueHandling.Ignore)]
public DateTimeOffset ExpiredAt { get; internal set; }
///
/// Gets whether this invite is revoked.
///
[JsonProperty("revoked", NullValueHandling = NullValueHandling.Ignore)]
public bool IsRevoked { get; internal set; }
///
/// Gets the stage instance this invite is for.
///
[JsonProperty("stage_instance", NullValueHandling = NullValueHandling.Ignore)]
public DiscordInviteStage Stage { get; internal set; }
+ ///
+ /// Gets the | guild scheduled event data for the invite.
+ ///
+ [JsonProperty("guild_scheduled_event", NullValueHandling = NullValueHandling.Ignore)]
+ public DiscordEvent GuildSheduledEvent { get; internal set; }
+
///
/// Initializes a new instance of the class.
///
internal DiscordInvite() { }
///
/// Deletes the invite.
///
/// Reason for audit logs.
///
/// Thrown when the client does not have the permission or the permission.
/// Thrown when the emoji does not exist.
/// Thrown when an invalid parameter was provided.
/// Thrown when Discord is unable to process the request.
public Task DeleteAsync(string reason = null)
=> this.Discord.ApiClient.DeleteInviteAsync(this.Code, reason);
/*
* Disabled due to API restrictions.
*
* ///
* /// Accepts an invite. Not available to bot accounts. Requires "guilds.join" scope or user token. Please note that accepting these via the API will get your account unverified.
* ///
* ///
* [Obsolete("Using this method will get your account unverified.")]
* public Task AcceptAsync()
* => this.Discord._rest_client.InternalAcceptInvite(Code);
*/
///
/// Converts this invite into an invite link.
///
/// A discord.gg invite link.
public override string ToString() => $"{DiscordDomain.GetDomain(CoreDomain.DiscordShortlink).Url}/{this.Code}";
}
}