public async Task SearchTag(ICommandContext context, string tag)
        {
            BooruSharp.Booru.Konachan            Booru   = new BooruSharp.Booru.Konachan();
            BooruSharp.Search.Tag.SearchResult[] results = await Booru.GetTagsAsync(tag);

            string msg = "I can't find this tag! >///< \n" + String.Join(Environment.NewLine, results.Where(delegate(BooruSharp.Search.Tag.SearchResult res) { return(res.type == BooruSharp.Search.Tag.TagType.Character); }).Select(delegate(BooruSharp.Search.Tag.SearchResult res) { return(res.name); }));
            await context.Channel.SendMessageAsync(msg);
        }
        public async Task <Task> GetTagInfo(ICommandContext context, string tag)
        {
            BooruSharp.Booru.Konachan           konachan = new BooruSharp.Booru.Konachan();
            BooruSharp.Search.Wiki.SearchResult result   = await konachan.GetWikiAsync(tag);

            EmbedBuilder builder = new EmbedBuilder();

            builder.Color       = Color.DarkPurple;
            builder.Title       = result.title;
            builder.Description = result.body;
            await context.Channel.SendMessageAsync("", false, builder.Build());

            return(Task.CompletedTask);
        }
        public async Task <BooruSharp.Search.Post.SearchResult> Konachan(IUser usr, IGuild guild, ICommandContext context, string tag = "thighhighs")
        {
            var Booru = new BooruSharp.Booru.Konachan();

            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);
        }
Beispiel #4
0
        public SearchResult getRandomKonachan(string[] tags)
        {
            var booru = new BooruSharp.Booru.Konachan();

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