示例#1
0
        public async Task WaifuImageSource([Remainder] string name)
        {
            var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(name, true, null, true), this);

            if (waifu == null)
            {
                return;
            }

            string str = "```yaml\n";

            str += $"Name: {waifu.Name}\n";
            str += $"FullName: {waifu.LongName}\n";
            str += $"Source: {waifu.Source}\n";
            str += $"Description: {waifu.Description}\n";
            str += $"ImgurUrl: {waifu.ImageUrl}\n";
            str += $"NamikoMoeUrl: {waifu.HostImageUrl}\n";
            str += $"ImageSource: {waifu.ImageSource}\n";
            str += $"Tier: {waifu.Tier}\n";
            str += $"MalId: {waifu.Mal?.MalId}\n";

            str += "```";

            await Context.Channel.SendMessageAsync(str);
        }
示例#2
0
        public async Task ShipWaifu(string name, ulong userId, ulong guildId = 0)
        {
            Program.GetPrefix(Context);

            if (guildId == 0)
            {
                guildId = Context.Guild.Id;
            }

            var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(name), this);

            if (waifu == null)
            {
                return;
            }

            if (UserInventoryDb.OwnsWaifu(userId, waifu, guildId))
            {
                await Context.Channel.SendMessageAsync($"They already own **{waifu.Name}**");

                return;
            }

            await UserInventoryDb.AddWaifu(userId, waifu, guildId);

            await Context.Channel.SendMessageAsync($"**{waifu.Name}** shipped!");
        }
示例#3
0
        public async Task ShipWaifu(IUser user, [Remainder] string name)
        {
            var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(name), this);

            if (waifu == null)
            {
                return;
            }

            if (waifu.Tier < 1 || waifu.Tier > 3)
            {
                if (!(Context.Guild.Id == 738291903770132646 && waifu.Tier == 825))
                {
                    await Context.Channel.SendMessageAsync(embed : new EmbedBuilderPrepared(Context.User)
                                                           .WithDescription($"*~ You can only ship Tier 1-3 waifus ~*")
                                                           .Build());

                    return;
                }
            }

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

                return;
            }

            await UserInventoryDb.AddWaifu(user.Id, waifu, Context.Guild.Id);

            await Context.Channel.SendMessageAsync($"**{waifu.Name}** shipped!", embed : WaifuUtil.WaifuEmbedBuilder(waifu).Build());
        }
示例#4
0
        public async Task GiveWaifu(IUser recipient, [Remainder] string str = "")
        {
            var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(str, false, UserInventoryDb.GetWaifus(Context.User.Id, Context.Guild.Id)), this);

            if (waifu == null)
            {
                return;
            }
            var waifus = UserInventoryDb.GetWaifus(Context.User.Id, Context.Guild.Id);

            if (!waifus.Any(x => x.Name.Equals(waifu.Name)))
            {
                await Context.Channel.SendMessageAsync($"**{waifu.Name}** is just like my love - you don't have it.");

                return;
            }
            waifus = UserInventoryDb.GetWaifus(recipient.Id, Context.Guild.Id);
            if (waifus.Any(x => x.Name.Equals(waifu.Name)))
            {
                await Context.Channel.SendMessageAsync($"They already have **{waifu.Name}**.");

                return;
            }

            await UserInventoryDb.AddWaifu(recipient.Id, waifu, Context.Guild.Id);

            await UserInventoryDb.DeleteWaifu(Context.User.Id, waifu, Context.Guild.Id);

            await Context.Channel.SendMessageAsync($"{recipient.Mention} You received **{waifu.Name}** from {Context.User.Mention}!", false, WaifuUtil.WaifuEmbedBuilder(waifu).Build());
        }
示例#5
0
        public async Task WaifuMal(string name, long malId)
        {
            var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(name, true, includeMAL: true), this);

            if (waifu == null)
            {
                return;
            }

            var mal = waifu.Mal ?? new MalWaifu {
                WaifuName = waifu.Name
            };

            mal.LastUpdated  = DateTime.Now;
            mal.MalConfirmed = true;
            mal.MalId        = malId;

            if ((await WaifuDb.UpdateMalWaifu(mal)) > 0)
            {
                await Context.Channel.SendMessageAsync($":white_check_mark: {waifu.Name} updated.");
            }
            else
            {
                await Context.Channel.SendMessageAsync($":x: Failed to update {name}");
            }
        }
示例#6
0
        public async Task SellWaifu([Remainder] string str = "")
        {
            var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(str, false, UserInventoryDb.GetWaifus(Context.User.Id, Context.Guild.Id)), this);

            //waifus existance
            if (waifu == null)
            {
                return;
            }

            int worth = WaifuUtil.GetSalePrice(waifu.Tier);

            var sell = new DialogueBoxOption();

            sell.Action = async(IUserMessage message) =>
            {
                if (!UserInventoryDb.OwnsWaifu(Context.User.Id, waifu, Context.Guild.Id))
                {
                    await message.ModifyAsync(x => {
                        x.Embed = new EmbedBuilderPrepared(Context.User).WithDescription("You tried :star:").Build();
                    });

                    return;
                }

                try { await BalanceDb.AddToasties(Context.User.Id, worth, Context.Guild.Id); }
                catch (Exception ex) { await Context.Channel.SendMessageAsync(ex.Message); }

                //removing waifu + confirmation
                await UserInventoryDb.DeleteWaifu(Context.User.Id, waifu, Context.Guild.Id);

                await message.ModifyAsync(x => {
                    x.Content = $"You sold **{waifu.Name}** for **{worth.ToString("n0")}** toasties.";
                    x.Embed   = ToastieUtil.ToastieEmbed(Context.User, BalanceDb.GetToasties(Context.User.Id, Context.Guild.Id)).Build();
                });
            };
            sell.After = OnExecute.RemoveReactions;

            var cancel = new DialogueBoxOption();

            cancel.After = OnExecute.Delete;

            var dia = new DialogueBox();

            dia.Options.Add(Emote.Parse("<:TickYes:577838859107303424>"), sell);
            dia.Options.Add(Emote.Parse("<:TickNo:577838859077943306>"), cancel);
            dia.Timeout = new TimeSpan(0, 1, 0);
            dia.Embed   = new EmbedBuilder()
                          .WithAuthor(Context.User)
                          .WithColor(BasicUtil.RandomColor())
                          .WithDescription($"Sell **{waifu.Name}** for **{worth.ToString("n0")}** toasties?").Build();

            await DialogueReplyAsync(dia);

            return;
        }
示例#7
0
        public async Task BuyWaifu([Remainder] string str = "")
        {
            var shopwaifus = (await WaifuShopDb.GetAllShopWaifus(Context.Guild.Id)).DistinctBy(x => x.WaifuName);

            var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(str, false, shopwaifus.Select(x => x.Waifu)), this);

            if (waifu == null)
            {
                return;
            }
            var waifus = UserInventoryDb.GetWaifus(Context.User.Id, Context.Guild.Id);

            if (waifus.Any(x => x.Name.Equals(waifu.Name)))
            {
                await Context.Channel.SendMessageAsync("You already have **" + waifu.Name + "**.");

                return;
            }

            ShopWaifu shopWaifu = shopwaifus.FirstOrDefault(x => x.Waifu.Equals(waifu) && x.Limited != 0);

            if (shopWaifu == null)
            {
                await Context.Channel.SendMessageAsync($"**{waifu.Name}** is not currently for sale! Try the `waifushop` command.");

                return;
            }

            var price = WaifuUtil.GetPrice(waifu.Tier, shopWaifu.Discount);

            try
            {
                await BalanceDb.AddToasties(Context.User.Id, -price, Context.Guild.Id);
            }
            catch (Exception ex)
            {
                await Context.Channel.SendMessageAsync(ex.Message);

                return;
            }

            await UserInventoryDb.AddWaifu(Context.User.Id, waifu, Context.Guild.Id);

            await Context.Channel.SendMessageAsync($"Congratulations! You bought **{waifu.Name}**!", false, WaifuUtil.WaifuEmbedBuilder(waifu).Build());

            await BalanceDb.AddToasties(Context.Client.CurrentUser.Id, price / 13, Context.Guild.Id);

            if (shopWaifu.Limited > 0)
            {
                shopWaifu.BoughtBy = Context.User.Id;
                shopWaifu.Limited -= 1;
                await WaifuShopDb.UpdateItem(shopWaifu);
            }
        }
示例#8
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());
        }
示例#9
0
        public async Task ShowWaifu([Remainder] string name)
        {
            var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(name), this);

            if (waifu == null)
            {
                //await Context.Channel.SendMessageAsync($"Can't find '{name}'. I know they are not real, but this one *really is* just your imagination >_>");
                return;
            }

            var eb = WaifuUtil.WaifuEmbedBuilder(waifu, Context);

            await Context.Channel.SendMessageAsync("", false, eb.Build());
        }
示例#10
0
        public async Task ModShopRemoveWaifu([Remainder] string name = "")
        {
            var shop = await WaifuUtil.GetShop(Context.Guild.Id, ShopType.Mod);

            var waifus = shop.ShopWaifus.Select(x => x.Waifu);

            var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(name, false, waifus), this);

            if (waifu == null)
            {
                return;
            }

            await WaifuShopDb.RemoveItem(shop.ShopWaifus.FirstOrDefault(x => x.Waifu.Name.Equals(waifu.Name)));

            await Context.Channel.SendMessageAsync(embed : new EmbedBuilderPrepared(Context.User)
                                                   .WithDescription($"*~ **{waifu.Name}** removed from the Mod Shop ~*")
                                                   .Build());

            return;
        }
示例#11
0
        public async Task WaifuTier(string name, int tier)
        {
            var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(name, true), this);

            if (waifu == null)
            {
                return;
            }

            string old = waifu.Tier.ToString();

            waifu.Tier = tier;

            if (await WaifuDb.UpdateWaifu(waifu) > 0)
            {
                await SendWaifuUpdatedMessage(waifu, "Tier", old, waifu.Tier.ToString());
            }
            else
            {
                await Context.Channel.SendMessageAsync($":x: Failed to update {name}");
            }
        }
示例#12
0
        public async Task WaifuSource(string name, [Remainder] string source = null)
        {
            var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(name, true), this);

            if (waifu == null)
            {
                return;
            }

            string old = waifu.Source;

            waifu.Source = source;

            if (await WaifuDb.UpdateWaifu(waifu) > 0)
            {
                await SendWaifuUpdatedMessage(waifu, "Source", old, waifu.Source);
            }
            else
            {
                await Context.Channel.SendMessageAsync($":x: Failed to update {name}");
            }
        }
示例#13
0
        public async Task RemoveWaifuWish([Remainder] string str = "")
        {
            var   user  = Context.User;
            Waifu waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(str, false, await WaifuWishlistDb.GetWishlist(Context.User.Id, Context.Guild.Id)), this);

            if (waifu == null)
            {
                return;
            }
            var waifus = await WaifuWishlistDb.GetWishlist(user.Id, Context.Guild.Id);

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

                return;
            }

            await WaifuWishlistDb.DeleteWaifuWish(user.Id, waifu, Context.Guild.Id);

            await Context.Channel.SendMessageAsync("You don't want her anymore, huh...");
        }
示例#14
0
        public async Task WaifuImage(string name, string url = null)
        {
            var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(name, true), this);

            if (waifu == null)
            {
                return;
            }

            await Context.Channel.TriggerTypingAsync();

            url ??= Context.Message.Attachments.FirstOrDefault()?.Url;

            if (url == null)
            {
                await Context.Channel.SendMessageAsync("Can't get your attachment, there probably isn't one. *Heh, dummy...*");

                return;
            }

            url = url.EndsWith(".gifv") ? url.Replace(".gifv", ".gif") : url;
            url = url.EndsWith(".mp4") ? url.Replace(".mp4", ".gif") : url;

            if (ImgurAPI.RateLimit.ClientRemaining < 15)
            {
                await ReplyAsync("Not enough imgur credits to upload. Please try again later.");

                return;
            }

            string albumId;

            if (!ImageDb.AlbumExists("Waifus"))
            {
                albumId = (await ImgurAPI.CreateAlbumAsync("Waifus")).Id;
                await ImageDb.CreateAlbum("Waifus", albumId);
            }
            else
            {
                albumId = ImageDb.GetAlbum("Waifus").AlbumId;
            }

            var iImage = await ImgurAPI.UploadImageAsync(url, albumId, null, name);

            string old = waifu.ImageUrl;

            waifu.ImageUrl = iImage.Link;
            await WaifuUtil.UploadWaifuImage(waifu, Context.Channel);

            if (await WaifuDb.UpdateWaifu(waifu) > 0)
            {
                await SendWaifuUpdatedMessage(waifu, "ImageUrl", old, waifu.ImageUrl);
            }
            else
            {
                await Context.Channel.SendMessageAsync($":x: Failed to update {name}");
            }

            await Context.Channel.TriggerTypingAsync();

            await WaifuUtil.FindAndUpdateWaifuImageSource(waifu, Context.Channel);
        }
示例#15
0
        public async Task ModShopAddWaifu([Remainder] string name)
        {
            var prefix = Program.GetPrefix(Context);

            if (!PremiumDb.IsPremium(Context.Guild.Id, ProType.GuildPlus))
            {
                await Context.Channel.SendMessageAsync(embed : new EmbedBuilderPrepared(Context.User)
                                                       .WithDescription($"*~ This command requires Pro Guild+ ~*")
                                                       .WithFooter($"`{prefix}pro`")
                                                       .Build());

                return;
            }

            var shop = await WaifuUtil.GetShop(Context.Guild.Id, ShopType.Mod);

            var waifus = shop.ShopWaifus.Select(x => x.Waifu);

            var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(name), this);

            if (waifu == null)
            {
                return;
            }

            if (waifu.Tier < 1 || waifu.Tier > 3)
            {
                await Context.Channel.SendMessageAsync(embed : new EmbedBuilderPrepared(Context.User)
                                                       .WithDescription($"*~ You can only add Tier 1-3 waifus ~*")
                                                       .Build());

                return;
            }
            if (shop.ShopWaifus.Count >= 15)
            {
                await Context.Channel.SendMessageAsync(embed : new EmbedBuilderPrepared(Context.User)
                                                       .WithDescription($"*~ The Mod Shop is limited to 15 waifus. `{prefix}msrw` to remove ~*")
                                                       .Build());

                return;
            }
            if (waifus.Any(x => x.Name.Equals(waifu.Name)))
            {
                await Context.Channel.SendMessageAsync(embed : new EmbedBuilderPrepared(Context.User)
                                                       .WithDescription($"*~ **{waifu.Name}** is already in the mod shop ~*")
                                                       .Build());

                return;
            }

            await WaifuShopDb.UpdateItem(new ShopWaifu
            {
                Discount  = 0,
                Limited   = -1,
                WaifuShop = shop,
                Waifu     = waifu
            });

            await Context.Channel.SendMessageAsync($"Added **{waifu.Name}** to the Mod Shop", embed : WaifuUtil.WaifuEmbedBuilder(waifu).Build());

            return;
        }