diff --git a/src/Discord.Net.Commands/Attributes/CommandAttribute.cs b/src/Discord.Net.Commands/Attributes/CommandAttribute.cs
index 5f8e9ceaf..e1fc59a73 100644
--- a/src/Discord.Net.Commands/Attributes/CommandAttribute.cs
+++ b/src/Discord.Net.Commands/Attributes/CommandAttribute.cs
@@ -2,10 +2,17 @@ using System;
namespace Discord.Commands
{
+ /// Provides the execution information for a command.
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class CommandAttribute : Attribute
{
+ ///
+ /// Specifies the text required to be recognized as a command.
+ ///
public string Text { get; }
+ ///
+ /// Specifies the of the command. This affects how the command is executed.
+ ///
public RunMode RunMode { get; set; } = RunMode.Default;
public CommandAttribute()
diff --git a/src/Discord.Net.Commands/Attributes/Preconditions/RequireBotPermissionAttribute.cs b/src/Discord.Net.Commands/Attributes/Preconditions/RequireBotPermissionAttribute.cs
index 104252799..1afe82685 100644
--- a/src/Discord.Net.Commands/Attributes/Preconditions/RequireBotPermissionAttribute.cs
+++ b/src/Discord.Net.Commands/Attributes/Preconditions/RequireBotPermissionAttribute.cs
@@ -1,10 +1,10 @@
-using System;
+using System;
using System.Threading.Tasks;
namespace Discord.Commands
{
///
- /// This attribute requires that the bot has a specified permission in the channel a command is invoked in.
+ /// This attribute requires the bot to have a specific permission in the channel a command is invoked in.
///
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class RequireBotPermissionAttribute : PreconditionAttribute
@@ -13,7 +13,7 @@ namespace Discord.Commands
public ChannelPermission? ChannelPermission { get; }
///
- /// Require that the bot account has a specified GuildPermission
+ /// Requires that the bot account to have a specific .
///
/// This precondition will always fail if the command is being invoked in a private channel.
/// The GuildPermission that the bot must have. Multiple permissions can be specified by ORing the permissions together.
@@ -23,7 +23,7 @@ namespace Discord.Commands
ChannelPermission = null;
}
///
- /// Require that the bot account has a specified ChannelPermission.
+ /// Requires that the bot account to have a specific .
///
/// The ChannelPermission that the bot must have. Multiple permissions can be specified by ORing the permissions together.
///
diff --git a/src/Discord.Net.Commands/Attributes/Preconditions/RequireContextAttribute.cs b/src/Discord.Net.Commands/Attributes/Preconditions/RequireContextAttribute.cs
index 90af035e4..252d8b5f2 100644
--- a/src/Discord.Net.Commands/Attributes/Preconditions/RequireContextAttribute.cs
+++ b/src/Discord.Net.Commands/Attributes/Preconditions/RequireContextAttribute.cs
@@ -13,7 +13,7 @@ namespace Discord.Commands
}
///
- /// Require that the command be invoked in a specified context.
+ /// This attribute requires that the command be invoked in a specified context. (e.g. in guild, DM)
///
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class RequireContextAttribute : PreconditionAttribute
@@ -21,7 +21,7 @@ namespace Discord.Commands
public ContextType Contexts { get; }
///
- /// Require that the command be invoked in a specified context.
+ /// Requires that the command be invoked in the specified context.
///
/// The type of context the command can be invoked in. Multiple contexts can be specified by ORing the contexts together.
///
diff --git a/src/Discord.Net.Commands/Attributes/Preconditions/RequireNsfwAttribute.cs b/src/Discord.Net.Commands/Attributes/Preconditions/RequireNsfwAttribute.cs
index 273c764bd..baff01d8c 100644
--- a/src/Discord.Net.Commands/Attributes/Preconditions/RequireNsfwAttribute.cs
+++ b/src/Discord.Net.Commands/Attributes/Preconditions/RequireNsfwAttribute.cs
@@ -4,7 +4,7 @@ using System.Threading.Tasks;
namespace Discord.Commands
{
///
- /// Require that the command is invoked in a channel marked NSFW
+ /// This attribute requires that the command to be invoked in a channel marked NSFW.
///
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class RequireNsfwAttribute : PreconditionAttribute
diff --git a/src/Discord.Net.Commands/Attributes/Preconditions/RequireOwnerAttribute.cs b/src/Discord.Net.Commands/Attributes/Preconditions/RequireOwnerAttribute.cs
index 93e3cbe18..bf6a3352e 100644
--- a/src/Discord.Net.Commands/Attributes/Preconditions/RequireOwnerAttribute.cs
+++ b/src/Discord.Net.Commands/Attributes/Preconditions/RequireOwnerAttribute.cs
@@ -4,7 +4,7 @@ using System.Threading.Tasks;
namespace Discord.Commands
{
///
- /// Require that the command is invoked by the owner of the bot.
+ /// This attribute requires that the command to be invoked by the owner of the bot.
///
/// This precondition will only work if the bot is a bot account.
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
diff --git a/src/Discord.Net.Commands/Attributes/Preconditions/RequireUserPermissionAttribute.cs b/src/Discord.Net.Commands/Attributes/Preconditions/RequireUserPermissionAttribute.cs
index 14121f35b..7aaeab064 100644
--- a/src/Discord.Net.Commands/Attributes/Preconditions/RequireUserPermissionAttribute.cs
+++ b/src/Discord.Net.Commands/Attributes/Preconditions/RequireUserPermissionAttribute.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Threading.Tasks;
namespace Discord.Commands
@@ -13,7 +13,7 @@ namespace Discord.Commands
public ChannelPermission? ChannelPermission { get; }
///
- /// Require that the user invoking the command has a specified GuildPermission
+ /// Requires that the user invoking the command to have a specific .
///
/// This precondition will always fail if the command is being invoked in a private channel.
/// The GuildPermission that the user must have. Multiple permissions can be specified by ORing the permissions together.
@@ -23,7 +23,7 @@ namespace Discord.Commands
ChannelPermission = null;
}
///
- /// Require that the user invoking the command has a specified ChannelPermission.
+ /// Requires that the user invoking the command to have a specific .
///
/// The ChannelPermission that the user must have. Multiple permissions can be specified by ORing the permissions together.
///
diff --git a/src/Discord.Net.Commands/CommandContext.cs b/src/Discord.Net.Commands/CommandContext.cs
index 05bde56b1..d884d8b29 100644
--- a/src/Discord.Net.Commands/CommandContext.cs
+++ b/src/Discord.Net.Commands/CommandContext.cs
@@ -1,13 +1,19 @@
-namespace Discord.Commands
+namespace Discord.Commands
{
public class CommandContext : ICommandContext
{
+ ///
public IDiscordClient Client { get; }
+ ///
public IGuild Guild { get; }
+ ///
public IMessageChannel Channel { get; }
+ ///
public IUser User { get; }
+ ///
public IUserMessage Message { get; }
+ /// Indicates whether the channel that the command is executed in is a private channel.
public bool IsPrivate => Channel is IPrivateChannel;
public CommandContext(IDiscordClient client, IUserMessage msg)
diff --git a/src/Discord.Net.Commands/CommandException.cs b/src/Discord.Net.Commands/CommandException.cs
index d5300841a..1584641b3 100644
--- a/src/Discord.Net.Commands/CommandException.cs
+++ b/src/Discord.Net.Commands/CommandException.cs
@@ -4,7 +4,9 @@ namespace Discord.Commands
{
public class CommandException : Exception
{
+ /// The command that caused the exception.
public CommandInfo Command { get; }
+ /// The command context of the exception.
public ICommandContext Context { get; }
public CommandException(CommandInfo command, ICommandContext context, Exception ex)
diff --git a/src/Discord.Net.Commands/CommandMatch.cs b/src/Discord.Net.Commands/CommandMatch.cs
index d922a2229..6411ef084 100644
--- a/src/Discord.Net.Commands/CommandMatch.cs
+++ b/src/Discord.Net.Commands/CommandMatch.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
@@ -7,7 +7,9 @@ namespace Discord.Commands
{
public struct CommandMatch
{
+ /// The command that matches the search result.
public CommandInfo Command { get; }
+ /// The alias of the command.
public string Alias { get; }
public CommandMatch(CommandInfo command, string alias)
diff --git a/src/Discord.Net.Commands/Info/CommandInfo.cs b/src/Discord.Net.Commands/Info/CommandInfo.cs
index f0d406e8d..75f3f56eb 100644
--- a/src/Discord.Net.Commands/Info/CommandInfo.cs
+++ b/src/Discord.Net.Commands/Info/CommandInfo.cs
@@ -12,6 +12,11 @@ using Microsoft.Extensions.DependencyInjection;
namespace Discord.Commands
{
+ /// The information of a command.
+ ///
+ /// This object contains the information of a command.
+ /// This can include the module of the command, various descriptions regarding the command, and its .
+ ///
[DebuggerDisplay("{Name,nq}")]
public class CommandInfo
{
@@ -21,17 +26,36 @@ namespace Discord.Commands
private readonly CommandService _commandService;
private readonly Func _action;
+ /// The module that the command belongs in.
public ModuleInfo Module { get; }
+ /// Name of the command. If none is set, the first alias is used.
public string Name { get; }
+ /// Summary of the command.
+ ///
+ /// This field returns the summary of the command.
+ /// Summary and remarks can be useful in help commands and various implementation that fetches details of the command for the user.
+ ///
public string Summary { get; }
+ /// Remarks of the command.
+ ///
+ /// This field returns the remarks of the command.
+ /// Summary and remarks can be useful in help commands and various implementation that fetches details of the command for the user.
+ ///
public string Remarks { get; }
+ /// The priority of the command. This is used when there are multiple overloads of the command.
public int Priority { get; }
+ /// Indicates whether the command accepts a [] for its parameter.
public bool HasVarArgs { get; }
+ /// Indicates the that is being used for the command.
public RunMode RunMode { get; }
+ /// List of aliases defined by the of the command.
public IReadOnlyList Aliases { get; }
+ /// List of information about the parameters of the command.
public IReadOnlyList Parameters { get; }
+ /// List of preconditions defined by the of the command.
public IReadOnlyList Preconditions { get; }
+ /// List of attributes of the command.
public IReadOnlyList Attributes { get; }
internal CommandInfo(CommandBuilder builder, ModuleInfo module, CommandService service)
@@ -122,6 +146,7 @@ namespace Discord.Commands
return await CommandParser.ParseArgsAsync(this, context, _commandService._ignoreExtraArgs, services, input, 0).ConfigureAwait(false);
}
+ /// Executes the command with the provided context, parsed value, and service provider.
public Task ExecuteAsync(ICommandContext context, ParseResult parseResult, IServiceProvider services)
{
if (!parseResult.IsSuccess)
@@ -145,6 +170,7 @@ namespace Discord.Commands
return ExecuteAsync(context, argList, paramList, services);
}
+ /// Executes the command with the provided context, argument and parameter list, and service provider.
public async Task ExecuteAsync(ICommandContext context, IEnumerable