when compat api lookup has only one result, use embed

This commit is contained in:
13xforever 2019-04-29 02:10:21 +05:00
parent 09f25173e6
commit 92c1db42e5

View File

@ -240,8 +240,11 @@ Example usage:
await Task.Delay(5_000).ConfigureAwait(false);
#endif
var channel = await ctx.GetChannelForSpamAsync().ConfigureAwait(false);
foreach (var msg in FormatSearchResults(ctx, result))
await channel.SendAutosplitMessageAsync(msg, blockStart:"", blockEnd:"").ConfigureAwait(false);
if (result.Results.Count == 1)
await ProductCodeLookup.LookupAndPostProductCodeEmbedAsync(ctx.Client, ctx.Message, new List<string>(result.Results.Keys)).ConfigureAwait(false);
else
foreach (var msg in FormatSearchResults(ctx, result))
await channel.SendAutosplitMessageAsync(msg, blockStart: "", blockEnd: "").ConfigureAwait(false);
}
private IEnumerable<string> FormatSearchResults(CommandContext ctx, CompatResult compatResult)