mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-24 03:54:20 +00:00
Fix callback queries
This commit is contained in:
parent
c9069a5221
commit
9266aedad9
1 changed files with 118 additions and 103 deletions
|
@ -388,9 +388,9 @@ def cmd_mm(bot: telegram.Bot, update: telegram.Update, session: db.Session):
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
|
|
||||||
@command
|
def on_callback_query(bot: telegram.Bot, update: telegram.Update):
|
||||||
@database_access
|
try:
|
||||||
def on_callback_query(bot: telegram.Bot, update: telegram.Update, session: db.Session):
|
session = db.Session()
|
||||||
if update.callback_query.data.startswith("vote_"):
|
if update.callback_query.data.startswith("vote_"):
|
||||||
if update.callback_query.data == "vote_yes":
|
if update.callback_query.data == "vote_yes":
|
||||||
status = db.VoteChoices.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")
|
parse_mode="HTML")
|
||||||
except BadRequest:
|
except BadRequest:
|
||||||
pass
|
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
|
@command
|
||||||
|
|
Loading…
Reference in a new issue