public async Task WaifuShopSlides([Remainder] string str = "") { List <ShopWaifu> waifus = (await WaifuUtil.GetShop(Context.Guild.Id, ShopType.Waifu)).ShopWaifus; waifus.RemoveAt(0); var lockObj = new Object(); if (slideLock.ContainsKey(Context.Channel.Id)) { slideLock.Remove(Context.Channel.Id); } slideLock.Add(Context.Channel.Id, lockObj); var eb = WaifuUtil.WaifuShopSlideEmbed(waifus[0].Waifu); var msg = await Context.Channel.SendMessageAsync("", false, eb.Build()); await Task.Delay(5000); for (int i = 1; i < waifus.Count; i++) { if (slideLock.GetValueOrDefault(Context.Channel.Id) != lockObj) { break; } eb = WaifuUtil.WaifuShopSlideEmbed(waifus[i].Waifu); await msg.ModifyAsync(x => x.Embed = eb.Build()); await Task.Delay(5000); } eb = WaifuUtil.WaifuShopSlideEmbed(waifus[new Random().Next(waifus.Count)].Waifu); eb.WithFooter("Slideshow ended."); await msg.ModifyAsync(x => x.Embed = eb.Build()); if (slideLock.GetValueOrDefault(Context.Channel.Id) == lockObj) { slideLock.Remove(Context.Channel.Id); } }