2022-06-22 04:55:20 +00:00
|
|
|
""" Module to message deletion. """
|
2023-01-15 03:16:50 +00:00
|
|
|
|
|
|
|
import contextlib
|
|
|
|
|
|
|
|
from pagermaid.enums import Client, Message
|
|
|
|
from pagermaid.listener import listener, _lock
|
2022-06-22 04:10:19 +00:00
|
|
|
from pagermaid.modules.prune import self_prune
|
2024-09-28 14:35:08 +00:00
|
|
|
from pagermaid.static import read_context
|
2023-01-15 03:16:50 +00:00
|
|
|
from pagermaid.utils import lang
|
2022-06-22 04:10:19 +00:00
|
|
|
|
|
|
|
|
2023-07-01 12:18:58 +00:00
|
|
|
@listener(
|
|
|
|
is_plugin=False,
|
|
|
|
command="dme",
|
|
|
|
need_admin=True,
|
|
|
|
description=lang("sp_des"),
|
|
|
|
parameters=lang("sp_parameters"),
|
|
|
|
)
|
2023-01-15 03:16:50 +00:00
|
|
|
async def dme(bot: Client, message: Message):
|
2023-07-01 12:18:58 +00:00
|
|
|
"""Deletes specific amount of messages you sent."""
|
2023-01-15 03:16:50 +00:00
|
|
|
async with _lock:
|
|
|
|
with contextlib.suppress(Exception):
|
|
|
|
del read_context[(message.chat.id, message.id)]
|
2022-06-22 04:55:20 +00:00
|
|
|
await self_prune(bot, message)
|