From 6af2698c42aa105f19e441523d1021dbb8da7957 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 10 Feb 2019 02:16:22 +0100 Subject: [PATCH] Fix /diario not saving strings correctly --- telegrambot.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/telegrambot.py b/telegrambot.py index a1ba1b60..b5c564c0 100644 --- a/telegrambot.py +++ b/telegrambot.py @@ -249,8 +249,8 @@ def cmd_diario(bot: telegram.Bot, update: telegram.Update, session: db.Session): return try: text = update.message.text.split(" ", 1)[1] - author = session.query(db.Telegram).filter_by(telegram_id=update.message.from_user.id).one_or_none() - saver = author + saver = session.query(db.Telegram).filter_by(telegram_id=update.message.from_user.id).one_or_none() + author = None except IndexError: if update.message.reply_to_message is None: reply(bot, update, strings.DIARIO.ERRORS.INVALID_SYNTAX) @@ -265,6 +265,7 @@ def cmd_diario(bot: telegram.Bot, update: telegram.Update, session: db.Session): return diario = db.Diario(timestamp=datetime.datetime.now(), saver=saver, + author=author, text=text) session.add(diario) session.commit()