Browse Source

Don't force a bad permission message

tags/docs-0.9
RogueException 9 years ago
parent
commit
8f4bbe66ea
1 changed files with 2 additions and 4 deletions
  1. +2
    -4
      src/Discord.Net.Commands/CommandService.cs

+ 2
- 4
src/Discord.Net.Commands/CommandService.cs View File

@@ -9,8 +9,6 @@ namespace Discord.Commands
/// <summary> A Discord.Net client with extensions for handling common bot operations like text commands. </summary>
public sealed partial class CommandService : IService
{
private const string DefaultPermissionError = "You do not have permission to access this command.";

private readonly CommandServiceConfig _config;
private readonly CommandGroupBuilder _root;
private DiscordClient _client;
@@ -117,7 +115,7 @@ namespace Discord.Commands
string errorText;
if (!command.CanRun(eventArgs.User, eventArgs.Channel, out errorText))
{
RaiseCommandError(CommandErrorType.BadPermissions, eventArgs, new Exception(errorText ?? DefaultPermissionError));
RaiseCommandError(CommandErrorType.BadPermissions, eventArgs, errorText != null ? new Exception(errorText) : null);
return;
}

@@ -262,7 +260,7 @@ namespace Discord.Commands
StringBuilder output = new StringBuilder();
string error;
if (!command.CanRun(user, channel, out error))
output.AppendLine(error ?? DefaultPermissionError);
output.AppendLine(error ?? "You do not have permission to access this command.");
else
ShowCommandHelpInternal(command, user, channel, output);
return (replyChannel ?? channel).SendMessage(output.ToString());


Loading…
Cancel
Save