1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Prevent circular import

This commit is contained in:
Steffo 2019-02-08 01:44:48 +01:00
parent 324df71ce4
commit 0e85dfaf3e
2 changed files with 5 additions and 7 deletions

10
db.py
View file

@ -19,7 +19,6 @@ import sql_queries
from flask import escape
import configparser
import typing
import strings
if typing.TYPE_CHECKING:
# noinspection PyPackageRequirements
from discord import User as DiscordUser
@ -837,11 +836,10 @@ class Diario(Base):
return f"{self.id} - {self.timestamp} - {self.author}: {self.text}"
def to_telegram(self):
return strings.safely_format_string(strings.DIARIO.ENTRY, words={
"id": self.id,
"author": self.author,
"text": self.text
})
return '<a href="https://ryg.steffo.eu/diario#entry-{id}">#{id}</a> di <b>{author}</b>\n{text}'.format(
id=self.id,
author=self.author,
text=escape(self.text))
def to_html(self):
return str(escape(self.text)).replace("\n", "<br>")

View file

@ -32,7 +32,7 @@ PONG = "🏓 Pong!"
# Diario
class DIARIO:
SUCCESS = "✅ Riga aggiunta al diario:\n{diario}"
ENTRY = '<a href="https://ryg.steffo.eu/diario#entry-{id}">#{id}</a> di <b>{author}</b>\n{text}'
ENTRY =
class ERRORS:
INVALID_SYNTAX = "⚠ Sintassi del comando errata.\nSintassi: <code>/diario (frase)</code>, oppure rispondi a un messaggio con <code>/diario</code>."