From 8a9581a7e6ac81bcf7207ba5390eac8b0b824e4a Mon Sep 17 00:00:00 2001 From: Kwoth Date: Wed, 28 Dec 2016 18:30:08 +0100 Subject: [PATCH] ~g fixed, thanks sam --- src/NadekoBot/Modules/Searches/Searches.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/NadekoBot/Modules/Searches/Searches.cs b/src/NadekoBot/Modules/Searches/Searches.cs index 20cd6361..41b65e17 100644 --- a/src/NadekoBot/Modules/Searches/Searches.cs +++ b/src/NadekoBot/Modules/Searches/Searches.cs @@ -266,17 +266,16 @@ namespace NadekoBot.Modules.Searches var embed = new EmbedBuilder() .WithOkColor() - .WithAuthor(eab => eab.WithName("Search For: " + terms) + .WithAuthor(eab => eab.WithName("Search For: " + terms.TrimTo(50)) .WithUrl(fullQueryLink) .WithIconUrl("http://i.imgur.com/G46fm8J.png")) .WithTitle(umsg.Author.Mention) .WithFooter(efb => efb.WithText(totalResults)); - string desc = ""; - foreach (GoogleSearchResult res in results) - { - desc += $"[{Format.Bold(res.Title)}]({res.Link})\n{res.Text}\n\n"; - } - await channel.EmbedAsync(embed.WithDescription(desc).Build()).ConfigureAwait(false); + + var desc = await Task.WhenAll(results.Select(async res => + $"[{Format.Bold(res?.Title)}]({(await NadekoBot.Google.ShortenUrl(res?.Link))})\n{res?.Text}\n\n")) + .ConfigureAwait(false); + await channel.EmbedAsync(embed.WithDescription(String.Concat(desc)).Build()).ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases]