fixed the issue where manual library selection was selected, but no library was checked

This commit is contained in:
13xforever 2018-07-20 23:11:09 +05:00 committed by Roberto Anić Banić
parent 5a0c7c75ed
commit ae9fea4785
2 changed files with 25 additions and 16 deletions

View File

@ -55,26 +55,33 @@ namespace CompatBot.EventHandlers
await args.Channel.SendMessageAsync("Log analysis failed, most likely cause is a truncated/invalid log. Please run the game again and reupload the new copy.").ConfigureAwait(false);
else
{
await args.Channel.SendMessageAsync(embed: await result.AsEmbedAsync(args.Client, args.Message).ConfigureAwait(false)).ConfigureAwait(false);
if (result.Error == LogParseState.ErrorCode.PiracyDetected)
try
{
bool needsAttention = false;
try
await args.Channel.SendMessageAsync(embed: await result.AsEmbedAsync(args.Client, args.Message).ConfigureAwait(false)).ConfigureAwait(false);
if (result.Error == LogParseState.ErrorCode.PiracyDetected)
{
await message.DeleteAsync("Piracy detected in log").ConfigureAwait(false);
bool needsAttention = false;
try
{
await message.DeleteAsync("Piracy detected in log").ConfigureAwait(false);
}
catch (Exception e)
{
needsAttention = true;
args.Client.DebugLogger.LogMessage(LogLevel.Warning, "", $"Unable to delete message in {args.Channel.Name}: {e.Message}", DateTime.Now);
}
await Task.WhenAll(
args.Client.ReportAsync("Pirated Release", args.Message, result.PiracyTrigger, result.PiracyContext, needsAttention),
Warnings.AddAsync(args.Client, args.Message, args.Message.Author.Id, args.Message.Author.Username, args.Client.CurrentUser,
"Pirated Release", $"{message.Content.Sanitize()} - {result.PiracyTrigger}")
);
}
catch (Exception e)
{
needsAttention = true;
args.Client.DebugLogger.LogMessage(LogLevel.Warning, "", $"Unable to delete message in {args.Channel.Name}: {e.Message}", DateTime.Now);
}
await Task.WhenAll(
args.Client.ReportAsync("Pirated Release", args.Message, result.PiracyTrigger, result.PiracyContext, needsAttention),
Warnings.AddAsync(args.Client, args.Message, args.Message.Author.Id, args.Message.Author.Username, args.Client.CurrentUser,
"Pirated Release", $"{message.Content.Sanitize()} - {result.PiracyTrigger}")
);
}
}
catch (Exception e)
{
args.Client.DebugLogger.LogMessage(LogLevel.Error, "", "Sending log results failed: " + e, DateTime.Now);
}
}
return;
}

View File

@ -121,6 +121,8 @@ namespace CompatBot.Utils.ResultFormatters
var libList = libs.Split('\n').Select(l => l.Trim(' ', '\t', '-', '\r', '[', ']')).Where(s => !string.IsNullOrEmpty(s)).ToList();
items["library_list"] = libList.Count > 0 ? string.Join(", ", libList) : "None";
}
else
items["library_list"] = "None";
foreach (var key in items.AllKeys)
{