public static void GetNextReminder() { if (reminderQueue != null && reminderQueue.Count != 0) { Console.WriteLine("MEMORY QUEUE IS NOT EMPTY"); reminderHolder = reminderQueue.Dequeue(); Console.WriteLine(reminderQueue.Count); } }
public static void Say(ReminderNode nextReminder) { SlackChatHub H = new SlackChatHub(); H.ID = GetUserDMChannelID(nextReminder.UserName); BotMessage ConnectionMessage = new BotMessage(); ConnectionMessage.Text = nextReminder.ReminderContent; ConnectionMessage.ChatHub = H; Program.memoryBot.Say(ConnectionMessage).Wait(); }
public static void AddReminderItem(string message, string user, DateTime reminderTime, string userName) { ReminderNode reminderInput = new ReminderNode(); reminderInput.UserID = user; reminderInput.UserName = userName; reminderInput.ReminderContent = message; reminderInput.ReminderTime = reminderTime; reminderInput.Priority = Utils.GetDateTimeDifference(reminderInput.ReminderTime); ReadAndEnqueueMemory(); reminderQueue.Enqueue(reminderInput, reminderInput.Priority); Utils.SetMemoryAccessType("Reminder"); Utils.WriteMemory(); }
public static void ReminderTimeComparison(Object o) { Console.WriteLine("Tick"); if (reminderHolder == null) { GetNextReminder(); } else { Console.WriteLine((reminderHolder.ReminderTime - DateTime.Now).TotalMinutes); if ((reminderHolder.ReminderTime - DateTime.Now).TotalMinutes <= 1) { nextReminder = reminderHolder; reminderHolder = null; Utils.SetMemoryAccessType("Reminder"); Utils.Say(nextReminder); Utils.WriteMemory(); GetNextReminder(); } } }