コード例 #1
0
        public async Task WaifuWishlist([Remainder] IUser user = null)
        {
            user ??= Context.User;
            var waifus = await WaifuWishlistDb.GetWishlist(user.Id, Context.Guild.Id);

            await Context.Channel.SendMessageAsync(null, false, WaifuUtil.WishlistEmbed(waifus, (SocketGuildUser)user).Build());
        }
コード例 #2
0
        public async Task WishWaifu([Remainder] string str = "")
        {
            var   user  = Context.User;
            Waifu waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(str), this);

            if (waifu == null)
            {
                return;
            }

            var waifus = await WaifuWishlistDb.GetWishlist(user.Id, Context.Guild.Id);

            int cap = 5;

            if (PremiumDb.IsPremium(Context.User.Id, ProType.ProPlus))
            {
                cap = 12;
            }

            string prefix = Program.GetPrefix(Context);

            if (waifus.Count >= cap)
            {
                await Context.Channel.SendMessageAsync(embed : new EmbedBuilderPrepared(Context.User)
                                                       .WithDescription($"You have reached your wishlist limit of **{cap}**.\n" +
                                                                        $"Try `{prefix}rww` to remove a waifu.")
                                                       .WithFooter($"Increase the limit: `{prefix}pro`")
                                                       .Build());

                return;
            }

            if (waifus.Any(x => x.Name == waifu.Name))
            {
                await Context.Channel.SendMessageAsync($"**{waifu.Name}** is already in your wishlist. Baka.");

                return;
            }

            if (UserInventoryDb.OwnsWaifu(user.Id, waifu, Context.Guild.Id))
            {
                await Context.Channel.SendMessageAsync($"You already own **{waifu.Name}**. Baka.");

                return;
            }

            await WaifuWishlistDb.AddWaifuWish(Context.User.Id, waifu, Context.Guild.Id);

            waifus = await WaifuWishlistDb.GetWishlist(user.Id, Context.Guild.Id);

            await Context.Channel.SendMessageAsync($"Added **{waifu.Name}** to your wishlist!", false, WaifuUtil.WishlistEmbed(waifus, (SocketGuildUser)user).Build());
        }