コード例 #1
0
        public async Task DailyLeaderboard([Remainder] string str = "")
        {
            var dailies = await DailyDb.GetLeaderboard(Context.Guild.Id);

            var parsed = dailies.Select(x =>
            {
                try
                {
                    return(new UserAmountView()
                    {
                        User = Context.Guild.GetUser(x.Id),
                        Amount = x.Count
                    });
                }
                catch
                { return(null); }
            })
                         .Where(x => x != null && x.User != null);

            var msg = new CustomPaginatedMessage();

            msg.Author = new EmbedAuthorBuilder()
            {
                Name = "User Leaderboards"
            };
            msg.Title = "Daily Streak :calendar_spiral:";
            msg.Pages = CustomPaginatedMessage.PagesArray(parsed, 10);

            await PagedReplyAsync(msg);
        }
コード例 #2
0
ファイル: Roles.cs プロジェクト: ta1H3n/Namiko
        public async Task RoleShopRemoveRole([Remainder] string name = "")
        {
            var roles = await ShopRoleDb.GetRoles(Context.Guild.Id);

            var eb = new EmbedBuilderPrepared()
                     .WithTitle(":star: Role Shop");

            if (!roles.Any())
            {
                await Context.Channel.SendMessageAsync(embed : eb.WithDescription(" *~ No roles in shop ~*\n").WithColor(Color.DarkRed).Build());

                return;
            }

            int i    = 1;
            var role = await this.SelectItem(
                roles,
                eb.WithDescription(
                    "Enter the number of the role you wish to delete...\n\n" +
                    CustomPaginatedMessage.PagesArray(roles, 100, (r) => $"**#{i++}** <@&{r.RoleId}>\n", false).First()
                    )
                );

            await ShopRoleDb.RemoveRole(role.RoleId);

            await Context.Channel.SendMessageAsync(embed : eb.WithDescription($" *~ <@&{role.RoleId}> removed ~*\n").Build());
        }
コード例 #3
0
        public async Task GuildTest()
        {
            var msg = new CustomPaginatedMessage
            {
                Pages = CustomPaginatedMessage.PagesArray(Program.GetClient().Guilds, 20, (x) => $"`{x.Id}` - **{x.Name}**\n`{x.OwnerId}` - **{x.Owner}**\n")
            };

            await PagedReplyAsync(msg);
        }
コード例 #4
0
ファイル: Roles.cs プロジェクト: ta1H3n/Namiko
        public async Task RoleShop([Remainder] string str = "")
        {
            var roles = await ShopRoleDb.GetRoles(Context.Guild.Id);

            var eb = new EmbedBuilderPrepared()
                     .WithTitle(":star: Role Shop");

            if (!roles.Any())
            {
                await Context.Channel.SendMessageAsync(embed : eb.WithDescription(" *~ No roles in shop ~*\n").WithColor(Color.DarkRed).Build());

                return;
            }

            await Context.Channel.SendMessageAsync(embed :
                                                   eb.WithDescription(CustomPaginatedMessage.PagesArray(roles.OrderByDescending(x => x.Price), 100, (r) => $"<@&{r.RoleId}> - **{r.Price:n0}**\n").First()).Build());
        }
コード例 #5
0
ファイル: WaifuUtil.cs プロジェクト: ta1H3n/Namiko
        public static CustomPaginatedMessage PaginatedShopMessage(IEnumerable<ShopWaifu> waifus, int pageSize, string prefix, ulong guildId = 0, ShopType type = ShopType.Waifu)
        {
            CustomPaginatedMessage paginatedMessage = new CustomPaginatedMessage();
            var fieldList = new List<FieldPages>();
            var splitWaifus = CustomPaginatedMessage.Split(waifus, pageSize);
            int pages = splitWaifus.Count();

            var fieldInfo = new FieldPages();
            var pagelist = new List<string>();
            fieldInfo.Title = ":books: Commands";
            for (int i = 0; i < pages; i++)
            {
                pagelist.Add($"`{prefix}BuyWaifu [name]` | `{prefix}Waifu [search]` | `{prefix}Ws` | `{prefix}Gs` | `{prefix}Ms`");
            }
            fieldInfo.Inline = true;
            fieldInfo.Pages = pagelist;
            fieldList.Add(fieldInfo);

            var fieldWaifus = new FieldPages();
            var pagelist2 = new List<string>();
            fieldWaifus.Title = "<:MiaHug:536580304018735135> Waifus";
            foreach (var w in splitWaifus)
            {
                pagelist2.Add(WaifuUtil.WaifuShopWaifuList(w));
            }
            fieldWaifus.Pages = pagelist2;
            fieldList.Add(fieldWaifus);

            paginatedMessage.Fields = fieldList;
            paginatedMessage.Footer = $"Resets in {11 - DateTime.Now.Hour % 12} Hours {60 - DateTime.Now.Minute} Minutes | ";
            paginatedMessage.Color = BasicUtil.RandomColor();
            paginatedMessage.PageCount = pages;
            if (guildId != 0)
                paginatedMessage.Pages = new List<string> { $"Open in [browser](https://namiko.moe/WaifuShop/{guildId})" };
            paginatedMessage.Author = new EmbedAuthorBuilder()
            {
                Name = type switch
                {
                    ShopType.Waifu => "Waifu Shop",
                    ShopType.Gacha => "Gacha Shop",
                    ShopType.Mod => "Mod Shop",
                    _ => "Waifu Shop"
                },
コード例 #6
0
        public async Task ServerTopWaifus([Remainder] string str = "")
        {
            var waifus = await UserInventoryDb.CountWaifus(Context.Guild.Id, str.Split(' '));

            var msg = new CustomPaginatedMessage();

            msg.Title = ":two_hearts: Waifu Leaderboards";
            var fields = new List <FieldPages>
            {
                new FieldPages
                {
                    Title = "Bought Here",
                    Pages = CustomPaginatedMessage.PagesArray(waifus, 10, (x) => $"**{x.Key}** - {x.Value}\n")
                }
            };

            msg.Fields       = fields;
            msg.ThumbnailUrl = (await WaifuDb.GetWaifu(waifus.First().Key)).HostImageUrl;

            await PagedReplyAsync(msg);
        }
コード例 #7
0
        public async Task Waifus([Remainder] IUser user = null)
        {
            user ??= Context.User;

            var waifus = UserInventoryDb.GetWaifus(user.Id, Context.Guild.Id);

            if (waifus.Count <= 21)
            {
                await Context.Channel.SendMessageAsync("", false, UserUtil.WaifusEmbed((SocketGuildUser)user).Build());

                return;
            }

            var ordwaifus = waifus.OrderBy(x => x.Source).ThenBy(x => x.Name);
            var msg       = new CustomPaginatedMessage();

            var author = new EmbedAuthorBuilder()
            {
                IconUrl = user.GetAvatarUrl(),
                Name    = user.ToString()
            };

            msg.Author = author;

            msg.ThumbnailUrl = FeaturedWaifuDb.GetFeaturedWaifu(user.Id, Context.Guild.Id).HostImageUrl;
            var pages = CustomPaginatedMessage.PagesArray(ordwaifus, 15, (x) => String.Format("**{0}** - *{1}*\n", x.Name, x.Source.Length > 33 ? x.Source.Substring(0, 33) + "..." : x.Source), false);

            msg.Fields = new List <FieldPages> {
                new FieldPages {
                    Title = "Waifus :revolving_hearts:", Pages = pages
                }
            };
            msg.Pages = new List <string> {
                $"Open in [browser](https://namiko.moe/Guild/{Context.Guild.Id}/{user.Id})"
            };

            await PagedReplyAsync(msg);
        }
コード例 #8
0
        public async Task ToastieLeaderboard([Remainder] string str = "")
        {
            var toasties = await BalanceDb.GetAllToasties(Context.Guild.Id);

            var parsed = toasties.Select(x =>
            {
                try
                {
                    return(new UserAmountView()
                    {
                        User = Context.Guild.GetUser(x.Id),
                        Amount = x.Count
                    });
                }
                catch
                { return(null); }
            })
                         .Where(x => x != null && x.User != null);

            var msg = new CustomPaginatedMessage();

            msg.Title = "User Leaderboards";
            var fields = new List <FieldPages>
            {
                new FieldPages
                {
                    Title  = "Toasties <:toastie3:454441133876183060>",
                    Pages  = CustomPaginatedMessage.PagesArray(parsed, 10),
                    Inline = true
                }
            };

            msg.Fields = fields;

            await PagedReplyAsync(msg);
        }
コード例 #9
0
        public async Task WaifuLeaderboard([Remainder] string str = "")
        {
            var AllWaifus = await UserInventoryDb.GetAllWaifuItems(Context.Guild.Id);

            var users = new Dictionary <SocketUser, int>();

            foreach (var x in AllWaifus)
            {
                var user = Context.Guild.GetUser(x.UserId);
                if (user != null)
                {
                    if (!users.ContainsKey(user))
                    {
                        users.Add(user, WaifuUtil.WaifuValue(AllWaifus.Where(x => x.UserId == user.Id).Select(x => x.Waifu)));
                    }
                }
            }

            var ordUsers = users.OrderByDescending(x => x.Value);

            var msg = new CustomPaginatedMessage();

            msg.Title = "User Leaderboards";
            var fields = new List <FieldPages>
            {
                new FieldPages
                {
                    Title = "Waifu Value <:toastie3:454441133876183060>",
                    Pages = CustomPaginatedMessage.PagesArray(ordUsers, 10, (x) => $"{x.Key.Mention} - {x.Value}\n")
                }
            };

            msg.Fields = fields;

            await PagedReplyAsync(msg);
        }