From 3488eb8152ea136f7d9bc5141f98b8e21f6f7517 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Thu, 2 Feb 2017 05:02:37 +0100 Subject: [PATCH] compile error --- src/NadekoBot/Modules/NSFW/NSFW.cs | 43 +++++++++++++++--------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/src/NadekoBot/Modules/NSFW/NSFW.cs b/src/NadekoBot/Modules/NSFW/NSFW.cs index cd87454a..9698379a 100644 --- a/src/NadekoBot/Modules/NSFW/NSFW.cs +++ b/src/NadekoBot/Modules/NSFW/NSFW.cs @@ -186,6 +186,28 @@ namespace NadekoBot.Modules.NSFW .ConfigureAwait(false); } + public static Task GetDanbooruImageLink(string tag) => Task.Run(async () => + { + try + { + using (var http = new HttpClient()) + { + http.AddFakeHeaders(); + var data = await http.GetStreamAsync("https://danbooru.donmai.us/posts.xml?limit=100&tags=" + tag).ConfigureAwait(false); + var doc = new XmlDocument(); + doc.Load(data); + var nodes = doc.GetElementsByTagName("file-url"); + + var node = nodes[new NadekoRandom().Next(0, nodes.Count)]; + return "https://danbooru.donmai.us" + node.InnerText; + } + } + catch + { + return null; + } + }); + [NadekoCommand, Usage, Description, Aliases] public Task Gelbooru([Remainder] string tag = null) => Searches.Searches.InternalDapiCommand(Context.Message, tag, Searches.Searches.DapiSearchType.Gelbooru); @@ -232,27 +254,6 @@ namespace NadekoBot.Modules.NSFW } } #if !GLOBAL_NADEKO - public static Task GetDanbooruImageLink(string tag) => Task.Run(async () => - { - try - { - using (var http = new HttpClient()) - { - http.AddFakeHeaders(); - var data = await http.GetStreamAsync("https://danbooru.donmai.us/posts.xml?limit=100&tags=" + tag).ConfigureAwait(false); - var doc = new XmlDocument(); - doc.Load(data); - var nodes = doc.GetElementsByTagName("file-url"); - - var node = nodes[new NadekoRandom().Next(0, nodes.Count)]; - return "https://danbooru.donmai.us" + node.InnerText; - } - } - catch - { - return null; - } - }); public static Task GetE621ImageLink(string tag) => Task.Run(async () =>