Skip to content

Commit

Permalink
automatically delete msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Kopylov committed Feb 10, 2024
1 parent 7653bdc commit fac9e7a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/handlers/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ async def game(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
)
)
context.bot_data.update(game_metadata)

# Delete command message
await update.effective_message.delete()
7 changes: 7 additions & 0 deletions src/handlers/save.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
else:
await update.effective_message.reply_text(
"Something went wrong. Can't process your request."
Expand Down

0 comments on commit fac9e7a

Please sign in to comment.