Skip to content

Commit

Permalink
Fix delete command
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahesh0253 committed Aug 23, 2022
1 parent a663fd5 commit adf3a5a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions plugins/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup

from info import START_MSG, CHANNELS, ADMINS, INVITE_MSG
from utils import Media, unpack_new_file_id
from utils import Media

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -93,8 +93,12 @@ async def delete(bot, message):
await msg.edit('This is not supported file format')
return

file_id = unpack_new_file_id(media.file_id)[0]
result = await Media.collection.delete_one({'file_id': file_id})
result = await Media.collection.delete_one({
'file_name': media.file_name,
'file_size': media.file_size,
'file_type': media.file_type,
'mime_type': media.mime_type
})

if result.deleted_count:
await msg.edit('File is successfully deleted from database')
Expand Down

0 comments on commit adf3a5a

Please sign in to comment.