mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Fix old diario doing weird stuff
This commit is contained in:
parent
03a486d626
commit
bcecf28056
1 changed files with 3 additions and 3 deletions
|
@ -107,8 +107,8 @@ def command(func: "function"):
|
||||||
# noinspection PyUnresolvedReferences
|
# noinspection PyUnresolvedReferences
|
||||||
def database_access(func: "function"):
|
def database_access(func: "function"):
|
||||||
def new_func(bot: telegram.Bot, update: telegram.Update):
|
def new_func(bot: telegram.Bot, update: telegram.Update):
|
||||||
|
session = db.Session()
|
||||||
try:
|
try:
|
||||||
session = db.Session()
|
|
||||||
return func(bot, update, session)
|
return func(bot, update, session)
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.error(f"Database error: {sys.exc_info()}")
|
logger.error(f"Database error: {sys.exc_info()}")
|
||||||
|
@ -248,7 +248,7 @@ def cmd_diario(bot: telegram.Bot, update: telegram.Update, session: db.Session):
|
||||||
if update.message.reply_to_message is None:
|
if update.message.reply_to_message is None:
|
||||||
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
|
actual_text = update.message.reply_to_message.text
|
||||||
if update.message.forward_from:
|
if update.message.forward_from:
|
||||||
author = session.query(db.Telegram) \
|
author = session.query(db.Telegram) \
|
||||||
.filter_by(telegram_id=update.message.forward_from.id) \
|
.filter_by(telegram_id=update.message.forward_from.id) \
|
||||||
|
@ -258,7 +258,7 @@ def cmd_diario(bot: telegram.Bot, update: telegram.Update, session: db.Session):
|
||||||
.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()
|
||||||
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 actual_text is None:
|
||||||
reply(bot, update, strings.DIARIO.ERRORS.NO_TEXT)
|
reply(bot, update, strings.DIARIO.ERRORS.NO_TEXT)
|
||||||
return
|
return
|
||||||
diario = db.Diario(timestamp=datetime.datetime.now(),
|
diario = db.Diario(timestamp=datetime.datetime.now(),
|
||||||
|
|
Loading…
Reference in a new issue