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 webpage = await http.GetStringAsync(url).ConfigureAwait(false);
|
||||||
var matches = Regex.Matches(webpage, "file_url=\"(?<url>.*?)\"");
|
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)
|
if (matches.Count == 0)
|
||||||
return null;
|
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;
|
||||||
{
|
|
||||||
return matches[rng.Next(0, matches.Count)].Groups["url"].Value;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,20 +386,6 @@ $@"🌍 **Weather for** 【{obj["target"]}】
|
|||||||
await channel.SendMessageAsync($"https://images.google.com/searchbyimage?image_url={imageLink}").ConfigureAwait(false);
|
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]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
public async Task Safebooru(IUserMessage umsg, [Remainder] string tag = null)
|
public async Task Safebooru(IUserMessage umsg, [Remainder] string tag = null)
|
||||||
@ -492,32 +478,6 @@ $@"🌍 **Weather for** 【{obj["target"]}】
|
|||||||
await channel.SendMessageAsync(await _google.ShortenUrl(usr.AvatarUrl).ConfigureAwait(false)).ConfigureAwait(false);
|
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)
|
public static async Task<string> GetSafebooruImageLink(string tag)
|
||||||
{
|
{
|
||||||
var rng = new NadekoRandom();
|
var rng = new NadekoRandom();
|
||||||
|
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
@ -6674,33 +6674,6 @@ namespace NadekoBot.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <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>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to take.
|
/// Looks up a localized string similar to take.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -2691,15 +2691,6 @@
|
|||||||
<data name="bfu_usage" xml:space="preserve">
|
<data name="bfu_usage" xml:space="preserve">
|
||||||
<value>`{0}bfu platform game user`</value>
|
<value>`{0}bfu platform game user`</value>
|
||||||
</data>
|
</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">
|
<data name="yandere_cmd" xml:space="preserve">
|
||||||
<value>yandere</value>
|
<value>yandere</value>
|
||||||
</data>
|
</data>
|
||||||
|
Loading…
Reference in New Issue
Block a user