From a92aaed957d0171ea021d1db4b4931f9f58341ec Mon Sep 17 00:00:00 2001 From: Kwoth Date: Sun, 11 Dec 2016 00:09:11 +0100 Subject: [PATCH] nsfw error prettified, upped random limits --- src/NadekoBot/Modules/NSFW/NSFW.cs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/NadekoBot/Modules/NSFW/NSFW.cs b/src/NadekoBot/Modules/NSFW/NSFW.cs index 0d95ee21..0fba9e0e 100644 --- a/src/NadekoBot/Modules/NSFW/NSFW.cs +++ b/src/NadekoBot/Modules/NSFW/NSFW.cs @@ -51,7 +51,7 @@ namespace NadekoBot.Modules.NSFW } var link = await provider.ConfigureAwait(false); if (string.IsNullOrWhiteSpace(link)) - await channel.SendMessageAsync("Search yielded no results ;(").ConfigureAwait(false); + await channel.SendErrorAsync("No results found.").ConfigureAwait(false); else await channel.SendMessageAsync(link).ConfigureAwait(false); } @@ -68,17 +68,17 @@ namespace NadekoBot.Modules.NSFW var links = await Task.WhenAll(GetGelbooruImageLink(tag), GetDanbooruImageLink(tag), GetKonachanImageLink(tag), - GetYandereImageLink(tag)).ConfigureAwait(false); + GetYandereImageLink(tag)).ConfigureAwait(false); if (links.All(l => l == null)) { - await channel.SendMessageAsync("`No results.`").ConfigureAwait(false); + await channel.SendErrorAsync("No results found.").ConfigureAwait(false); return; } await channel.SendMessageAsync(String.Join("\n\n", links)).ConfigureAwait(false); } - + public static async Task GetYandereImageLink(string tag) { var rng = new NadekoRandom(); @@ -97,7 +97,7 @@ namespace NadekoBot.Modules.NSFW return matches[rng.Next(0, matches.Count)].Groups["url"].Value; } } - + [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] public async Task Yandere(IUserMessage umsg, [Remainder] string tag = null) @@ -107,7 +107,7 @@ namespace NadekoBot.Modules.NSFW tag = tag?.Trim() ?? ""; var link = await GetYandereImageLink(tag).ConfigureAwait(false); if (string.IsNullOrWhiteSpace(link)) - await channel.SendMessageAsync("Search yielded no results ;(").ConfigureAwait(false); + await channel.SendErrorAsync("No results found.").ConfigureAwait(false); else await channel.SendMessageAsync(link).ConfigureAwait(false); } @@ -121,7 +121,7 @@ namespace NadekoBot.Modules.NSFW tag = tag?.Trim() ?? ""; var link = await GetDanbooruImageLink(tag).ConfigureAwait(false); if (string.IsNullOrWhiteSpace(link)) - await channel.SendMessageAsync("Search yielded no results ;(").ConfigureAwait(false); + await channel.SendErrorAsync("No results found.").ConfigureAwait(false); else await channel.SendMessageAsync(link).ConfigureAwait(false); } @@ -135,7 +135,7 @@ namespace NadekoBot.Modules.NSFW tag = tag?.Trim() ?? ""; var link = await GetKonachanImageLink(tag).ConfigureAwait(false); if (string.IsNullOrWhiteSpace(link)) - await channel.SendMessageAsync("Search yielded no results ;(").ConfigureAwait(false); + await channel.SendErrorAsync("No results found.").ConfigureAwait(false); else await channel.SendMessageAsync(link).ConfigureAwait(false); } @@ -149,7 +149,7 @@ namespace NadekoBot.Modules.NSFW tag = tag?.Trim() ?? ""; var link = await GetGelbooruImageLink(tag).ConfigureAwait(false); if (string.IsNullOrWhiteSpace(link)) - await channel.SendMessageAsync("Search yielded no results ;(").ConfigureAwait(false); + await channel.SendErrorAsync("No results found.").ConfigureAwait(false); else await channel.SendMessageAsync(link).ConfigureAwait(false); } @@ -163,7 +163,7 @@ namespace NadekoBot.Modules.NSFW tag = tag?.Trim() ?? ""; var link = await GetRule34ImageLink(tag).ConfigureAwait(false); if (string.IsNullOrWhiteSpace(link)) - await channel.SendMessageAsync("Search yielded no results ;(").ConfigureAwait(false); + await channel.SendErrorAsync("No results found.").ConfigureAwait(false); else await channel.SendMessageAsync(link).ConfigureAwait(false); } @@ -177,7 +177,7 @@ namespace NadekoBot.Modules.NSFW tag = tag?.Trim() ?? ""; var link = await GetE621ImageLink(tag).ConfigureAwait(false); if (string.IsNullOrWhiteSpace(link)) - await channel.SendMessageAsync("Search yielded no results ;(").ConfigureAwait(false); + await channel.SendErrorAsync("No results found.").ConfigureAwait(false); else await channel.SendMessageAsync(link).ConfigureAwait(false); } @@ -201,13 +201,13 @@ namespace NadekoBot.Modules.NSFW JToken obj; using (var http = new HttpClient()) { - obj = JArray.Parse(await http.GetStringAsync($"http://api.oboobs.ru/boobs/{ new NadekoRandom().Next(0, 9880) }").ConfigureAwait(false))[0]; + obj = JArray.Parse(await http.GetStringAsync($"http://api.oboobs.ru/boobs/{ new NadekoRandom().Next(0, 10229) }").ConfigureAwait(false))[0]; } await channel.SendMessageAsync($"http://media.oboobs.ru/{ obj["preview"].ToString() }").ConfigureAwait(false); } catch (Exception ex) { - await channel.SendMessageAsync($"💢 {ex.Message}").ConfigureAwait(false); + await channel.SendErrorAsync(ex.Message).ConfigureAwait(false); } } @@ -222,13 +222,13 @@ namespace NadekoBot.Modules.NSFW JToken obj; using (var http = new HttpClient()) { - obj = JArray.Parse(await http.GetStringAsync($"http://api.obutts.ru/butts/{ new NadekoRandom().Next(0, 3873) }").ConfigureAwait(false))[0]; + obj = JArray.Parse(await http.GetStringAsync($"http://api.obutts.ru/butts/{ new NadekoRandom().Next(0, 4222) }").ConfigureAwait(false))[0]; } await channel.SendMessageAsync($"http://media.obutts.ru/{ obj["preview"].ToString() }").ConfigureAwait(false); } catch (Exception ex) { - await channel.SendMessageAsync($"💢 {ex.Message}").ConfigureAwait(false); + await channel.SendErrorAsync(ex.Message).ConfigureAwait(false); } }