1
0
Fork 0

Fix Task DB object date and creation_date type

This commit is contained in:
Ethanell 2020-05-28 17:34:09 +02:00
parent 0e1cd21681
commit 5e36108186
2 changed files with 4 additions and 4 deletions

View file

@ -1,5 +1,5 @@
from db import Base from db import Base
from sqlalchemy import Column, Integer, String, BigInteger, Date from sqlalchemy import Column, Integer, String, BigInteger, DateTime
from datetime import datetime from datetime import datetime
@ -9,8 +9,8 @@ class Task(Base):
message = Column(String, nullable=False) message = Column(String, nullable=False)
user = Column(BigInteger, nullable=False) user = Column(BigInteger, nullable=False)
channel = Column(BigInteger, nullable=False) channel = Column(BigInteger, nullable=False)
date = Column(Date, nullable=False) date = Column(DateTime, nullable=False)
creation_date = Column(Date, default=datetime.now()) creation_date = Column(DateTime, 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):
self.message = message self.message = message

View file

@ -99,7 +99,7 @@ class Reminders(commands.Cog):
embed = Embed(title="You have a reminder !") embed = Embed(title="You have a reminder !")
user = self.bot.get_user(task.user) user = self.bot.get_user(task.user)
embed.set_author(name=f"{user.name}#{user.discriminator}", icon_url=user.avatar_url) embed.set_author(name=f"{user.name}#{user.discriminator}", icon_url=user.avatar_url)
embed.add_field(name=str(task.date), value=task.message) embed.add_field(name=str(task.creation_date), value=task.message)
await (await self.bot.get_channel(task.channel).send(f"{user.mention}", embed=embed)).edit(content="") await (await self.bot.get_channel(task.channel).send(f"{user.mention}", embed=embed)).edit(content="")
@commands.Cog.listener() @commands.Cog.listener()