mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Use forward author if /diario is in response to a forwarded message
This commit is contained in:
parent
9c2248402b
commit
2c30c58d48
1 changed files with 8 additions and 3 deletions
|
@ -247,9 +247,14 @@ def cmd_diario(bot: telegram.Bot, update: telegram.Update, session: db.Session):
|
|||
reply(bot, update, strings.DIARIO.ERRORS.INVALID_SYNTAX)
|
||||
return
|
||||
text = update.message.reply_to_message.text
|
||||
author = session.query(db.Telegram)\
|
||||
.filter_by(telegram_id=update.message.reply_to_message.from_user.id)\
|
||||
.one_or_none()
|
||||
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)\
|
||||
.filter_by(telegram_id=update.message.reply_to_message.from_user.id)\
|
||||
.one_or_none()
|
||||
saver = session.query(db.Telegram).filter_by(telegram_id=update.message.from_user.id).one_or_none()
|
||||
if text is None:
|
||||
reply(bot, update, strings.DIARIO.ERRORS.NO_TEXT)
|
||||
|
|
Loading…
Reference in a new issue