PagerMaid_Plugins/paolu.py

48 lines
1.4 KiB
Python
Raw Normal View History

""" PagerMaid Plugins Paolu """
2021-04-16 15:48:39 +00:00
# ______ _
# | ___ \ | |
# | |_/ /__ _ __ | |_ __ _ ___ ___ _ __ ___
# | __/ _ \ '_ \| __/ _` |/ __/ _ \ '_ \ / _ \
# | | | __/ | | | || (_| | (_| __/ | | | __/
# \_| \___|_| |_|\__\__,_|\___\___|_| |_|\___|
#
from asyncio import sleep
from telethon.errors.common import MultiError
from pagermaid.listener import listener
2021-06-16 07:09:40 +00:00
from pagermaid.utils import alias_command
2021-06-16 07:09:40 +00:00
@listener(is_plugin=True, outgoing=True, command=alias_command("paolu"),
description="⚠一键跑路 删除群内消息并禁言⚠")
async def paolu(context):
"""一键跑路 删除群内消息并禁言"""
2021-04-16 15:44:46 +00:00
try:
2021-04-16 15:48:39 +00:00
await context.client.edit_permissions(
2021-06-16 07:09:40 +00:00
entity=context.chat_id,
send_messages=False,
send_media=False,
send_stickers=False,
send_gifs=False,
send_games=False,
send_inline=False,
send_polls=False,
invite_users=False,
change_info=False,
pin_messages=False)
2021-04-16 15:44:46 +00:00
except:
pass
try:
await context.client.delete_messages(context.chat_id, list(range(1, context.message.id)))
except MultiError:
pass
2021-04-16 15:44:46 +00:00
try:
2021-04-16 15:48:39 +00:00
await context.client.edit_permissions(
2021-06-16 07:09:40 +00:00
entity=context.chat_id,
send_messages=False)
2021-04-16 15:44:46 +00:00
except:
pass
await context.edit("Finished")
await sleep(10)
await context.delete()