public async Task EditKinkData(SocketCommandContext Context) { ulong userID = Context.User.Id; Command kinkCommand = Vars.activeCommands.Where(x => x.ActorID == userID).FirstOrDefault(); Console.WriteLine(" we've got our kink command "); Kink kinkToEdit = Vars.tableEntries.Where(x => x.GetType().Name == "Kink").ToList().Cast <Kink>().ToList().Where(x => x.KinkID.ToString() == kinkCommand.CommandData).FirstOrDefault(); Console.WriteLine(" we've got our kink to edit "); if (kinkCommand.CommandData == "start") { string kinkName = Context.Message.Content; Kink kinkFromDB = DataMethods.GetKink(kinkName); if (kinkFromDB == null) { ulong msgEndID = kinkCommand.MessageID; var msgEnd = (RestUserMessage)await Context.Channel.GetMessageAsync(msgEndID); string endMessage = "Welcome " + Context.User.Mention + "\n" + "Kink not found, quitting!"; await msgEnd.ModifyAsync(x => x.Content = endMessage); Vars.activeCommands.RemoveAll(x => x.ActorID == Context.User.Id); await Context.Message.DeleteAsync(); return; } Vars.tableEntries.Add(kinkFromDB); kinkCommand.CommandData = kinkFromDB.KinkID.ToString(); kinkCommand.CommandStep = 1; string newMessage = "Welcome " + Context.User.Mention + "\n" + "Edit Kink Step 1: Enter New Name, or Fartz to skip"; ulong msgToEditID = kinkCommand.MessageID; var msgToEdit = (RestUserMessage)await Context.Channel.GetMessageAsync(msgToEditID, CacheMode.AllowDownload); await msgToEdit.ModifyAsync(x => x.Content = newMessage); await Context.Message.DeleteAsync(); } else if (kinkToEdit != null && kinkCommand.CommandStep == 1) { string newKinkName = Context.Message.Content; if (!newKinkName.Equals("fartz", StringComparison.OrdinalIgnoreCase)) { kinkToEdit.KinkName = newKinkName; Kink kinkToCheck = Vars.tableEntries.Where(x => x.GetType().Name == "Kink").ToList().Cast <Kink>().ToList().Where(x => x.KinkID.ToString() == kinkCommand.CommandData).FirstOrDefault(); if (kinkToEdit.KinkName != kinkToCheck.KinkName) { Console.WriteLine("Kink in edit list not updating"); } } kinkCommand.CommandStep = 2; string newMessage = "Welcome " + Context.User.Mention + "\n" + "Edit Kink Step 2: Enter New Description, or Fartz to skip"; ulong msgToEditID = kinkCommand.MessageID; var msgToEdit = (RestUserMessage)await Context.Channel.GetMessageAsync(msgToEditID, CacheMode.AllowDownload); await msgToEdit.ModifyAsync(x => x.Content = newMessage); await Context.Message.DeleteAsync(); } else if (kinkToEdit != null && kinkCommand.CommandStep == 2) { string newKinkDescrip = Context.Message.Content; if (!newKinkDescrip.Equals("fartz", StringComparison.OrdinalIgnoreCase)) { kinkToEdit.KinkDesc = newKinkDescrip; Kink kinkToCheck = Vars.tableEntries.Where(x => x.GetType().Name == "Kink").ToList().Cast <Kink>().ToList().Where(x => x.KinkID.ToString() == kinkCommand.CommandData).FirstOrDefault(); if (kinkToEdit.KinkDesc != kinkToCheck.KinkDesc) { Console.WriteLine("Kink in edit list not updating"); } } await Context.Message.DeleteAsync(); string newMessage = "Welcome " + Context.User.Mention + "\n" + "Now updating entry with new Name and Description: \n" + "Name: " + kinkToEdit.KinkName + "\n" + "Desc: " + kinkToEdit.KinkDesc + "\n"; ulong msgToEditID = kinkCommand.MessageID; var msgToEdit = (RestUserMessage)await Context.Channel.GetMessageAsync(msgToEditID, CacheMode.AllowDownload); await msgToEdit.ModifyAsync(x => x.Content = newMessage); await DataMethods.EditKink(kinkToEdit.KinkID, kinkToEdit.KinkName, kinkToEdit.KinkDesc); await Task.Delay(1000); newMessage += "\n."; await msgToEdit.ModifyAsync(x => x.Content = newMessage); await Task.Delay(1000); newMessage += "."; await msgToEdit.ModifyAsync(x => x.Content = newMessage); await Task.Delay(1000); newMessage += "."; await msgToEdit.ModifyAsync(x => x.Content = newMessage); await Task.Delay(1000); newMessage += " Done."; await msgToEdit.ModifyAsync(x => x.Content = newMessage); Vars.activeCommands.RemoveAll(x => x.ActorID == Context.User.Id); Vars.tableEntries.RemoveAll(x => x.GetType().Name == "Kink" && (x as Kink).KinkID == kinkToEdit.KinkID); } }