mirror of
https://github.com/TeamPGM/PagerMaid_Plugins_Pyro.git
synced 2024-11-24 18:47:43 +00:00
xtaodada
fb5a3f5baf
All checks were successful
Github commit to telegram / build (push) Successful in 13s
29 lines
954 B
Python
29 lines
954 B
Python
""" PagerMaid Plugins Paolu """
|
|
|
|
import contextlib
|
|
|
|
from pyrogram.types import ChatPermissions
|
|
|
|
from pagermaid.dependence import add_delete_message_job
|
|
from pagermaid.listener import listener
|
|
from pagermaid.enums import Client, Message
|
|
|
|
|
|
@listener(
|
|
command="paolu", groups_only=True, need_admin=True, description="⚠一键跑路 删除群内消息并禁言⚠"
|
|
)
|
|
async def pao_lu(bot: Client, message: Message):
|
|
"""一键跑路 删除群内消息并禁言"""
|
|
with contextlib.suppress(Exception):
|
|
await bot.set_chat_permissions(
|
|
message.chat.id,
|
|
permissions=ChatPermissions(
|
|
can_send_messages=False,
|
|
),
|
|
)
|
|
reply = await message.edit("[paolu] 处理中...")
|
|
with contextlib.suppress(Exception):
|
|
await bot.delete_messages(message.chat.id, list(range(1, message.id)))
|
|
await reply.edit("[paolu] Finished")
|
|
add_delete_message_job(reply, delete_seconds=10)
|