예제 #1
0
        public async Task Weeb(string args = "")
        {
            Naughty += 1;
            var booru = new Yandere();

            BooruSharp.Search.Post.SearchResult result;
            if (args == "")
            {
                result = await booru.GetRandomImageAsync(args);
            }
            else
            {
                result = await booru.GetRandomImageAsync();
            }

            await ReplyAsync("Image: " + result.fileUrl.AbsoluteUri);
        }
예제 #2
0
        public async Task BooruAsync
        (
            [Remainder][Summary("Search query")] string query
        )
        {
            if (query == null)
            {
                throw new ArgumentNullException(nameof(query), "No input passed");
            }

            string[] sinfulTags =
            {
                "nude",
                "nipples",
                "ass",
                "uncensored",
                "cleavage"
            };

            if (sinfulTags.Any(query.Contains))
            {
                await RankaReplyAsync("...").ConfigureAwait(false);

                return;
            }

            var booru  = new Yandere();
            var result = await booru.GetRandomImageAsync(query).ConfigureAwait(false);

            if (result.tags.Where(x => sinfulTags.Any(y => x.Contains(y))).Any())
            {
                await RankaReplyAsync("..... /_ \\ It was a bit lewd, try again..").ConfigureAwait(false);

                return;
            }

            var color = await StringUtils.DiscordParseColor(new Uri(result.previewUrl.AbsoluteUri)).ConfigureAwait(false);;

            EmbedBuilder eb = new EmbedBuilder
            {
                Title       = "Booru",
                Description = $"Source: Yande.re\nTags:\n{string.Join(", ", result.tags)}",
                ImageUrl    = result.previewUrl.AbsoluteUri,
                Url         = result.postUrl.AbsoluteUri,
                Color       = color,
            };

            eb.WithFooter(footer => { footer.Text = "Booru for Ranka"; });
            await RankaReplyAsync(eb).ConfigureAwait(false);
        }