예제 #1
0
파일: Reminder.cs 프로젝트: abosh814/Crab
        public static Task remind(Match m, CommandContext context)
        {
            DateTime time = ReminderUtils.parseTime(m.Groups[1].Value);

            if (time < DateTime.Now)
            {
                return(context.Channel.SendMessageAsync("_Buzz_ no time travel, nerd."));
            }

            int id = ReminderInstance.add_reminder(context, time, m.Groups[2].Value);

            return(context.Channel.SendMessageAsync($"#{id} coming in at {time.ToString("R")}"));
        }
예제 #2
0
파일: Reminder.cs 프로젝트: abosh814/Crab
        public static Task unremind(Match match, CommandContext context)
        {
            bool success = false;
            int  id      = Convert.ToInt32(match.Groups[1].Value);

            if (Utils.isadmin(context.Invoker.Id))
            {
                success = ReminderInstance.remove_reminder_without_permcheck(id);
            }
            else
            {
                success = ReminderInstance.remove_reminder(id, context.Invoker.Id);
            }

            if (success)
            {
                return(context.Channel.SendMessageAsync($"Successfully removed #{id}"));
            }
            else
            {
                return(context.Channel.SendMessageAsync($"Couldn't remove #{id}, maybe its not your Reminder? Try `remindlist` to see your reminders."));
            }
        }