From 6797b0f0ea89a640f5a37aaca109390be6d174e5 Mon Sep 17 00:00:00 2001 From: Casino Boyale Date: Thu, 5 Jul 2018 14:27:32 +0100 Subject: [PATCH 01/17] Added documentation for SocketDMChannel, SocketGuildChannel, and SocketTextChannel --- .../Entities/Channels/SocketDMChannel.cs | 32 ++++++++++++++++- .../Entities/Channels/SocketGuildChannel.cs | 34 +++++++++++++++++++ .../Entities/Channels/SocketTextChannel.cs | 28 ++++++++++++++- 3 files changed, 92 insertions(+), 2 deletions(-) diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs index c6edbcbb7..01b5a8d09 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs @@ -18,6 +18,9 @@ namespace Discord.WebSocket { private readonly MessageCache _messages; + /// + /// Gets the recipient of the channel. + /// public SocketUser Recipient { get; } /// @@ -51,6 +54,14 @@ namespace Discord.WebSocket /// public SocketMessage GetCachedMessage(ulong id) => _messages?.Get(id); + /// + /// Gets the message associated with the passed . + /// + /// The id of the message you want to retrieve + /// The options to be used when sending the request. + /// + /// An awaitable . + /// public async Task GetMessageAsync(ulong id, RequestOptions options = null) { IMessage msg = _messages?.Get(id); @@ -58,6 +69,15 @@ namespace Discord.WebSocket msg = await ChannelHelper.GetMessageAsync(this, Discord, id, options).ConfigureAwait(false); return msg; } + + /// + /// Gets a nested collection of messages. + /// + /// The number of messages you want to get. + /// The options to be used when sending the request. + /// + /// An awaitable . + /// public IAsyncEnumerable> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) => SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, CacheMode.AllowDownload, options); public IAsyncEnumerable> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) @@ -89,9 +109,10 @@ namespace Discord.WebSocket /// Message content is too long, length must be less or equal to . public Task SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) => ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, options); - + /// public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null) => ChannelHelper.DeleteMessageAsync(this, messageId, Discord, options); + /// public Task DeleteMessageAsync(IMessage message, RequestOptions options = null) => ChannelHelper.DeleteMessageAsync(this, message.Id, Discord, options); @@ -108,6 +129,13 @@ namespace Discord.WebSocket => _messages?.Remove(id); //Users + /// + /// Gets a user in this channel from the passed . + /// + /// The id of the user you want to get. + /// + /// The recipient, or the CurrentUSer otherwise; null + /// public new SocketUser GetUser(ulong id) { if (id == Recipient.Id) @@ -164,8 +192,10 @@ namespace Discord.WebSocket /// async Task> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options) => await GetPinnedMessagesAsync(options).ConfigureAwait(false); + /// async Task IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options) => await SendFileAsync(filePath, text, isTTS, embed, options).ConfigureAwait(false); + /// async Task IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options) => await SendFileAsync(stream, filename, text, isTTS, embed, options).ConfigureAwait(false); /// diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs index 43cc26f6d..6a8372404 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs @@ -141,6 +141,14 @@ namespace Discord.WebSocket await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, role, perms, options).ConfigureAwait(false); _overwrites = _overwrites.Add(new Overwrite(role.Id, PermissionTarget.Role, new OverwritePermissions(perms.AllowValue, perms.DenyValue))); } + /// + /// Removes an overwrite permission for the specified . + /// + /// The user you want to remove the overwrite permission from. + /// The options to be used when sending the request. + /// + /// An awaitable . + /// public async Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null) { await ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, user, options).ConfigureAwait(false); @@ -154,6 +162,14 @@ namespace Discord.WebSocket } } } + /// + /// Removes an overwrite permission for the specified . + /// + /// The role you want the overwrite permissions to be removed from. + /// The options to be used when sending the request. + /// + /// An awaitable . + /// public async Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null) { await ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, role, options).ConfigureAwait(false); @@ -168,8 +184,26 @@ namespace Discord.WebSocket } } + /// + /// Gets the invites for this channel. + /// + /// The options to be used when sending the request. + /// + /// An awaitable . + /// public async Task> GetInvitesAsync(RequestOptions options = null) => await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); + /// + /// Creates an invite for this channel. + /// + /// The number of seconds that you want the invite to be valid for. + /// The number of times this invite can be used before it expires. + /// Whether or not the invite grants temporary membership. + /// Whether to try reuse a similar invite or not. + /// The options to be used when sending the request. + /// + /// An awaitable . + /// public async Task CreateInviteAsync(int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null) => await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs index 5909421d5..9c5d15fc0 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs @@ -20,7 +20,14 @@ namespace Discord.WebSocket /// public string Topic { get; private set; } + /// public ulong? CategoryId { get; private set; } + /// + /// Gets the Category this channel belongs to. + /// + /// + /// An that this channel belongs to otherwise; null. + /// public ICategoryChannel Category => CategoryId.HasValue ? Guild.GetChannel(CategoryId.Value) as ICategoryChannel : null; @@ -66,6 +73,15 @@ namespace Discord.WebSocket /// public SocketMessage GetCachedMessage(ulong id) => _messages?.Get(id); + + /// + /// Gets the message associated with the passed . + /// + /// The id of the message you want to retrieve + /// The options to be used when sending the request. + /// + /// An awaitable . + /// public async Task GetMessageAsync(ulong id, RequestOptions options = null) { IMessage msg = _messages?.Get(id); @@ -73,6 +89,15 @@ namespace Discord.WebSocket msg = await ChannelHelper.GetMessageAsync(this, Discord, id, options).ConfigureAwait(false); return msg; } + + /// + /// Gets a nested collection of messages. + /// + /// The number of messages you want to get. + /// The options to be used when sending the request. + /// + /// An awaitable . + /// public IAsyncEnumerable> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) => SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, CacheMode.AllowDownload, options); public IAsyncEnumerable> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) @@ -109,9 +134,10 @@ namespace Discord.WebSocket /// public Task DeleteMessagesAsync(IEnumerable messageIds, RequestOptions options = null) => ChannelHelper.DeleteMessagesAsync(this, Discord, messageIds, options); - + /// public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null) => ChannelHelper.DeleteMessageAsync(this, messageId, Discord, options); + /// public Task DeleteMessageAsync(IMessage message, RequestOptions options = null) => ChannelHelper.DeleteMessageAsync(this, message.Id, Discord, options); From 3018f8ef427929498be7d852b074b177e21aaff3 Mon Sep 17 00:00:00 2001 From: Casino Boyale Date: Sat, 7 Jul 2018 15:43:54 +0100 Subject: [PATCH 02/17] Corrections to SocketGuildChannel --- .../Entities/Channels/SocketGuildChannel.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs index 6a8372404..19b5c297a 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs @@ -189,7 +189,7 @@ namespace Discord.WebSocket /// /// The options to be used when sending the request. /// - /// An awaitable . + /// An awaitable containing a . /// public async Task> GetInvitesAsync(RequestOptions options = null) => await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); @@ -202,7 +202,7 @@ namespace Discord.WebSocket /// Whether to try reuse a similar invite or not. /// The options to be used when sending the request. /// - /// An awaitable . + /// An awaitable containing a . /// public async Task CreateInviteAsync(int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null) => await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); From 4b18759e7da0b961739caef8d49b2a8fe47b9818 Mon Sep 17 00:00:00 2001 From: Casino Boyale Date: Sat, 7 Jul 2018 15:45:49 +0100 Subject: [PATCH 03/17] Corrections to SocketTextChannel --- .../Entities/Channels/SocketTextChannel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs index 9c5d15fc0..518990034 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs @@ -96,7 +96,7 @@ namespace Discord.WebSocket /// The number of messages you want to get. /// The options to be used when sending the request. /// - /// An awaitable . + /// An awaitable containing an . /// public IAsyncEnumerable> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) => SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, CacheMode.AllowDownload, options); From 02ddca1510d9ec8d144d3517088f4ea577d96f3b Mon Sep 17 00:00:00 2001 From: Casino Boyale Date: Sat, 7 Jul 2018 15:53:04 +0100 Subject: [PATCH 04/17] Corrections to SocketDMChannel --- .../Entities/Channels/SocketDMChannel.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs index 01b5a8d09..81e12e5de 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs @@ -57,10 +57,10 @@ namespace Discord.WebSocket /// /// Gets the message associated with the passed . /// - /// The id of the message you want to retrieve + /// The snowflake identifier of the message you want to retrieve. /// The options to be used when sending the request. /// - /// An awaitable . + /// An awaitable containing an . /// public async Task GetMessageAsync(ulong id, RequestOptions options = null) { @@ -76,7 +76,7 @@ namespace Discord.WebSocket /// The number of messages you want to get. /// The options to be used when sending the request. /// - /// An awaitable . + /// An awaitable containing an . /// public IAsyncEnumerable> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) => SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, CacheMode.AllowDownload, options); @@ -130,11 +130,11 @@ namespace Discord.WebSocket //Users /// - /// Gets a user in this channel from the passed . + /// Gets a user in this channel from the provided . /// - /// The id of the user you want to get. + /// The ID of the user. /// - /// The recipient, or the CurrentUSer otherwise; null + /// A object that is a recipient of this channel; otherwise null. /// public new SocketUser GetUser(ulong id) { From b1c955b8bc38b5ce4646de1f9cf0735fefa9b18e Mon Sep 17 00:00:00 2001 From: Casino Boyale Date: Sat, 7 Jul 2018 15:55:54 +0100 Subject: [PATCH 05/17] Swapped out 'id' for 'snowflake identifier --- src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs | 2 +- .../Entities/Channels/SocketTextChannel.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs index 81e12e5de..f76ce46c0 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs @@ -132,7 +132,7 @@ namespace Discord.WebSocket /// /// Gets a user in this channel from the provided . /// - /// The ID of the user. + /// The snowflake identifier of the user. /// /// A object that is a recipient of this channel; otherwise null. /// diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs index 518990034..4984fb54a 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs @@ -77,7 +77,7 @@ namespace Discord.WebSocket /// /// Gets the message associated with the passed . /// - /// The id of the message you want to retrieve + /// The snowflake identifier of the message you want to retrieve /// The options to be used when sending the request. /// /// An awaitable . From 80b128479f24db387bf0a88c8760ed99099a84e4 Mon Sep 17 00:00:00 2001 From: Casino Boyale Date: Sat, 7 Jul 2018 15:55:54 +0100 Subject: [PATCH 06/17] Swapped out 'id' for 'snowflake identifier' --- src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs | 2 +- .../Entities/Channels/SocketTextChannel.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs index 81e12e5de..f76ce46c0 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs @@ -132,7 +132,7 @@ namespace Discord.WebSocket /// /// Gets a user in this channel from the provided . /// - /// The ID of the user. + /// The snowflake identifier of the user. /// /// A object that is a recipient of this channel; otherwise null. /// diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs index 518990034..4984fb54a 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs @@ -77,7 +77,7 @@ namespace Discord.WebSocket /// /// Gets the message associated with the passed . /// - /// The id of the message you want to retrieve + /// The snowflake identifier of the message you want to retrieve /// The options to be used when sending the request. /// /// An awaitable . From 5346defe84d1f5394a8539be6da4117558c06bd0 Mon Sep 17 00:00:00 2001 From: Casino Boyale Date: Tue, 10 Jul 2018 21:01:10 +0100 Subject: [PATCH 07/17] SocketDMChannel amendments --- .../Entities/Channels/SocketDMChannel.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs index f76ce46c0..c0a042669 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs @@ -55,12 +55,12 @@ namespace Discord.WebSocket public SocketMessage GetCachedMessage(ulong id) => _messages?.Get(id); /// - /// Gets the message associated with the passed . + /// Gets the message associated with the given . /// - /// The snowflake identifier of the message you want to retrieve. + /// TThe ID of the message. /// The options to be used when sending the request. /// - /// An awaitable containing an . + /// The message gotten from either the cache or the download, or null if none is found. /// public async Task GetMessageAsync(ulong id, RequestOptions options = null) { @@ -71,12 +71,13 @@ namespace Discord.WebSocket } /// - /// Gets a nested collection of messages. + /// Gets the last N messages from this channel. /// - /// The number of messages you want to get. + /// The number of messages to get. /// The options to be used when sending the request. /// - /// An awaitable containing an . + /// Paged collection of messages. Flattening the paginated response into a collection of messages with + /// is required if you wish to access the messages. /// public IAsyncEnumerable> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) => SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, CacheMode.AllowDownload, options); From 0a149eb420054a9fa33e7bd2594824fbe337754c Mon Sep 17 00:00:00 2001 From: Casino Boyale Date: Tue, 10 Jul 2018 21:05:51 +0100 Subject: [PATCH 08/17] SocketGuildChannel amendments --- .../Entities/Channels/SocketGuildChannel.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs index 19b5c297a..d9b4e494c 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs @@ -189,7 +189,9 @@ namespace Discord.WebSocket /// /// The options to be used when sending the request. /// - /// An awaitable containing a . + /// An awaitable containing an . + /// contains information such as, the number of times the invite has + /// been used, who created the invite, and when the invite was created. /// public async Task> GetInvitesAsync(RequestOptions options = null) => await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); From 32c9d0e2dd5d06c75277a77e108bb22c73c00c1a Mon Sep 17 00:00:00 2001 From: Casino Boyale Date: Tue, 10 Jul 2018 21:08:17 +0100 Subject: [PATCH 09/17] SocketTextChannel amendments --- .../Entities/Channels/SocketTextChannel.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs index 4984fb54a..e18bd9be8 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs @@ -26,7 +26,7 @@ namespace Discord.WebSocket /// Gets the Category this channel belongs to. /// /// - /// An that this channel belongs to otherwise; null. + /// An that this channel belongs to; otherwise null. /// public ICategoryChannel Category => CategoryId.HasValue ? Guild.GetChannel(CategoryId.Value) as ICategoryChannel : null; @@ -77,10 +77,10 @@ namespace Discord.WebSocket /// /// Gets the message associated with the passed . /// - /// The snowflake identifier of the message you want to retrieve + /// The snowflake identifier of the message you want to retrieve. /// The options to be used when sending the request. /// - /// An awaitable . + /// An awaitable containing an . /// public async Task GetMessageAsync(ulong id, RequestOptions options = null) { @@ -91,12 +91,13 @@ namespace Discord.WebSocket } /// - /// Gets a nested collection of messages. + /// Gets the last N messages from this message channel. /// /// The number of messages you want to get. /// The options to be used when sending the request. /// - /// An awaitable containing an . + /// Paged collection of messages. Flattening the paginated response into a collection of messages with + /// is required if you wish to access the messages. /// public IAsyncEnumerable> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) => SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, CacheMode.AllowDownload, options); From b40ab464cce8f9c1b009bd08638e4297bcc952e3 Mon Sep 17 00:00:00 2001 From: Casino Boyale Date: Thu, 12 Jul 2018 01:58:47 +0100 Subject: [PATCH 10/17] Added RestDMChannel documentation --- .../Entities/Channels/RestDMChannel.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Discord.Net.Rest/Entities/Channels/RestDMChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestDMChannel.cs index 14d19bfa3..ddb4f9b10 100644 --- a/src/Discord.Net.Rest/Entities/Channels/RestDMChannel.cs +++ b/src/Discord.Net.Rest/Entities/Channels/RestDMChannel.cs @@ -47,6 +47,14 @@ namespace Discord.Rest public Task CloseAsync(RequestOptions options = null) => ChannelHelper.DeleteAsync(this, Discord, options); + + /// + /// Gets a user in this channel from the provided . + /// + /// The snowflake identifier of the user. + /// + /// A object that is a recipient of this channel; otherwise null. + /// public RestUser GetUser(ulong id) { if (id == Recipient.Id) @@ -175,10 +183,10 @@ namespace Discord.Rest /// async Task> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options) => await GetPinnedMessagesAsync(options).ConfigureAwait(false); - + /// async Task IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options) => await SendFileAsync(filePath, text, isTTS, embed, options).ConfigureAwait(false); - + /// async Task IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options) => await SendFileAsync(stream, filename, text, isTTS, embed, options).ConfigureAwait(false); /// From 908f29b5486c3d3a9b835053de38a44c9d2e1cc1 Mon Sep 17 00:00:00 2001 From: Casino Boyale Date: Thu, 12 Jul 2018 02:06:45 +0100 Subject: [PATCH 11/17] Added RestGuildChannel documentation --- .../Entities/Channels/RestGuildChannel.cs | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs index cc52a9864..5895500bd 100644 --- a/src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs +++ b/src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs @@ -72,6 +72,13 @@ namespace Discord.Rest public Task DeleteAsync(RequestOptions options = null) => ChannelHelper.DeleteAsync(this, Discord, options); + /// + /// Gets the overwrite permissions of the specified . + /// + /// The user that you want to get the overwrite permissions for. + /// + /// The overwrite permissions for the requested user; otherwise null. + /// public OverwritePermissions? GetPermissionOverwrite(IUser user) { for (int i = 0; i < _overwrites.Length; i++) @@ -81,6 +88,14 @@ namespace Discord.Rest } return null; } + + /// + /// Gets the overwrite permissions of the specified . + /// + /// The role that you want to get the overwrite permissions for. + /// + /// The overwrite permissions for the requested role; otherwise null. + /// public OverwritePermissions? GetPermissionOverwrite(IRole role) { for (int i = 0; i < _overwrites.Length; i++) @@ -90,16 +105,45 @@ namespace Discord.Rest } return null; } + + /// + /// Adds an overwrite permission for the specified . + /// + /// The user you want the overwrite permission to apply to. + /// The overwrite permission you want to add. + /// The options to be used when sending the request. + /// + /// An awaitable . + /// public async Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions perms, RequestOptions options = null) { await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, user, perms, options).ConfigureAwait(false); _overwrites = _overwrites.Add(new Overwrite(user.Id, PermissionTarget.User, new OverwritePermissions(perms.AllowValue, perms.DenyValue))); } + + /// + /// Adds an overwrite permission for the specified . + /// + /// The role you want the overwrite permission to apply to. + /// The overwrite permission you want to add. + /// The options to be used when sending the request. + /// + /// An awaitable . + /// public async Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions perms, RequestOptions options = null) { await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, role, perms, options).ConfigureAwait(false); _overwrites = _overwrites.Add(new Overwrite(role.Id, PermissionTarget.Role, new OverwritePermissions(perms.AllowValue, perms.DenyValue))); } + + /// + /// Removes an overwrite permission for the specified . + /// + /// The user you want to remove the overwrite permission from. + /// The options to be used when sending the request. + /// + /// An awaitable . + /// public async Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null) { await ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, user, options).ConfigureAwait(false); @@ -113,6 +157,15 @@ namespace Discord.Rest } } } + + /// + /// Removes an overwrite permission for the specified . + /// + /// The role you want the overwrite permissions to be removed from. + /// The options to be used when sending the request. + /// + /// An awaitable . + /// public async Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null) { await ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, role, options).ConfigureAwait(false); @@ -127,11 +180,38 @@ namespace Discord.Rest } } + /// + /// Gets the invites for this channel. + /// + /// The options to be used when sending the request. + /// + /// An awaitable containing an . + /// contains information such as, the number of times the invite has + /// been used, who created the invite, and when the invite was created. + /// public async Task> GetInvitesAsync(RequestOptions options = null) => await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); + + /// + /// Creates an invite for this channel. + /// + /// The number of seconds that you want the invite to be valid for. + /// The number of times this invite can be used before it expires. + /// Whether or not the invite grants temporary membership. + /// Whether to try reuse a similar invite or not. + /// The options to be used when sending the request. + /// + /// An awaitable containing a . + /// public async Task CreateInviteAsync(int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null) => await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); + /// + /// Gets the name of this channel. + /// + /// + /// A string that is the name of this channel. + /// public override string ToString() => Name; //IGuildChannel From 44c526298e03cd71c9454378b26349b360503410 Mon Sep 17 00:00:00 2001 From: Casino Boyale Date: Thu, 12 Jul 2018 02:22:18 +0100 Subject: [PATCH 12/17] Added RestTextChannel documentation --- .../Entities/Channels/RestTextChannel.cs | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs index f1a282dc9..b7409c180 100644 --- a/src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs +++ b/src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs @@ -49,8 +49,25 @@ namespace Discord.Rest Update(model); } + /// + /// Gets a user that is able to view this channel from the associate . + /// + /// The snowflake identifier of the user you want to get. + /// The options to be used when sending the request. + /// + /// An awaitable containing a . + /// public Task GetUserAsync(ulong id, RequestOptions options = null) => ChannelHelper.GetUserAsync(this, Guild, Discord, id, options); + + /// + /// Gets the collection of users that can view this channel. + /// + /// The options to be used when sending the request. + /// + /// Paged collection of users. Flattening the paginated response into a collection of + /// with is required if you wish to access the users. + /// public IAsyncEnumerable> GetUsersAsync(RequestOptions options = null) => ChannelHelper.GetUsersAsync(this, Guild, Discord, null, null, options); @@ -128,7 +145,16 @@ namespace Discord.Rest /// public IDisposable EnterTypingState(RequestOptions options = null) => ChannelHelper.EnterTypingState(this, Discord, options); - + + /// + /// Creates a webhook for this channel. + /// + /// The name you want to give the webhook. + /// The avatar that you want the webook to have. + /// The options to be used when sending the request. + /// + /// An awaitable containing a . + /// public Task CreateWebhookAsync(string name, Stream avatar = null, RequestOptions options = null) => ChannelHelper.CreateWebhookAsync(this, Discord, name, avatar, options); public Task GetWebhookAsync(ulong id, RequestOptions options = null) @@ -136,6 +162,13 @@ namespace Discord.Rest public Task> GetWebhooksAsync(RequestOptions options = null) => ChannelHelper.GetWebhooksAsync(this, Discord, options); + /// + /// Gets the parent category of this channel. + /// + /// The options to be used when sending the request. + /// + /// An awaitable containing an . + /// public Task GetCategoryAsync(RequestOptions options = null) => ChannelHelper.GetCategoryAsync(this, Discord, options); From c9ef0e26e23f3cba5eb66bbaa8b0301d2d33945c Mon Sep 17 00:00:00 2001 From: Casino Boyale Date: Thu, 12 Jul 2018 02:22:38 +0100 Subject: [PATCH 13/17] Added RestVoiceChannel documentation --- src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs index a2b086258..6fd068ed1 100644 --- a/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs +++ b/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs @@ -47,6 +47,13 @@ namespace Discord.Rest Update(model); } + /// + /// Gets the parent category of this channel. + /// + /// The options to be used when sending the request. + /// + /// An awaitable containing an . + /// public Task GetCategoryAsync(RequestOptions options = null) => ChannelHelper.GetCategoryAsync(this, Discord, options); From 1789a8158c7748fc2fe1d9164051ed7465925923 Mon Sep 17 00:00:00 2001 From: Casino Boyale Date: Thu, 12 Jul 2018 02:25:18 +0100 Subject: [PATCH 14/17] Added RestUser documentation --- src/Discord.Net.Rest/Entities/Users/RestUser.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Discord.Net.Rest/Entities/Users/RestUser.cs b/src/Discord.Net.Rest/Entities/Users/RestUser.cs index 47c3f8b98..e08f500c4 100644 --- a/src/Discord.Net.Rest/Entities/Users/RestUser.cs +++ b/src/Discord.Net.Rest/Entities/Users/RestUser.cs @@ -76,6 +76,12 @@ namespace Discord.Rest public string GetDefaultAvatarUrl() => CDN.GetDefaultUserAvatarUrl(DiscriminatorValue); + /// + /// Gets the Username#Descriminator of the user. + /// + /// + /// A string that is the Username#Descriminator of the user. + /// public override string ToString() => $"{Username}#{Discriminator}"; private string DebuggerDisplay => $"{Username}#{Discriminator} ({Id}{(IsBot ? ", Bot" : "")})"; From 09cd5b8ded20c78484ee89b031154e71ae6ec7ca Mon Sep 17 00:00:00 2001 From: Casino Boyale Date: Thu, 12 Jul 2018 02:26:50 +0100 Subject: [PATCH 15/17] Added RestRole documentation --- src/Discord.Net.Rest/Entities/Roles/RestRole.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Discord.Net.Rest/Entities/Roles/RestRole.cs b/src/Discord.Net.Rest/Entities/Roles/RestRole.cs index 5ea7f4462..a12d80732 100644 --- a/src/Discord.Net.Rest/Entities/Roles/RestRole.cs +++ b/src/Discord.Net.Rest/Entities/Roles/RestRole.cs @@ -26,6 +26,9 @@ namespace Discord.Rest /// public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); + /// + /// Gets if this role is the @everyone role of the guild or not. + /// public bool IsEveryone => Id == Guild.Id; /// public string Mention => IsEveryone ? "@everyone" : MentionUtils.MentionRole(Id); @@ -65,6 +68,12 @@ namespace Discord.Rest /// public int CompareTo(IRole role) => RoleUtils.Compare(this, role); + /// + /// Gets the name of the role. + /// + /// + /// A string that is the name of the role. + /// public override string ToString() => Name; private string DebuggerDisplay => $"{Name} ({Id})"; From bd51b9bdb2af950efcbd5e539d95cf7645094a72 Mon Sep 17 00:00:00 2001 From: Casino Boyale Date: Thu, 12 Jul 2018 02:33:16 +0100 Subject: [PATCH 16/17] Added RestMessage documentation --- .../Entities/Messages/RestMessage.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs b/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs index 6d18beaad..c6ca82604 100644 --- a/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs +++ b/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs @@ -13,6 +13,9 @@ namespace Discord.Rest /// public IMessageChannel Channel { get; } + /// + /// Gets the Author of the message. + /// public IUser Author { get; } /// public MessageSource Source { get; } @@ -28,12 +31,21 @@ namespace Discord.Rest public virtual bool IsPinned => false; /// public virtual DateTimeOffset? EditedTimestamp => null; + /// + /// Gets a collection of the 's on the message. + /// public virtual IReadOnlyCollection Attachments => ImmutableArray.Create(); + /// + /// Gets a collection of the 's on the message. + /// public virtual IReadOnlyCollection Embeds => ImmutableArray.Create(); /// public virtual IReadOnlyCollection MentionedChannelIds => ImmutableArray.Create(); /// public virtual IReadOnlyCollection MentionedRoleIds => ImmutableArray.Create(); + /// + /// Gets a collection of the mentioned users in the message. + /// public virtual IReadOnlyCollection MentionedUsers => ImmutableArray.Create(); /// public virtual IReadOnlyCollection Tags => ImmutableArray.Create(); @@ -74,6 +86,12 @@ namespace Discord.Rest public Task DeleteAsync(RequestOptions options = null) => MessageHelper.DeleteAsync(this, Discord, options); + /// + /// Gets the of the message. + /// + /// + /// A string that is the of the message. + /// public override string ToString() => Content; /// From ef07d73e6e87f3d027a229290f8ee592bf22acaa Mon Sep 17 00:00:00 2001 From: Joe4evr Date: Fri, 13 Jul 2018 08:58:03 +0200 Subject: [PATCH 17/17] Slightly better wording --- .../Attributes/ParameterPreconditionAttribute.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Discord.Net.Commands/Attributes/ParameterPreconditionAttribute.cs b/src/Discord.Net.Commands/Attributes/ParameterPreconditionAttribute.cs index 9b750809b..8ee46f9f9 100644 --- a/src/Discord.Net.Commands/Attributes/ParameterPreconditionAttribute.cs +++ b/src/Discord.Net.Commands/Attributes/ParameterPreconditionAttribute.cs @@ -15,7 +15,7 @@ namespace Discord.Commands /// /// The context of the command. /// The parameter of the command being checked against. - /// The raw value of the type. + /// The raw value of the parameter. /// The service collection used for dependency injection. public abstract Task CheckPermissionsAsync(ICommandContext context, ParameterInfo parameter, object value, IServiceProvider services); }