PagerMaid_Plugins_Pyro/dme/main.py

25 lines
679 B
Python
Raw Normal View History

""" 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
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
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)]
await self_prune(bot, message)