Ejemplo n.º 1
0
        public async void GetThread()
        {
            var threadPage = await Chan.GetThreadPageAsync("a", 1);

            var threadNumber = threadPage.Threads.First().Posts.First().PostNumber;


            var thread = await Chan.GetThreadAsync("a", threadNumber);

            NotNull(thread);
        }
Ejemplo n.º 2
0
        public async void GetThreadPageAsync()
        {
            try
            {
                ThreadRootObject thread = await Chan.GetThreadPageAsync("a", 1);

                Assert.AreNotEqual(thread, null);
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message);
            }
        }
Ejemplo n.º 3
0
        public async void GetAllThreadAsync()
        {
            var thread = await Chan.GetThreadPageAsync("a", 1);

            NotNull(thread);

            foreach (var item in thread.Threads)
            {
                NotNull(item);

                foreach (var post in item.Posts)
                {
                    NotNull(post);
                    NotEqual(default(int), post.PostNumber);
                }
            }
        }
Ejemplo n.º 4
0
 /// <inheritdoc />
 protected override async Task GatherAsync(IDownloaderClient client, List <IPost> list, CancellationToken token)
 {
     if (ThreadId > 0)
     {
         ProcessThread(list, await Chan.GetThreadAsync(Board, ThreadId).CAF(), ThreadId, token);
         return;
     }
     for (var i = 1; i < 10; ++i)
     {
         foreach (var thread in (await Chan.GetThreadPageAsync(Board, i).CAF()).Threads)
         {
             if (!ProcessThread(list, thread, thread.Posts[0].PostNumber, token))
             {
                 return;
             }
         }
     }
 }
Ejemplo n.º 5
0
            public async Task RandomThread(CommandContext ctx, string boardName = null)
            {
                await ctx.TriggerTypingAsync();

                BoardRootObject boardRootObject = await Chan.GetBoardAsync();

                Board board;

                if (!string.IsNullOrWhiteSpace(boardName))
                {
                    int index = boardRootObject.Boards.FindIndex(b => b.BoardName == boardName.ToLower());
                    if (index == -1)
                    {
                        _ = await ctx.RespondAsync($"Couldn't find board /{boardName.ToLower()}/!");

                        return;
                    }
                    else
                    {
                        board = boardRootObject.Boards[index];
                    }
                }
                else
                {
                    board = Helper.RandomItem.GetRandomItem(boardRootObject.Boards);
                }

                var posts = new List <Post>();

                for (int i = 1; i < board.Pages; i++)
                {
                    ThreadRootObject page = await Chan.GetThreadPageAsync(board.BoardName, i);

                    foreach (Thread thread in page.Threads)
                    {
                        posts.Add(thread.Posts[0]);
                    }
                }

                Post post = posts[Plugin.Random.Next(0, posts.Count - 1)];

                await this.GetThread(ctx, post.Board, post.PostNumber);
            }
Ejemplo n.º 6
0
        public async void GetAllThreadAsync()
        {
            try
            {
                ThreadRootObject thread = await Chan.GetThreadPageAsync("a", 1);

                Assert.NotNull(thread);

                foreach (var item in thread.Threads)
                {
                    Assert.NotNull(item);

                    foreach (var post in item.Posts)
                    {
                        Assert.NotNull(post);
                        Assert.AreNotEqual(post.PostNumber, default(int));
                    }
                }
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message);
            }
        }
Ejemplo n.º 7
0
        public async void GetThreadPageAsync()
        {
            var thread = await Chan.GetThreadPageAsync("a", 1);

            NotNull(thread);
        }
Ejemplo n.º 8
0
        public async void GetThreadPageAsync()
        {
            var thread = await Chan.GetThreadPageAsync("a", 1);

            Assert.NotEqual(thread, null);
        }