Example #1
0
        private async Task ReminderCreation(int days, int hours, int minutes, string name)
        {
            try
            {
                ReminderHelper.CreateReminder(days, hours, minutes, name, Context.User.Mention, Context.Channel.Id, Context.Guild.Id);
            }
            catch (ReminderNameTakenException)
            {
                await ReplyAsync("A reminder under that name is already being used! Choose a different name.");

                return;
            }

            await ReplyAsync("Reminder created!");
        }
Example #2
0
        public async Task ReminderRemove([Remainder] string name)
        {
            try
            {
                ReminderHelper.RemoveReminder(name);
            }
            catch (ReminderDoesNotExistException)
            {
                await ReplyAsync("Could not find a reminder under that name! Make sure the name matches exactly.");

                return;
            }

            await ReplyAsync("Removed reminder.");
        }
Example #3
0
        async Task Loop()
        {
            do
            {
                await ReminderHelper.ScanForNewReminders(client);

                if ((DateTime.UtcNow.Hour == 0 && DateTime.UtcNow.Minute < 1) || firstRun) //if it is a new day
                {
                    PollHelper.ScanForOldPolls();

                    await CalendarHelper.UpdateCalendarMessage(client);

                    CalendarHelper.RemoveOldEvents();

                    firstRun = false;
                }

                await Task.Delay(60000); //every minute
            } while (true);
        }