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

Fix callback queries

This commit is contained in:
Steffo 2019-02-10 14:46:06 +01:00
parent c9069a5221
commit 9266aedad9

View file

@ -388,9 +388,9 @@ def cmd_mm(bot: telegram.Bot, update: telegram.Update, session: db.Session):
session.commit()
@command
@database_access
def on_callback_query(bot: telegram.Bot, update: telegram.Update, session: db.Session):
def on_callback_query(bot: telegram.Bot, update: telegram.Update):
try:
session = db.Session()
if update.callback_query.data.startswith("vote_"):
if update.callback_query.data == "vote_yes":
status = db.VoteChoices.YES
@ -495,6 +495,21 @@ def on_callback_query(bot: telegram.Bot, update: telegram.Update, session: db.Se
parse_mode="HTML")
except BadRequest:
pass
except Exception:
sentry.user_context({
"id": update.effective_user.id,
"telegram": {
"username": update.effective_user.username,
"first_name": update.effective_user.first_name,
"last_name": update.effective_user.last_name
}
})
sentry.extra_context({
"update": update.to_dict()
})
sentry.captureException()
finally:
session.close()
@command