Ejemplo n.º 1
0
        public async Task TestBooruTypo()
        {
            BooruSharp.Booru.Gelbooru booru = new BooruSharp.Booru.Gelbooru();
            Random rand         = new Random();
            var    resultSearch = await Booru.SearchBooru(false, new string[] { "tsutsukakushi_tsuki" }, booru, rand);

            Assert.Equal(Error.Booru.None, resultSearch.error);
            var resultTags = await Booru.SearchTags(new string[] { resultSearch.answer.saveId.ToString() });

            Assert.Equal(Error.BooruTags.None, resultTags.error);
            Assert.Contains("tsutsukakushi_tsukiko", resultTags.answer.characTags);
        }
Ejemplo n.º 2
0
        public async Task TestBooruTag()
        {
            BooruSharp.Booru.Gelbooru booru = new BooruSharp.Booru.Gelbooru();
            Random rand         = new Random();
            var    resultSearch = await Booru.SearchBooru(false, new string[] { "hibiki_(kantai_collection)" }, booru, rand);

            var resultTags = await Booru.SearchTags(new string[] { resultSearch.answer.saveId.ToString() });

            Assert.Equal(Error.BooruTags.None, resultTags.error);
            Assert.Contains("hibiki_(kantai_collection)", resultTags.answer.characTags);
            Assert.Contains("kantai_collection", resultTags.answer.sourceTags);
            Assert.Equal("Gelbooru", resultTags.answer.booruName);
        }
Ejemplo n.º 3
0
        public async Task <BooruSharp.Search.Post.SearchResult> GelBooru(IUser usr, IGuild guild, ICommandContext context, string tag = "thighhighs")
        {
            BooruSharp.Booru.Gelbooru           Booru  = new BooruSharp.Booru.Gelbooru();
            BooruSharp.Search.Post.SearchResult result = new BooruSharp.Search.Post.SearchResult();
            try
            {
                result = await Booru.GetRandomPostAsync(tag.Split(','));

                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);

                await SearchTag(context, tag);
            }

            return(result);
        }
Ejemplo n.º 4
0
        public SearchResult getRandomGelbooru(string[] tags)
        {
            var booru = new BooruSharp.Booru.Gelbooru();

            return(booru.GetRandomPostAsync(tags).Result);
        }