compile error
This commit is contained in:
parent
e7fcac3c8f
commit
3488eb8152
@ -186,6 +186,28 @@ namespace NadekoBot.Modules.NSFW
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public static Task<string> 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<string> 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<string> GetE621ImageLink(string tag) => Task.Run(async () =>
|
||||
|
Loading…
Reference in New Issue
Block a user