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

Use forward author if /diario is in response to a forwarded message

This commit is contained in:
Steffo 2019-02-28 20:51:34 +01:00
parent 9c2248402b
commit 2c30c58d48

View file

@ -247,6 +247,11 @@ def cmd_diario(bot: telegram.Bot, update: telegram.Update, session: db.Session):
reply(bot, update, strings.DIARIO.ERRORS.INVALID_SYNTAX) reply(bot, update, strings.DIARIO.ERRORS.INVALID_SYNTAX)
return return
text = update.message.reply_to_message.text text = update.message.reply_to_message.text
if update.message.forward_from:
author = session.query(db.Telegram) \
.filter_by(telegram_id=update.message.forward_from.id) \
.one_or_none()
else:
author = session.query(db.Telegram)\ author = session.query(db.Telegram)\
.filter_by(telegram_id=update.message.reply_to_message.from_user.id)\ .filter_by(telegram_id=update.message.reply_to_message.from_user.id)\
.one_or_none() .one_or_none()