-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
saving games to db, lesser msgs, timeout for db #8
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -95,6 +95,13 @@ async def save(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: | |||||||||||||||||||||||||||||||||||||||
await update.effective_message.reply_text( | ||||||||||||||||||||||||||||||||||||||||
"The Game has been saved!. Results: {}".format(game.results) | ||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||
# Delete the poll | ||||||||||||||||||||||||||||||||||||||||
await context.bot.delete_message( | ||||||||||||||||||||||||||||||||||||||||
chat_id=game.chat_id, | ||||||||||||||||||||||||||||||||||||||||
message_id=game.poll_id | ||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||
# Delete this callback /save message | ||||||||||||||||||||||||||||||||||||||||
await update.effective_message.delete() | ||||||||||||||||||||||||||||||||||||||||
Comment on lines
+98
to
+104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding error handling around the message deletion operations to gracefully handle potential permission issues. This ensures the bot's stability and provides a better user experience in cases where it might not have the necessary permissions to delete messages. - await context.bot.delete_message(chat_id=game.chat_id, message_id=game.poll_id)
+ try:
+ await context.bot.delete_message(chat_id=game.chat_id, message_id=game.poll_id)
+ except Exception as e:
+ # Log the error or notify the bot owner
+ pass
- await update.effective_message.delete()
+ try:
+ await update.effective_message.delete()
+ except Exception as e:
+ # Log the error or notify the bot owner
+ pass Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||||||||||||||||
await update.effective_message.reply_text( | ||||||||||||||||||||||||||||||||||||||||
"Something went wrong. Can't process your request." | ||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding error handling around the message deletion to gracefully handle potential permission issues. This ensures the bot's stability and provides a better user experience in cases where it might not have the necessary permissions to delete messages.
Committable suggestion