Browse Source

Ignore message deletion errors

pull/18/head
Vladislav Glinsky 6 years ago
parent
commit
86e4bfe47c
Signed by: cl0ne GPG Key ID: 9D058DD29491782E
  1. 6
      devpotato_bot/helpers.py

6
devpotato_bot/helpers.py

@ -1,5 +1,6 @@
from functools import wraps
import telegram.error
from telegram import Update, Message, Bot
from telegram.ext import CallbackContext
@ -9,6 +10,9 @@ def deletes_caller_message(func):
def wrapper(update: Update, context: CallbackContext):
bot: Bot = context.bot
message: Message = update.effective_message
bot.delete_message(message.chat_id, message.message_id)
try:
bot.delete_message(message.chat_id, message.message_id)
except telegram.error.BadRequest:
pass
return func(update, context)
return wrapper
Loading…
Cancel
Save