1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Updates to Diario

This commit is contained in:
Steffo 2019-04-02 19:52:50 +02:00
parent e00e9de3ca
commit 6ec151835d
2 changed files with 12 additions and 5 deletions

View file

@ -1,4 +1,5 @@
from ..utils import Command, CommandArgs, Call
import re
class DiarioCommand(Command):
@ -7,5 +8,8 @@ class DiarioCommand(Command):
command_title = "Aggiungi una citazione al Diario."
async def common(self, call: Call, args: CommandArgs):
# TODO
raise NotImplementedError("TODO")
# Recreate the full sentence
text = " ".join(args)
# Pass the sentence through the diario regex
match = re.match(r'["«‘“‛‟❛❝〝"`]([^"]+)["»’”❜❞〞"`] *(?:(?:-{1,2}|—) *(\w+))?(?:,? *([^ ].*))?', text)
# TODO

View file

@ -3,7 +3,8 @@ from sqlalchemy import Column, \
Text, \
Boolean, \
DateTime, \
ForeignKey
ForeignKey, \
String
from sqlalchemy.orm import relationship
from .royals import Royal
@ -15,9 +16,11 @@ class Diario:
creator_id = Column(Integer, ForeignKey("royals.id"))
quoted_id = Column(Integer, ForeignKey("royals.id"))
timestamp = Column(DateTime, nullable=False)
quote = Column(Text, nullable=False)
quoted_name = Column(String)
text = Column(Text, nullable=False)
context = Column(Text)
timestamp = Column(DateTime, nullable=False)
media_url = Column(String)
spoiler = Column(Boolean, default=False)
creator = relationship("Royal", foreign_keys=creator_id, backref="diario_created")