| @@ -1,4 +1,4 @@ | |||||
| using System; | |||||
| using System; | |||||
| using System.Collections.Concurrent; | using System.Collections.Concurrent; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Collections.Immutable; | using System.Collections.Immutable; | ||||
| @@ -352,7 +352,7 @@ namespace Discord.Commands | |||||
| /// </param> | /// </param> | ||||
| public void AddTypeReader(Type type, TypeReader reader, bool replaceDefault) | public void AddTypeReader(Type type, TypeReader reader, bool replaceDefault) | ||||
| { | { | ||||
| if (replaceDefault && _defaultTypeReaders.ContainsKey(type)) | |||||
| if (replaceDefault && HasDefaultTypeReader(type)) | |||||
| { | { | ||||
| _defaultTypeReaders.AddOrUpdate(type, reader, (k, v) => reader); | _defaultTypeReaders.AddOrUpdate(type, reader, (k, v) => reader); | ||||
| if (type.GetTypeInfo().IsValueType) | if (type.GetTypeInfo().IsValueType) | ||||
| @@ -371,6 +371,16 @@ namespace Discord.Commands | |||||
| AddNullableTypeReader(type, reader); | AddNullableTypeReader(type, reader); | ||||
| } | } | ||||
| } | } | ||||
| internal bool HasDefaultTypeReader(Type type) | |||||
| { | |||||
| if (_defaultTypeReaders.ContainsKey(type)) | |||||
| return true; | |||||
| var typeInfo = type.GetTypeInfo(); | |||||
| if (typeInfo.IsEnum) | |||||
| return true; | |||||
| return _entityTypeReaders.Any(x => type == x.Item1 || typeInfo.ImplementedInterfaces.Contains(x.Item2)); | |||||
| } | |||||
| internal void AddNullableTypeReader(Type valueType, TypeReader valueTypeReader) | internal void AddNullableTypeReader(Type valueType, TypeReader valueTypeReader) | ||||
| { | { | ||||
| var readers = _typeReaders.GetOrAdd(typeof(Nullable<>).MakeGenericType(valueType), x => new ConcurrentDictionary<Type, TypeReader>()); | var readers = _typeReaders.GetOrAdd(typeof(Nullable<>).MakeGenericType(valueType), x => new ConcurrentDictionary<Type, TypeReader>()); | ||||
| @@ -455,6 +455,15 @@ namespace Discord | |||||
| /// An awaitable <see cref="Task"/> containing a collection of invites found within this guild. | /// An awaitable <see cref="Task"/> containing a collection of invites found within this guild. | ||||
| /// </returns> | /// </returns> | ||||
| Task<IReadOnlyCollection<IInviteMetadata>> GetInvitesAsync(RequestOptions options = null); | Task<IReadOnlyCollection<IInviteMetadata>> GetInvitesAsync(RequestOptions options = null); | ||||
| /// <summary> | |||||
| /// Gets the vanity invite URL of this guild. | |||||
| /// </summary> | |||||
| /// <param name="options">The options to be used when sending the request.</param> | |||||
| /// <returns> | |||||
| /// An awaitable <see cref="Task"/> containing the partial metadata of the vanity invite found within | |||||
| /// this guild. | |||||
| /// </returns> | |||||
| Task<IInviteMetadata> GetVanityInviteAsync(RequestOptions options = null); | |||||
| /// <summary> | /// <summary> | ||||
| /// Gets a role in this guild. | /// Gets a role in this guild. | ||||
| @@ -27,6 +27,8 @@ namespace Discord | |||||
| /// A generic channel that the invite points to. | /// A generic channel that the invite points to. | ||||
| /// </returns> | /// </returns> | ||||
| IChannel Channel { get; } | IChannel Channel { get; } | ||||
| /// <summary> Gets the type of the channel this invite is linked to. </summary> | |||||
| ChannelType ChannelType { get; } | |||||
| /// <summary> | /// <summary> | ||||
| /// Gets the ID of the channel this invite is linked to. | /// Gets the ID of the channel this invite is linked to. | ||||
| /// </summary> | /// </summary> | ||||
| @@ -55,7 +57,7 @@ namespace Discord | |||||
| /// <returns> | /// <returns> | ||||
| /// An <see cref="ulong"/> representing the guild snowflake identifier that the invite points to. | /// An <see cref="ulong"/> representing the guild snowflake identifier that the invite points to. | ||||
| /// </returns> | /// </returns> | ||||
| ulong GuildId { get; } | |||||
| ulong? GuildId { get; } | |||||
| /// <summary> | /// <summary> | ||||
| /// Gets the name of the guild this invite is linked to. | /// Gets the name of the guild this invite is linked to. | ||||
| /// </summary> | /// </summary> | ||||
| @@ -52,13 +52,13 @@ namespace Discord | |||||
| /// <returns> | /// <returns> | ||||
| /// An <see cref="int"/> representing the number of times this invite has been used. | /// An <see cref="int"/> representing the number of times this invite has been used. | ||||
| /// </returns> | /// </returns> | ||||
| int Uses { get; } | |||||
| int? Uses { get; } | |||||
| /// <summary> | /// <summary> | ||||
| /// Gets when this invite was created. | /// Gets when this invite was created. | ||||
| /// </summary> | /// </summary> | ||||
| /// <returns> | /// <returns> | ||||
| /// A <see cref="DateTimeOffset"/> representing the time of which the invite was first created. | /// A <see cref="DateTimeOffset"/> representing the time of which the invite was first created. | ||||
| /// </returns> | /// </returns> | ||||
| DateTimeOffset CreatedAt { get; } | |||||
| DateTimeOffset? CreatedAt { get; } | |||||
| } | } | ||||
| } | } | ||||
| @@ -8,7 +8,7 @@ namespace Discord.API | |||||
| [JsonProperty("code")] | [JsonProperty("code")] | ||||
| public string Code { get; set; } | public string Code { get; set; } | ||||
| [JsonProperty("guild")] | [JsonProperty("guild")] | ||||
| public InviteGuild Guild { get; set; } | |||||
| public Optional<InviteGuild> Guild { get; set; } | |||||
| [JsonProperty("channel")] | [JsonProperty("channel")] | ||||
| public InviteChannel Channel { get; set; } | public InviteChannel Channel { get; set; } | ||||
| [JsonProperty("approximate_presence_count")] | [JsonProperty("approximate_presence_count")] | ||||
| @@ -1,4 +1,4 @@ | |||||
| #pragma warning disable CS1591 | |||||
| #pragma warning disable CS1591 | |||||
| using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
| namespace Discord.API | namespace Discord.API | ||||
| @@ -10,6 +10,6 @@ namespace Discord.API | |||||
| [JsonProperty("name")] | [JsonProperty("name")] | ||||
| public string Name { get; set; } | public string Name { get; set; } | ||||
| [JsonProperty("type")] | [JsonProperty("type")] | ||||
| public string Type { get; set; } | |||||
| public int Type { get; set; } | |||||
| } | } | ||||
| } | } | ||||
| @@ -9,15 +9,15 @@ namespace Discord.API | |||||
| [JsonProperty("inviter")] | [JsonProperty("inviter")] | ||||
| public User Inviter { get; set; } | public User Inviter { get; set; } | ||||
| [JsonProperty("uses")] | [JsonProperty("uses")] | ||||
| public int Uses { get; set; } | |||||
| public Optional<int> Uses { get; set; } | |||||
| [JsonProperty("max_uses")] | [JsonProperty("max_uses")] | ||||
| public int MaxUses { get; set; } | |||||
| public Optional<int> MaxUses { get; set; } | |||||
| [JsonProperty("max_age")] | [JsonProperty("max_age")] | ||||
| public int MaxAge { get; set; } | |||||
| public Optional<int> MaxAge { get; set; } | |||||
| [JsonProperty("temporary")] | [JsonProperty("temporary")] | ||||
| public bool Temporary { get; set; } | public bool Temporary { get; set; } | ||||
| [JsonProperty("created_at")] | [JsonProperty("created_at")] | ||||
| public DateTimeOffset CreatedAt { get; set; } | |||||
| public Optional<DateTimeOffset> CreatedAt { get; set; } | |||||
| [JsonProperty("revoked")] | [JsonProperty("revoked")] | ||||
| public bool Revoked { get; set; } | public bool Revoked { get; set; } | ||||
| } | } | ||||
| @@ -1,7 +0,0 @@ | |||||
| namespace Discord.API.Rest | |||||
| { | |||||
| internal class GetInviteParams | |||||
| { | |||||
| public Optional<bool?> WithCounts { get; set; } | |||||
| } | |||||
| } | |||||
| @@ -53,13 +53,9 @@ namespace Discord.Rest | |||||
| } | } | ||||
| public static async Task<RestInviteMetadata> GetInviteAsync(BaseDiscordClient client, | public static async Task<RestInviteMetadata> GetInviteAsync(BaseDiscordClient client, | ||||
| string inviteId, bool withCount, RequestOptions options) | |||||
| string inviteId, RequestOptions options) | |||||
| { | { | ||||
| var args = new GetInviteParams | |||||
| { | |||||
| WithCounts = withCount | |||||
| }; | |||||
| var model = await client.ApiClient.GetInviteAsync(inviteId, args, options).ConfigureAwait(false); | |||||
| var model = await client.ApiClient.GetInviteAsync(inviteId, options).ConfigureAwait(false); | |||||
| if (model != null) | if (model != null) | ||||
| return RestInviteMetadata.Create(client, null, null, model); | return RestInviteMetadata.Create(client, null, null, model); | ||||
| return null; | return null; | ||||
| @@ -918,7 +918,7 @@ namespace Discord.API | |||||
| } | } | ||||
| //Guild Invites | //Guild Invites | ||||
| public async Task<InviteMetadata> GetInviteAsync(string inviteId, GetInviteParams args, RequestOptions options = null) | |||||
| public async Task<InviteMetadata> GetInviteAsync(string inviteId, RequestOptions options = null) | |||||
| { | { | ||||
| Preconditions.NotNullOrEmpty(inviteId, nameof(inviteId)); | Preconditions.NotNullOrEmpty(inviteId, nameof(inviteId)); | ||||
| options = RequestOptions.CreateOrClone(options); | options = RequestOptions.CreateOrClone(options); | ||||
| @@ -931,14 +931,20 @@ namespace Discord.API | |||||
| if (index >= 0) | if (index >= 0) | ||||
| inviteId = inviteId.Substring(index + 1); | inviteId = inviteId.Substring(index + 1); | ||||
| var withCounts = args.WithCounts.GetValueOrDefault(false); | |||||
| try | try | ||||
| { | { | ||||
| return await SendAsync<InviteMetadata>("GET", () => $"invites/{inviteId}?with_counts={withCounts}", new BucketIds(), options: options).ConfigureAwait(false); | |||||
| return await SendAsync<InviteMetadata>("GET", () => $"invites/{inviteId}?with_counts=true", new BucketIds(), options: options).ConfigureAwait(false); | |||||
| } | } | ||||
| catch (HttpException ex) when (ex.HttpCode == HttpStatusCode.NotFound) { return null; } | catch (HttpException ex) when (ex.HttpCode == HttpStatusCode.NotFound) { return null; } | ||||
| } | } | ||||
| public async Task<InviteMetadata> GetVanityInviteAsync(ulong guildId, RequestOptions options = null) | |||||
| { | |||||
| Preconditions.NotEqual(guildId, 0, nameof(guildId)); | |||||
| options = RequestOptions.CreateOrClone(options); | |||||
| var ids = new BucketIds(guildId: guildId); | |||||
| return await SendAsync<InviteMetadata>("GET", () => $"guilds/{guildId}/vanity-url", ids, options: options).ConfigureAwait(false); | |||||
| } | |||||
| public async Task<IReadOnlyCollection<InviteMetadata>> GetGuildInvitesAsync(ulong guildId, RequestOptions options = null) | public async Task<IReadOnlyCollection<InviteMetadata>> GetGuildInvitesAsync(ulong guildId, RequestOptions options = null) | ||||
| { | { | ||||
| Preconditions.NotEqual(guildId, 0, nameof(guildId)); | Preconditions.NotEqual(guildId, 0, nameof(guildId)); | ||||
| @@ -65,7 +65,7 @@ namespace Discord.Rest | |||||
| => ClientHelper.GetConnectionsAsync(this, options); | => ClientHelper.GetConnectionsAsync(this, options); | ||||
| public Task<RestInviteMetadata> GetInviteAsync(string inviteId, bool withCount = false, RequestOptions options = null) | public Task<RestInviteMetadata> GetInviteAsync(string inviteId, bool withCount = false, RequestOptions options = null) | ||||
| => ClientHelper.GetInviteAsync(this, inviteId, withCount, options); | |||||
| => ClientHelper.GetInviteAsync(this, inviteId, options); | |||||
| public Task<RestGuild> GetGuildAsync(ulong id, RequestOptions options = null) | public Task<RestGuild> GetGuildAsync(ulong id, RequestOptions options = null) | ||||
| => ClientHelper.GetGuildAsync(this, id, options); | => ClientHelper.GetGuildAsync(this, id, options); | ||||
| @@ -214,6 +214,12 @@ namespace Discord.Rest | |||||
| var models = await client.ApiClient.GetGuildInvitesAsync(guild.Id, options).ConfigureAwait(false); | var models = await client.ApiClient.GetGuildInvitesAsync(guild.Id, options).ConfigureAwait(false); | ||||
| return models.Select(x => RestInviteMetadata.Create(client, guild, null, x)).ToImmutableArray(); | return models.Select(x => RestInviteMetadata.Create(client, guild, null, x)).ToImmutableArray(); | ||||
| } | } | ||||
| public static async Task<RestInviteMetadata> GetVanityInviteAsync(IGuild guild, BaseDiscordClient client, | |||||
| RequestOptions options) | |||||
| { | |||||
| var model = await client.ApiClient.GetVanityInviteAsync(guild.Id, options).ConfigureAwait(false); | |||||
| return RestInviteMetadata.Create(client, guild, null, model); | |||||
| } | |||||
| //Roles | //Roles | ||||
| /// <exception cref="ArgumentNullException"><paramref name="name"/> is <c>null</c>.</exception> | /// <exception cref="ArgumentNullException"><paramref name="name"/> is <c>null</c>.</exception> | ||||
| @@ -303,6 +303,15 @@ namespace Discord.Rest | |||||
| //Invites | //Invites | ||||
| public Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null) | public Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null) | ||||
| => GuildHelper.GetInvitesAsync(this, Discord, options); | => GuildHelper.GetInvitesAsync(this, Discord, options); | ||||
| /// <summary> | |||||
| /// Gets the vanity invite URL of this guild. | |||||
| /// </summary> | |||||
| /// <param name="options">The options to be used when sending the request.</param> | |||||
| /// <returns> | |||||
| /// A partial metadata of the vanity invite found within this guild. | |||||
| /// </returns> | |||||
| public Task<RestInviteMetadata> GetVanityInviteAsync(RequestOptions options = null) | |||||
| => GuildHelper.GetVanityInviteAsync(this, Discord, options); | |||||
| //Roles | //Roles | ||||
| public RestRole GetRole(ulong id) | public RestRole GetRole(ulong id) | ||||
| @@ -496,6 +505,9 @@ namespace Discord.Rest | |||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| async Task<IReadOnlyCollection<IInviteMetadata>> IGuild.GetInvitesAsync(RequestOptions options) | async Task<IReadOnlyCollection<IInviteMetadata>> IGuild.GetInvitesAsync(RequestOptions options) | ||||
| => await GetInvitesAsync(options).ConfigureAwait(false); | => await GetInvitesAsync(options).ConfigureAwait(false); | ||||
| /// <inheritdoc /> | |||||
| async Task<IInviteMetadata> IGuild.GetVanityInviteAsync(RequestOptions options) | |||||
| => await GetVanityInviteAsync(options).ConfigureAwait(false); | |||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| IRole IGuild.GetRole(ulong id) | IRole IGuild.GetRole(ulong id) | ||||
| @@ -1,7 +1,6 @@ | |||||
| using System; | using System; | ||||
| using System.Diagnostics; | using System.Diagnostics; | ||||
| using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
| using Discord.API.Rest; | |||||
| using Model = Discord.API.Invite; | using Model = Discord.API.Invite; | ||||
| namespace Discord.Rest | namespace Discord.Rest | ||||
| @@ -9,6 +8,7 @@ namespace Discord.Rest | |||||
| [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
| public class RestInvite : RestEntity<string>, IInvite, IUpdateable | public class RestInvite : RestEntity<string>, IInvite, IUpdateable | ||||
| { | { | ||||
| public ChannelType ChannelType { get; private set; } | |||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public string ChannelName { get; private set; } | public string ChannelName { get; private set; } | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| @@ -20,7 +20,7 @@ namespace Discord.Rest | |||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public ulong ChannelId { get; private set; } | public ulong ChannelId { get; private set; } | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public ulong GuildId { get; private set; } | |||||
| public ulong? GuildId { get; private set; } | |||||
| internal IChannel Channel { get; } | internal IChannel Channel { get; } | ||||
| internal IGuild Guild { get; } | internal IGuild Guild { get; } | ||||
| @@ -43,21 +43,19 @@ namespace Discord.Rest | |||||
| } | } | ||||
| internal void Update(Model model) | internal void Update(Model model) | ||||
| { | { | ||||
| GuildId = model.Guild.Id; | |||||
| GuildId = model.Guild.IsSpecified ? model.Guild.Value.Id : default(ulong?); | |||||
| ChannelId = model.Channel.Id; | ChannelId = model.Channel.Id; | ||||
| GuildName = model.Guild.Name; | |||||
| GuildName = model.Guild.IsSpecified ? model.Guild.Value.Name : null; | |||||
| ChannelName = model.Channel.Name; | ChannelName = model.Channel.Name; | ||||
| MemberCount = model.MemberCount.IsSpecified ? model.MemberCount.Value : null; | MemberCount = model.MemberCount.IsSpecified ? model.MemberCount.Value : null; | ||||
| PresenceCount = model.PresenceCount.IsSpecified ? model.PresenceCount.Value : null; | PresenceCount = model.PresenceCount.IsSpecified ? model.PresenceCount.Value : null; | ||||
| ChannelType = (ChannelType)model.Channel.Type; | |||||
| } | } | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public async Task UpdateAsync(RequestOptions options = null) | public async Task UpdateAsync(RequestOptions options = null) | ||||
| { | { | ||||
| var args = new GetInviteParams(); | |||||
| if (MemberCount != null || PresenceCount != null) | |||||
| args.WithCounts = true; | |||||
| var model = await Discord.ApiClient.GetInviteAsync(Code, args, options).ConfigureAwait(false); | |||||
| var model = await Discord.ApiClient.GetInviteAsync(Code, options).ConfigureAwait(false); | |||||
| Update(model); | Update(model); | ||||
| } | } | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| @@ -6,7 +6,7 @@ namespace Discord.Rest | |||||
| /// <summary> Represents additional information regarding the REST-based invite object. </summary> | /// <summary> Represents additional information regarding the REST-based invite object. </summary> | ||||
| public class RestInviteMetadata : RestInvite, IInviteMetadata | public class RestInviteMetadata : RestInvite, IInviteMetadata | ||||
| { | { | ||||
| private long _createdAtTicks; | |||||
| private long? _createdAtTicks; | |||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public bool IsRevoked { get; private set; } | public bool IsRevoked { get; private set; } | ||||
| @@ -17,14 +17,14 @@ namespace Discord.Rest | |||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public int? MaxUses { get; private set; } | public int? MaxUses { get; private set; } | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public int Uses { get; private set; } | |||||
| public int? Uses { get; private set; } | |||||
| /// <summary> | /// <summary> | ||||
| /// Gets the user that created this invite. | /// Gets the user that created this invite. | ||||
| /// </summary> | /// </summary> | ||||
| public RestUser Inviter { get; private set; } | public RestUser Inviter { get; private set; } | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public DateTimeOffset CreatedAt => DateTimeUtils.FromTicks(_createdAtTicks); | |||||
| public DateTimeOffset? CreatedAt => DateTimeUtils.FromTicks(_createdAtTicks); | |||||
| internal RestInviteMetadata(BaseDiscordClient discord, IGuild guild, IChannel channel, string id) | internal RestInviteMetadata(BaseDiscordClient discord, IGuild guild, IChannel channel, string id) | ||||
| : base(discord, guild, channel, id) | : base(discord, guild, channel, id) | ||||
| @@ -42,10 +42,10 @@ namespace Discord.Rest | |||||
| Inviter = model.Inviter != null ? RestUser.Create(Discord, model.Inviter) : null; | Inviter = model.Inviter != null ? RestUser.Create(Discord, model.Inviter) : null; | ||||
| IsRevoked = model.Revoked; | IsRevoked = model.Revoked; | ||||
| IsTemporary = model.Temporary; | IsTemporary = model.Temporary; | ||||
| MaxAge = model.MaxAge != 0 ? model.MaxAge : (int?)null; | |||||
| MaxUses = model.MaxUses; | |||||
| Uses = model.Uses; | |||||
| _createdAtTicks = model.CreatedAt.UtcTicks; | |||||
| MaxAge = model.MaxAge.IsSpecified ? model.MaxAge.Value : (int?)null; | |||||
| MaxUses = model.MaxUses.IsSpecified ? model.MaxUses.Value : (int?)null; | |||||
| Uses = model.Uses.IsSpecified ? model.Uses.Value : (int?)null; | |||||
| _createdAtTicks = model.CreatedAt.IsSpecified ? model.CreatedAt.Value.UtcTicks : (long?)null; | |||||
| } | } | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| @@ -215,7 +215,7 @@ namespace Discord.WebSocket | |||||
| /// An awaitable <see cref="Task"/> containing the invite information. | /// An awaitable <see cref="Task"/> containing the invite information. | ||||
| /// </returns> | /// </returns> | ||||
| public Task<RestInviteMetadata> GetInviteAsync(string inviteId, bool withCount = false, RequestOptions options = null) | public Task<RestInviteMetadata> GetInviteAsync(string inviteId, bool withCount = false, RequestOptions options = null) | ||||
| => ClientHelper.GetInviteAsync(this, inviteId, withCount, options ?? RequestOptions.Default); | |||||
| => ClientHelper.GetInviteAsync(this, inviteId, options ?? RequestOptions.Default); | |||||
| // IDiscordClient | // IDiscordClient | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| @@ -1559,6 +1559,9 @@ namespace Discord.WebSocket | |||||
| case "MESSAGE_ACK": | case "MESSAGE_ACK": | ||||
| await _gatewayLogger.DebugAsync("Ignored Dispatch (MESSAGE_ACK)").ConfigureAwait(false); | await _gatewayLogger.DebugAsync("Ignored Dispatch (MESSAGE_ACK)").ConfigureAwait(false); | ||||
| break; | break; | ||||
| case "PRESENCES_REPLACE": | |||||
| await _gatewayLogger.DebugAsync("Ignored Dispatch (PRESENCES_REPLACE)").ConfigureAwait(false); | |||||
| break; | |||||
| case "USER_SETTINGS_UPDATE": | case "USER_SETTINGS_UPDATE": | ||||
| await _gatewayLogger.DebugAsync("Ignored Dispatch (USER_SETTINGS_UPDATE)").ConfigureAwait(false); | await _gatewayLogger.DebugAsync("Ignored Dispatch (USER_SETTINGS_UPDATE)").ConfigureAwait(false); | ||||
| break; | break; | ||||
| @@ -534,6 +534,15 @@ namespace Discord.WebSocket | |||||
| /// </returns> | /// </returns> | ||||
| public Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null) | public Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null) | ||||
| => GuildHelper.GetInvitesAsync(this, Discord, options); | => GuildHelper.GetInvitesAsync(this, Discord, options); | ||||
| /// <summary> | |||||
| /// Gets the vanity invite URL of this guild. | |||||
| /// </summary> | |||||
| /// <param name="options">The options to be used when sending the request.</param> | |||||
| /// <returns> | |||||
| /// A partial metadata of the vanity invite found within this guild. | |||||
| /// </returns> | |||||
| public Task<RestInviteMetadata> GetVanityInviteAsync(RequestOptions options = null) | |||||
| => GuildHelper.GetVanityInviteAsync(this, Discord, options); | |||||
| //Roles | //Roles | ||||
| /// <summary> | /// <summary> | ||||
| @@ -971,6 +980,9 @@ namespace Discord.WebSocket | |||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| async Task<IReadOnlyCollection<IInviteMetadata>> IGuild.GetInvitesAsync(RequestOptions options) | async Task<IReadOnlyCollection<IInviteMetadata>> IGuild.GetInvitesAsync(RequestOptions options) | ||||
| => await GetInvitesAsync(options).ConfigureAwait(false); | => await GetInvitesAsync(options).ConfigureAwait(false); | ||||
| /// <inheritdoc /> | |||||
| async Task<IInviteMetadata> IGuild.GetVanityInviteAsync(RequestOptions options) | |||||
| => await GetVanityInviteAsync(options).ConfigureAwait(false); | |||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| IRole IGuild.GetRole(ulong id) | IRole IGuild.GetRole(ulong id) | ||||