Ejemplo n.º 1
0
        private void OnBadRequest(CommandBadRequestEventArgs args)
        {
            var sb = new StringBuilder()
                     .AppendLine(CommandFrom(args))
                     .AppendLine(CommandIssued(args))
                     .AppendLine(ArgsPassed(args))
                     .AppendLine(InGuild(args))
                     .AppendLine(InChannel(args))
                     .AppendLine(TimeIssued(args))
                     .AppendLine(args.ExecutedLogMessage())
                     .AppendLine(After(args));

            if (args.ResultCompletionData != null)
            {
                sb.AppendLine(ResultMessage(args.ResultCompletionData));
            }
            sb.Append(_separator);
            _logger.Error(LogSource.Module, sb.ToString());
        }
Ejemplo n.º 2
0
 public Task OnBadRequestAsync(CommandBadRequestEventArgs args)
 {
     FailedCommandCalls += 1;
     Executor.Execute(() =>
     {
         _logger.Error(LogSource.Module, new StringBuilder()
                       .AppendLine($"|  -Command from user: {args.Context.User} ({args.Context.User.Id})") //yes, the spaces in front of each string are indeed intentional on all lines after this
                       .AppendLine($"                    |     -Command Issued: {args.Context.Command.Name}")
                       .AppendLine($"                    |        -Args Passed: {args.Arguments.Trim()}")
                       .AppendLine($"                    |           -In Guild: {args.Context.Guild.Name} ({args.Context.Guild.Id})")
                       .AppendLine($"                    |         -In Channel: #{args.Context.Channel.Name} ({args.Context.Channel.Id})")
                       .AppendLine($"                    |        -Time Issued: {args.Context.Now.FormatFullTime()}, {args.Context.Now.FormatDate()}")
                       .AppendLine($"                    |           -Executed: {args.Result.IsSuccessful} | Reason: {args.Result.Reason}")
                       .AppendLine($"                    |              -After: {args.Stopwatch.Elapsed.Humanize()}")
                       .AppendLineIf($"                    |     -Result Message: {args.ResultCompletionData.Message?.Id}", args.ResultCompletionData != null)
                       .Append("                    -------------------------------------------------").ToString());
     });
     return(Task.CompletedTask);
 }