Fix Task creation date
This commit is contained in:
parent
5e36108186
commit
e51a7509c6
2 changed files with 5 additions and 3 deletions
|
@ -10,10 +10,12 @@ class Task(Base):
|
||||||
user = Column(BigInteger, nullable=False)
|
user = Column(BigInteger, nullable=False)
|
||||||
channel = Column(BigInteger, nullable=False)
|
channel = Column(BigInteger, nullable=False)
|
||||||
date = Column(DateTime, 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.message = message
|
||||||
self.user = user
|
self.user = user
|
||||||
self.channel = channel
|
self.channel = channel
|
||||||
self.date = date
|
self.date = date
|
||||||
|
if creation_date:
|
||||||
|
self.creation_date = creation_date
|
||||||
|
|
|
@ -49,7 +49,7 @@ class Reminders(commands.Cog):
|
||||||
time = time_pars(time)
|
time = time_pars(time)
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
s = db.Session()
|
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.commit()
|
||||||
s.close()
|
s.close()
|
||||||
|
|
||||||
|
|
Reference in a new issue