From f17916b9016a2cebf87e74bd426377a44efcbb32 Mon Sep 17 00:00:00 2001
From: Still Hsu <341464@gmail.com>
Date: Sun, 21 Oct 2018 10:43:59 +0800
Subject: [PATCH] Add further documentation for
https://github.com/RogueException/Discord.Net/pull/1037
---
.../Extensions/CommandServiceExtensions.cs | 30 +++++++++++++++++++
.../Extensions/EmbedBuilderExtensions.cs | 7 +++++
.../Entities/Users/SocketUser.cs | 3 ++
3 files changed, 40 insertions(+)
diff --git a/src/Discord.Net.Commands/Extensions/CommandServiceExtensions.cs b/src/Discord.Net.Commands/Extensions/CommandServiceExtensions.cs
index 675a9073d..4c2262f9b 100644
--- a/src/Discord.Net.Commands/Extensions/CommandServiceExtensions.cs
+++ b/src/Discord.Net.Commands/Extensions/CommandServiceExtensions.cs
@@ -5,8 +5,20 @@ using System.Threading.Tasks;
namespace Discord.Commands
{
+ ///
+ /// Provides extension methods for the class.
+ ///
public static class CommandServiceExtensions
{
+ ///
+ /// Returns commands that can be executed under the current context.
+ ///
+ /// The set of commands to be checked against.
+ /// The current command context.
+ /// The service provider used for dependency injection upon precondition check.
+ ///
+ /// A read-only collection of commands that can be executed under the current context.
+ ///
public static async Task> GetExecutableCommandsAsync(this ICollection commands, ICommandContext context, IServiceProvider provider)
{
var executableCommands = new List();
@@ -27,8 +39,26 @@ namespace Discord.Commands
return executableCommands;
}
+ ///
+ /// Returns commands that can be executed under the current context.
+ ///
+ /// The desired command service class to check against.
+ /// The current command context.
+ /// The service provider used for dependency injection upon precondition check.
+ ///
+ /// A read-only collection of commands that can be executed under the current context.
+ ///
public static Task> GetExecutableCommandsAsync(this CommandService commandService, ICommandContext context, IServiceProvider provider)
=> GetExecutableCommandsAsync(commandService.Commands.ToArray(), context, provider);
+ ///
+ /// Returns commands that can be executed under the current context.
+ ///
+ /// The module to be checked against.
+ /// The current command context.
+ /// The service provider used for dependency injection upon precondition check.
+ ///
+ /// A read-only collection of commands that can be executed under the current context.
+ ///
public static async Task> GetExecutableCommandsAsync(this ModuleInfo module, ICommandContext context, IServiceProvider provider)
{
var executableCommands = new List();
diff --git a/src/Discord.Net.Core/Extensions/EmbedBuilderExtensions.cs b/src/Discord.Net.Core/Extensions/EmbedBuilderExtensions.cs
index 60fdcfbee..138c8f40e 100644
--- a/src/Discord.Net.Core/Extensions/EmbedBuilderExtensions.cs
+++ b/src/Discord.Net.Core/Extensions/EmbedBuilderExtensions.cs
@@ -68,6 +68,10 @@ namespace Discord
return builder;
}
+ ///
+ /// Adds the specified fields into this .
+ ///
+ /// Field count exceeds .
public static EmbedBuilder WithFields(this EmbedBuilder builder, IEnumerable fields)
{
foreach (var field in fields)
@@ -75,6 +79,9 @@ namespace Discord
return builder;
}
+ ///
+ /// Adds the specified fields into this .
+ ///
public static EmbedBuilder WithFields(this EmbedBuilder builder, params EmbedFieldBuilder[] fields)
=> WithFields(builder, fields.AsEnumerable());
}
diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs
index 41c463a89..4832e7311 100644
--- a/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs
+++ b/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs
@@ -38,6 +38,9 @@ namespace Discord.WebSocket
public IActivity Activity => Presence.Activity;
///
public UserStatus Status => Presence.Status;
+ ///
+ /// Gets mutual guilds shared with this user.
+ ///
public IReadOnlyCollection MutualGuilds
=> Discord.Guilds.Where(g => g.Users.Any(u => u.Id == Id)).ToImmutableArray();