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()); }
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()); }
public static async Task NotifyWishlist(IEnumerable<Waifu> waifus, ulong guildId) { var wishes = await WaifuWishlistDb.GetWishlist(guildId); foreach (var wish in wishes) { if (waifus.Any(x => x.Name == wish.Waifu.Name)) { try { var guild = Program.GetClient().GetGuild(guildId); var ch = await guild.GetUser(wish.UserId).CreateDMChannelAsync(); await ch.SendMessageAsync($"**{wish.Waifu.Name}** is now for sale in **{guild.Name}**", false, WaifuEmbedBuilder(wish.Waifu).Build()); } catch { } } } }
// LOOTBOX public static async Task <Waifu> UnboxWaifu(LootboxStat box, bool isPremium = false, ulong userId = 0, ulong guildId = 0) { var rnd = new Random(); List <Waifu> waifus = new List <Waifu>(); int randomizerAmount = 7; int tier = box.GetRandomTier(); waifus.AddRange(await WaifuDb.RandomWaifus(tier, randomizerAmount)); if (isPremium) { waifus.AddRange((await WaifuWishlistDb.GetWishlist(userId, guildId)).Where(x => x.Tier == tier)); } return(waifus[rnd.Next(waifus.Count)]); }
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..."); }