示例#1
0
        public async Task CardAsync([Remainder] string name)
        {
            var result = await _cardService.Where(x => x.Name, name).AllAsync();

            var cards = result.Value.DistinctBy(x => x.Name).ToArray();
            var pages = cards.Select((x, i) => MagicHelper.BuildPage(x, i, cards.Length));

            if (result.IsSuccess && result.Value.Count > 0)
            {
                await PagedReplyAsync(new PaginatedMessage()
                {
                    Pages = pages
                }, new ReactionList()
                {
                    Backward = true, First = true, Last = true, Trash = true
                });
            }
        }
示例#2
0
        public async Task CardAsync([Remainder] string name)
        {
            var result = await _cardService.Where(x => x.Name, name).AllAsync();

            var cards = result.Value.DistinctBy(x => x.Name).ToArray();
            var pages = cards.OrderBy(x => string.Compare(x.Name, name, StringComparison.OrdinalIgnoreCase)).Select((x, i) => MagicHelper.BuildPage(x, i, cards.Length));

            var paginator = new StaticPaginatorBuilder()
            {
                Pages = pages.ToList()
            }.WithTimoutedEmbed(null).Build();

            if (result.IsSuccess && result.Value.Count > 0)
            {
                await _interactivityService.SendPaginatorAsync(paginator, Context.Channel);
            }
        }