diff --git a/src/Discord.Net/API/Common/Invite.cs b/src/Discord.Net/API/Common/Invite.cs index 276314560..1437be091 100644 --- a/src/Discord.Net/API/Common/Invite.cs +++ b/src/Discord.Net/API/Common/Invite.cs @@ -10,7 +10,5 @@ namespace Discord.API public InviteGuild Guild { get; set; } [JsonProperty("channel")] public InviteChannel Channel { get; set; } - [JsonProperty("xkcdpass")] - public string XkcdPass { get; set; } } } diff --git a/src/Discord.Net/API/DiscordRestApiClient.cs b/src/Discord.Net/API/DiscordRestApiClient.cs index 9136399b0..bf78f350c 100644 --- a/src/Discord.Net/API/DiscordRestApiClient.cs +++ b/src/Discord.Net/API/DiscordRestApiClient.cs @@ -519,21 +519,21 @@ namespace Discord.API } //Guild Invites - public async Task GetInviteAsync(string inviteIdOrXkcd, RequestOptions options = null) + public async Task GetInviteAsync(string inviteId, RequestOptions options = null) { - Preconditions.NotNullOrEmpty(inviteIdOrXkcd, nameof(inviteIdOrXkcd)); + Preconditions.NotNullOrEmpty(inviteId, nameof(inviteId)); //Remove trailing slash - if (inviteIdOrXkcd[inviteIdOrXkcd.Length - 1] == '/') - inviteIdOrXkcd = inviteIdOrXkcd.Substring(0, inviteIdOrXkcd.Length - 1); + if (inviteId[inviteId.Length - 1] == '/') + inviteId = inviteId.Substring(0, inviteId.Length - 1); //Remove leading URL - int index = inviteIdOrXkcd.LastIndexOf('/'); + int index = inviteId.LastIndexOf('/'); if (index >= 0) - inviteIdOrXkcd = inviteIdOrXkcd.Substring(index + 1); + inviteId = inviteId.Substring(index + 1); try { - return await SendAsync("GET", $"invites/{inviteIdOrXkcd}", options: options).ConfigureAwait(false); + return await SendAsync("GET", $"invites/{inviteId}", options: options).ConfigureAwait(false); } catch (HttpException ex) when (ex.StatusCode == HttpStatusCode.NotFound) { return null; } } diff --git a/src/Discord.Net/API/Rest/CreateChannelInviteParams.cs b/src/Discord.Net/API/Rest/CreateChannelInviteParams.cs index c8e4490d8..b76bee671 100644 --- a/src/Discord.Net/API/Rest/CreateChannelInviteParams.cs +++ b/src/Discord.Net/API/Rest/CreateChannelInviteParams.cs @@ -16,9 +16,5 @@ namespace Discord.API.Rest [JsonProperty("temporary")] internal Optional _temporary { get; set; } public bool Temporary { set { _temporary = value; } } - - [JsonProperty("xkcdpass")] - internal Optional _xkcdPass { get; set; } - public bool XkcdPass { set { _xkcdPass = value; } } } } diff --git a/src/Discord.Net/Entities/Channels/IGuildChannel.cs b/src/Discord.Net/Entities/Channels/IGuildChannel.cs index 50da5fa58..e42ace8d6 100644 --- a/src/Discord.Net/Entities/Channels/IGuildChannel.cs +++ b/src/Discord.Net/Entities/Channels/IGuildChannel.cs @@ -19,8 +19,7 @@ namespace Discord /// The time (in seconds) until the invite expires. Set to null to never expire. /// The max amount of times this invite may be used. Set to null to have unlimited uses. /// If true, a user accepting this invite will be kicked from the guild after closing their client. - /// If true, creates a human-readable link. Not supported if maxAge is set to null. - Task CreateInviteAsync(int? maxAge = 1800, int? maxUses = default(int?), bool isTemporary = false, bool withXkcd = false); + Task CreateInviteAsync(int? maxAge = 1800, int? maxUses = default(int?), bool isTemporary = false); /// Returns a collection of all invites to this channel. Task> GetInvitesAsync(); diff --git a/src/Discord.Net/Entities/Guilds/IGuild.cs b/src/Discord.Net/Entities/Guilds/IGuild.cs index 8979677ac..b59f9aa0d 100644 --- a/src/Discord.Net/Entities/Guilds/IGuild.cs +++ b/src/Discord.Net/Entities/Guilds/IGuild.cs @@ -86,8 +86,7 @@ namespace Discord /// The time (in seconds) until the invite expires. Set to null to never expire. /// The max amount of times this invite may be used. Set to null to have unlimited uses. /// If true, a user accepting this invite will be kicked from the guild after closing their client. - /// If true, creates a human-readable link. Not supported if maxAge is set to null. - Task CreateInviteAsync(int? maxAge = 1800, int? maxUses = default(int?), bool isTemporary = false, bool withXkcd = false); + Task CreateInviteAsync(int? maxAge = 1800, int? maxUses = default(int?), bool isTemporary = false); /// Gets the role in this guild with the provided id, or null if not found. IRole GetRole(ulong id); diff --git a/src/Discord.Net/Entities/Invites/IInvite.cs b/src/Discord.Net/Entities/Invites/IInvite.cs index d9da5b3ec..5e5ca40ae 100644 --- a/src/Discord.Net/Entities/Invites/IInvite.cs +++ b/src/Discord.Net/Entities/Invites/IInvite.cs @@ -8,10 +8,6 @@ namespace Discord string Code { get; } /// Gets the url used to accept this invite, using Code. string Url { get; } - /// Gets the human-readable identifier for this code. - string XkcdCode { get; } - /// Gets the url used to accept this invite, using XkcdCode. - string XkcdUrl { get; } /// Gets the id of the the channel this invite is linked to. ulong ChannelId { get; } diff --git a/src/Discord.Net/IDiscordClient.cs b/src/Discord.Net/IDiscordClient.cs index 263191099..0b3474ed9 100644 --- a/src/Discord.Net/IDiscordClient.cs +++ b/src/Discord.Net/IDiscordClient.cs @@ -31,7 +31,7 @@ namespace Discord Task> GetGuildSummariesAsync(); Task CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon = null); - Task GetInviteAsync(string inviteIdOrXkcd); + Task GetInviteAsync(string inviteId); Task GetUserAsync(ulong id); Task GetUserAsync(string username, string discriminator); diff --git a/src/Discord.Net/Rest/DiscordRestClient.cs b/src/Discord.Net/Rest/DiscordRestClient.cs index 806db3eb7..11cf10747 100644 --- a/src/Discord.Net/Rest/DiscordRestClient.cs +++ b/src/Discord.Net/Rest/DiscordRestClient.cs @@ -201,9 +201,9 @@ namespace Discord.Rest } /// - public virtual async Task GetInviteAsync(string inviteIdOrXkcd) + public virtual async Task GetInviteAsync(string inviteId) { - var model = await ApiClient.GetInviteAsync(inviteIdOrXkcd).ConfigureAwait(false); + var model = await ApiClient.GetInviteAsync(inviteId).ConfigureAwait(false); if (model != null) return new Invite(this, model); return null; diff --git a/src/Discord.Net/Rest/Entities/Channels/GuildChannel.cs b/src/Discord.Net/Rest/Entities/Channels/GuildChannel.cs index a8d12d43e..4086e70be 100644 --- a/src/Discord.Net/Rest/Entities/Channels/GuildChannel.cs +++ b/src/Discord.Net/Rest/Entities/Channels/GuildChannel.cs @@ -76,14 +76,13 @@ namespace Discord var models = await Discord.ApiClient.GetChannelInvitesAsync(Id).ConfigureAwait(false); return models.Select(x => new InviteMetadata(Discord, x)).ToImmutableArray(); } - public async Task CreateInviteAsync(int? maxAge, int? maxUses, bool isTemporary, bool withXkcd) + public async Task CreateInviteAsync(int? maxAge, int? maxUses, bool isTemporary) { var args = new CreateChannelInviteParams { MaxAge = maxAge ?? 0, MaxUses = maxUses ?? 0, - Temporary = isTemporary, - XkcdPass = withXkcd + Temporary = isTemporary }; var model = await Discord.ApiClient.CreateChannelInviteAsync(Id, args).ConfigureAwait(false); return new InviteMetadata(Discord, model); diff --git a/src/Discord.Net/Rest/Entities/Guilds/Guild.cs b/src/Discord.Net/Rest/Entities/Guilds/Guild.cs index 5a243c5ed..e08679b35 100644 --- a/src/Discord.Net/Rest/Entities/Guilds/Guild.cs +++ b/src/Discord.Net/Rest/Entities/Guilds/Guild.cs @@ -220,7 +220,7 @@ namespace Discord var models = await Discord.ApiClient.GetGuildInvitesAsync(Id).ConfigureAwait(false); return models.Select(x => new InviteMetadata(Discord, x)).ToImmutableArray(); } - public async Task CreateInviteAsync(int? maxAge = 1800, int? maxUses = null, bool isTemporary = false, bool withXkcd = false) + public async Task CreateInviteAsync(int? maxAge = 1800, int? maxUses = null, bool isTemporary = false) { if (maxAge <= 0) throw new ArgumentOutOfRangeException(nameof(maxAge)); if (maxUses <= 0) throw new ArgumentOutOfRangeException(nameof(maxUses)); @@ -229,8 +229,7 @@ namespace Discord { MaxAge = maxAge ?? 0, MaxUses = maxUses ?? 0, - Temporary = isTemporary, - XkcdPass = withXkcd + Temporary = isTemporary }; var model = await Discord.ApiClient.CreateChannelInviteAsync(DefaultChannelId, args).ConfigureAwait(false); return new InviteMetadata(Discord, model); diff --git a/src/Discord.Net/Rest/Entities/Invites/Invite.cs b/src/Discord.Net/Rest/Entities/Invites/Invite.cs index d95ee1daa..0bad27bf0 100644 --- a/src/Discord.Net/Rest/Entities/Invites/Invite.cs +++ b/src/Discord.Net/Rest/Entities/Invites/Invite.cs @@ -10,15 +10,13 @@ namespace Discord { public string ChannelName { get; private set; } public string GuildName { get; private set; } - public string XkcdCode { get; private set; } public ulong ChannelId { get; private set; } public ulong GuildId { get; private set; } public override DiscordRestClient Discord { get; } public string Code => Id; - public string Url => $"{DiscordConfig.InviteUrl}/{XkcdCode ?? Code}"; - public string XkcdUrl => XkcdCode != null ? $"{DiscordConfig.InviteUrl}/{XkcdCode}" : null; + public string Url => $"{DiscordConfig.InviteUrl}/{Code}"; public Invite(DiscordRestClient discord, Model model) : base(model.Code) @@ -31,7 +29,6 @@ namespace Discord { if (source == UpdateSource.Rest && IsAttached) return; - XkcdCode = model.XkcdPass; GuildId = model.Guild.Id; ChannelId = model.Channel.Id; GuildName = model.Guild.Name; @@ -47,7 +44,7 @@ namespace Discord await Discord.ApiClient.DeleteInviteAsync(Code).ConfigureAwait(false); } - public override string ToString() => XkcdUrl ?? Url; - private string DebuggerDisplay => $"{XkcdUrl ?? Url} ({GuildName} / {ChannelName})"; + public override string ToString() => Url; + private string DebuggerDisplay => $"{Url} ({GuildName} / {ChannelName})"; } }