Simplify the list/show instruction

master
Starbeamrainbowlabs 4 years ago
parent 9d72fbdee5
commit a81f012c0c
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
  1. 26
      RhinoReminds/ClientListener.cs

@ -151,23 +151,17 @@ namespace RhinoReminds
case "list":
case "show":
if (parts.Select((n) => n.ToLower()).Contains("all")) {
// Filter by reminders for this user.
IEnumerable<Reminder> userReminderList = reminderList.Reminders.Values.Where(
(Reminder next) => message.From.GetBareJid() == next.JidObj.GetBareJid()
);
StringBuilder listMessage = new StringBuilder("I've got the following reminders on my list:\n");
foreach (Reminder nextReminder in userReminderList) {
listMessage.AppendLine($"#{nextReminder.Id}: {nextReminder.Message} at {nextReminder.Time}");
}
listMessage.AppendLine();
listMessage.AppendLine($"({userReminderList.Count()} total)");
sendChatReply(message, listMessage.ToString());
return;
// Filter by reminders for this user.
IEnumerable<Reminder> userReminderList = reminderList.Reminders.Values.Where(
(Reminder next) => message.From.GetBareJid() == next.JidObj.GetBareJid()
);
StringBuilder listMessage = new StringBuilder("I've got the following reminders on my list:\n");
foreach (Reminder nextReminder in userReminderList) {
listMessage.AppendLine($"#{nextReminder.Id}: {nextReminder.Message} at {nextReminder.Time}");
}
sendChatReply(message, "Sorry, I can't show individual items on my list right now. Try saying 'list all' to see all of them!");
// TODO: Identify number
listMessage.AppendLine();
listMessage.AppendLine($"({userReminderList.Count()} total)");
sendChatReply(message, listMessage.ToString());
break;

Loading…
Cancel
Save