diff --git a/db/Task.py b/db/Task.py index b39c7df..4c06d0d 100644 --- a/db/Task.py +++ b/db/Task.py @@ -10,10 +10,12 @@ class Task(Base): user = Column(BigInteger, nullable=False) channel = Column(BigInteger, nullable=False) date = Column(DateTime, nullable=False) - creation_date = Column(DateTime, default=datetime.now()) + creation_date = Column(DateTime, nullable=False, default=datetime.now()) - def __init__(self, message: str, user: int, channel: int, date: datetime): + def __init__(self, message: str, user: int, channel: int, date: datetime, creation_date: datetime = None): self.message = message self.user = user self.channel = channel self.date = date + if creation_date: + self.creation_date = creation_date diff --git a/extensions/reminders.py b/extensions/reminders.py index d55e58f..a3f4d28 100644 --- a/extensions/reminders.py +++ b/extensions/reminders.py @@ -49,7 +49,7 @@ class Reminders(commands.Cog): time = time_pars(time) now = datetime.now() s = db.Session() - s.add(db.Task(message, ctx.author.id, ctx.channel.id, now + time)) + s.add(db.Task(message, ctx.author.id, ctx.channel.id, now + time, ctx.message.created_at)) s.commit() s.close()