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

implemented anonyous check on /cerca

This commit is contained in:
Fabio De Simone 2019-01-28 22:55:41 +01:00 committed by Stefano Pigozzi
parent 8cdbb05eaf
commit 616b3cf3ab

View file

@ -302,7 +302,7 @@ def cmd_search(bot: Bot, update: Update):
entries = session.query(db.Diario).filter(db.Diario.text.ilike('%'+text+'%')).all() entries = session.query(db.Diario).filter(db.Diario.text.ilike('%'+text+'%')).all()
messageText = "Ecco i risultati della ricerca:\n" messageText = "Ecco i risultati della ricerca:\n"
for entry in entries[:5]: for entry in entries[:5]:
messageText+=f"[#{entry.id}](https://ryg.steffo.eu/diario#entry-{entry.id}) di {entry.author}\n{entry.text}\n\n" messageText+=f"[#{entry.id}](https://ryg.steffo.eu/diario#entry-{entry.id}) di {entry.author if entry.author is not None else 'Anonimo'}\n{entry.text}\n\n"
if len(entries)>5: if len(entries)>5:
messageText += "ci sono altre entrate del diario che corrispondono alla ricerca:\n" messageText += "ci sono altre entrate del diario che corrispondono alla ricerca:\n"
for entry in entries[5:]: for entry in entries[5:]: