Brian S. Stephan
a03c69258f
this makes it so that if we have multiple bot instances running, they will only pay attention to the countdown items for their current server
28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
"""Countdown item models."""
|
|
from django.db import models
|
|
from django.utils import timezone
|
|
|
|
|
|
class CountdownItem(models.Model):
|
|
"""Track points in time."""
|
|
|
|
name = models.CharField(max_length=64, default='')
|
|
at_time = models.DateTimeField()
|
|
|
|
is_reminder = models.BooleanField(default=False)
|
|
sent_reminder = models.BooleanField(default=False)
|
|
|
|
reminder_message = models.TextField(default="")
|
|
reminder_target = models.CharField(max_length=64, blank=True, default='')
|
|
reminder_target_new = models.ForeignKey('ircbot.IrcChannel', null=True, blank=True,
|
|
default=None, on_delete=models.CASCADE)
|
|
|
|
recurring_period = models.CharField(max_length=64, blank=True, default='')
|
|
recurring_until = models.DateTimeField(null=True, blank=True, default=None)
|
|
|
|
created_time = models.DateTimeField(auto_now_add=True)
|
|
|
|
def __str__(self):
|
|
"""Summarize object."""
|
|
return "{0:s} @ {1:s}".format(self.name, timezone.localtime(self.at_time).strftime('%Y-%m-%d %H:%M:%S %Z'))
|