dme 适配 v1.2.23

This commit is contained in:
xtaodada 2023-01-15 11:16:50 +08:00
parent 0275279f9e
commit ffc6947430
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -1,14 +1,21 @@
""" Module to message deletion. """ """ Module to message deletion. """
from pagermaid import bot
from pagermaid.listener import listener import contextlib
from pagermaid.utils import Message, lang
from pagermaid import read_context
from pagermaid.enums import Client, Message
from pagermaid.listener import listener, _lock
from pagermaid.modules.prune import self_prune from pagermaid.modules.prune import self_prune
from pagermaid.utils import lang
@listener(is_plugin=False, command="dme", @listener(is_plugin=False, command="dme",
need_admin=True, need_admin=True,
description=lang('sp_des'), description=lang('sp_des'),
parameters=lang('sp_parameters')) parameters=lang('sp_parameters'))
async def dme(message: Message): async def dme(bot: Client, message: Message):
""" Deletes specific amount of messages you sent. """ """ Deletes specific amount of messages you sent. """
async with _lock:
with contextlib.suppress(Exception):
del read_context[(message.chat.id, message.id)]
await self_prune(bot, message) await self_prune(bot, message)