added ~hentai search by tag
This commit is contained in:
parent
920858a46a
commit
63bf61cdd7
@ -486,9 +486,10 @@ namespace NadekoBot.Modules
|
||||
});
|
||||
|
||||
cgb.CreateCommand("dump")
|
||||
.Description("Dumps all of the invites it can to dump.txt")
|
||||
.Description("Dumps all of the invites it can to dump.txt.** Owner Only.**")
|
||||
.Do(async e =>
|
||||
{
|
||||
if (NadekoBot.OwnerID != e.User.Id) return;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
string invites = "";
|
||||
|
@ -103,6 +103,27 @@ namespace NadekoBot.Modules
|
||||
await e.Send("This feature is being reconstructed.");
|
||||
|
||||
});
|
||||
|
||||
cgb.CreateCommand("~hentai")
|
||||
.Description("Shows a random image from danbooru with a given tag. Tag is optional but preffered.\n**Usage**: ~hentai yuri")
|
||||
.Parameter("tag", ParameterType.Unparsed)
|
||||
.Do(async e => {
|
||||
try {
|
||||
var rng = new Random();
|
||||
var tag = e.GetArg("tag");
|
||||
|
||||
if (tag == "loli") //loli doesn't work for some reason atm
|
||||
tag = "flat_chest";
|
||||
|
||||
var webpage = MakeRequestAndGetResponse($"http://danbooru.donmai.us/posts?page={ rng.Next(0, 30) }&tags={ tag }");
|
||||
var matches = Regex.Matches(webpage, "data-large-file-url=\"(?<id>.*)\"");
|
||||
|
||||
await e.Send($"http://danbooru.donmai.us{ matches[rng.Next(0, matches.Count)].Groups["id"].Value }".ShortenUrl());
|
||||
} catch (Exception) {
|
||||
await e.Send("Error ;(");
|
||||
}
|
||||
});
|
||||
|
||||
cgb.CreateCommand("lmgtfy")
|
||||
.Description("Google something for an idiot.")
|
||||
.Parameter("ffs", ParameterType.Unparsed)
|
||||
@ -113,6 +134,9 @@ namespace NadekoBot.Modules
|
||||
});
|
||||
}
|
||||
|
||||
public static string MakeRequestAndGetResponse(string v) =>
|
||||
new StreamReader(((HttpWebRequest)WebRequest.Create(v)).GetResponse().GetResponseStream()).ReadToEnd();
|
||||
|
||||
private string token = "";
|
||||
private AnimeResult GetAnimeQueryResultLink(string query)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user