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 () =>