Remove safeyandere.
This commit is contained in:
parent
96dd0b6096
commit
581ab1edeb
@ -111,17 +111,10 @@ namespace NadekoBot.Modules.NSFW
|
||||
{
|
||||
var webpage = await http.GetStringAsync(url).ConfigureAwait(false);
|
||||
var matches = Regex.Matches(webpage, "file_url=\"(?<url>.*?)\"");
|
||||
var rating = Regex.Matches(webpage, "rating=\"(?<rate>.*?)\"");
|
||||
//var rating = Regex.Matches(webpage, "rating=\"(?<rate>.*?)\"");
|
||||
if (matches.Count == 0)
|
||||
return null;
|
||||
if (string.Equals(rating[rng.Next(0, rating.Count)].Groups["rate"].Value.ToString(), "e") || string.Equals(rating[rng.Next(0, rating.Count)].Groups["rate"].Value.ToString(), "q"))
|
||||
{
|
||||
return matches[rng.Next(0, matches.Count)].Groups["url"].Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return matches[rng.Next(0, matches.Count)].Groups["url"].Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -385,20 +385,6 @@ $@"🌍 **Weather for** 【{obj["target"]}】
|
||||
return;
|
||||
await channel.SendMessageAsync($"https://images.google.com/searchbyimage?image_url={imageLink}").ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Safeyandere(IUserMessage umsg, [Remainder] string tag = null)
|
||||
{
|
||||
var channel = (ITextChannel)umsg.Channel;
|
||||
|
||||
tag = tag?.Trim() ?? "";
|
||||
var link = await GetSafeYandereImageLink(tag).ConfigureAwait(false);
|
||||
if (link == null)
|
||||
await channel.SendMessageAsync("`No results.`");
|
||||
else
|
||||
await channel.SendMessageAsync(link).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
@ -491,32 +477,6 @@ $@"🌍 **Weather for** 【{obj["target"]}】
|
||||
}
|
||||
await channel.SendMessageAsync(await _google.ShortenUrl(usr.AvatarUrl).ConfigureAwait(false)).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public static async Task<string> GetSafeYandereImageLink(string tag)
|
||||
{
|
||||
var rng = new NadekoRandom();
|
||||
var url =
|
||||
$"https://yande.re/post.xml?" +
|
||||
$"limit=25" +
|
||||
$"&page={rng.Next(0, 15)}" +
|
||||
$"&tags={tag.Replace(" ", "_")}";
|
||||
using (var http = new HttpClient())
|
||||
{
|
||||
var webpage = await http.GetStringAsync(url).ConfigureAwait(false);
|
||||
var matches = Regex.Matches(webpage, "file_url=\"(?<url>.*?)\"");
|
||||
var rating = Regex.Matches(webpage, "rating=\"(?<rate>.*?)\"");
|
||||
if (matches.Count == 0)
|
||||
return null;
|
||||
if (string.Equals(rating[rng.Next(0, rating.Count)].Groups["rate"].Value.ToString(), "s") || string.Equals(rating[rng.Next(0, rating.Count)].Groups["rate"].Value.ToString(), "q"))
|
||||
{
|
||||
return matches[rng.Next(0, matches.Count)].Groups["url"].Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<string> GetSafebooruImageLink(string tag)
|
||||
{
|
||||
|
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
@ -6673,33 +6673,6 @@ namespace NadekoBot.Resources {
|
||||
return ResourceManager.GetString("stop_usage", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to safeyandere sy.
|
||||
/// </summary>
|
||||
public static string safeyandere_cmd {
|
||||
get {
|
||||
return ResourceManager.GetString("sy_cmd", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Shows a safe random image from yandere with a given tag. Tag is optional but preferred. (multiple tags are appended with +).
|
||||
/// </summary>
|
||||
public static string safeyandere_desc {
|
||||
get {
|
||||
return ResourceManager.GetString("sy_desc", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to `{0}sy tag1+tag2` or `{0}safeyandere tag1+tag2`.
|
||||
/// </summary>
|
||||
public static string safeyandere_usage {
|
||||
get {
|
||||
return ResourceManager.GetString("sy_usage", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to take.
|
||||
|
@ -2691,15 +2691,6 @@
|
||||
<data name="bfu_usage" xml:space="preserve">
|
||||
<value>`{0}bfu platform game user`</value>
|
||||
</data>
|
||||
<data name="safeyandere_cmd" xml:space="preserve">
|
||||
<value>safeyandere sy</value>
|
||||
</data>
|
||||
<data name="safeyandere_desc" xml:space="preserve">
|
||||
<value>Shows a safe random image from yandere with a given tag. Tag is optional but preferred. (multiple tags are appended with +)</value>
|
||||
</data>
|
||||
<data name="safeyandere_usage" xml:space="preserve">
|
||||
<value>`{0}sy tag1+tag2` or `{0}safeyandere tag1+tag2`</value>
|
||||
</data>
|
||||
<data name="yandere_cmd" xml:space="preserve">
|
||||
<value>yandere</value>
|
||||
</data>
|
||||
|
Loading…
Reference in New Issue
Block a user