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)
|
reply(bot, update, strings.DIARIO.ERRORS.INVALID_SYNTAX)
|
||||||
return
|
return
|
||||||
text = update.message.reply_to_message.text
|
text = update.message.reply_to_message.text
|
||||||
author = session.query(db.Telegram)\
|
if update.message.forward_from:
|
||||||
.filter_by(telegram_id=update.message.reply_to_message.from_user.id)\
|
author = session.query(db.Telegram) \
|
||||||
.one_or_none()
|
.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()
|
saver = session.query(db.Telegram).filter_by(telegram_id=update.message.from_user.id).one_or_none()
|
||||||
if text is None:
|
if text is None:
|
||||||
reply(bot, update, strings.DIARIO.ERRORS.NO_TEXT)
|
reply(bot, update, strings.DIARIO.ERRORS.NO_TEXT)
|
||||||
|
|
Loading…
Reference in a new issue