1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-12-17 23:24:20 +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 from flask import escape
import configparser import configparser
import typing import typing
import strings
if typing.TYPE_CHECKING: if typing.TYPE_CHECKING:
# noinspection PyPackageRequirements # noinspection PyPackageRequirements
from discord import User as DiscordUser from discord import User as DiscordUser
@ -837,11 +836,10 @@ class Diario(Base):
return f"{self.id} - {self.timestamp} - {self.author}: {self.text}" return f"{self.id} - {self.timestamp} - {self.author}: {self.text}"
def to_telegram(self): def to_telegram(self):
return strings.safely_format_string(strings.DIARIO.ENTRY, words={ return '<a href="https://ryg.steffo.eu/diario#entry-{id}">#{id}</a> di <b>{author}</b>\n{text}'.format(
"id": self.id, id=self.id,
"author": self.author, author=self.author,
"text": self.text text=escape(self.text))
})
def to_html(self): def to_html(self):
return str(escape(self.text)).replace("\n", "<br>") return str(escape(self.text)).replace("\n", "<br>")

View file

@ -32,7 +32,7 @@ PONG = "🏓 Pong!"
# Diario # Diario
class DIARIO: class DIARIO:
SUCCESS = "✅ Riga aggiunta al diario:\n{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: class ERRORS:
INVALID_SYNTAX = "⚠ Sintassi del comando errata.\nSintassi: <code>/diario (frase)</code>, oppure rispondi a un messaggio con <code>/diario</code>." INVALID_SYNTAX = "⚠ Sintassi del comando errata.\nSintassi: <code>/diario (frase)</code>, oppure rispondi a un messaggio con <code>/diario</code>."