def cmd_remind(self, event, duration, content):
if Reminder.count_for_user(event.author.id) > 30:
return event.msg.reply(':warning: you an only have 15 reminders going at once!')
remind_at = parse_duration(duration)
if remind_at > (datetime.utcnow() + timedelta(seconds=5 * YEAR_IN_SEC)):
return event.msg.reply(':warning: thats too far in the future, I\'ll forget!')
r = Reminder.create(
message_id=event.msg.id,
remind_at=remind_at,
content=content
)
self.reminder_task.set_next_schedule(r.remind_at)
event.msg.reply(':ok_hand: I\'ll remind you at {} ({})'.format(
r.remind_at.isoformat(),
humanize.naturaldelta(r.remind_at - datetime.utcnow()),
))
评论列表
文章目录