mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 08:27:38 +00:00
受启发,写了个扬群插件
This commit is contained in:
parent
003690b9e2
commit
744211ddfc
49
killallmembers.py
Normal file
49
killallmembers.py
Normal file
@ -0,0 +1,49 @@
|
||||
from pagermaid import bot, log
|
||||
from pagermaid.listener import listener
|
||||
from asyncio import sleep
|
||||
from telethon.tl.types import ChannelParticipantsAdmins
|
||||
from telethon.tl.functions.channels import EditBannedRequest
|
||||
from telethon.tl.types import ChatBannedRights
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="killallmembers",
|
||||
description="⚠⚠慎用! 一件扬了群内所有成员⚠⚠")
|
||||
async def killallmembers(context):
|
||||
await context.edit('正在准备扬了这个破群的所有人...')
|
||||
chat = await context.get_chat()
|
||||
if not context.is_group:
|
||||
await context.edit('发生错误,请在群组中运行本命令。')
|
||||
await sleep(10)
|
||||
await context.delete()
|
||||
return False
|
||||
else:
|
||||
try:
|
||||
chat = await context.get_chat()
|
||||
admins = await context.client.get_participants(chat, filter=ChannelParticipantsAdmins)
|
||||
users = await context.client.get_participants(chat)
|
||||
admins_ids = [a.id for a in admins]
|
||||
users_ids = [u.id for u in users]
|
||||
users_wo_admins = list(set(users_ids).difference(set(admins_ids)))
|
||||
except:
|
||||
await context.edit('发生错误,无法获取本群名单。')
|
||||
await sleep(10)
|
||||
await context.delete()
|
||||
return False
|
||||
|
||||
if context.sender.id in admins_ids:
|
||||
i = 0
|
||||
for user_id in users_wo_admins:
|
||||
try:
|
||||
await bot.edit_permissions(context.chat_id, user_id, view_messages=False)
|
||||
i += 1
|
||||
await context.edit(f'进度:{i}/{len(users_wo_admins)}')
|
||||
await sleep(.5)
|
||||
except:
|
||||
await context.edit('发生错误')
|
||||
await sleep(10)
|
||||
await context.delete()
|
||||
await sleep(5)
|
||||
await context.delete()
|
||||
else:
|
||||
await context.edit('你又不是管理员,你在这儿干个屁?')
|
||||
await sleep(10)
|
||||
await context.delete()
|
10
list.json
10
list.json
@ -289,6 +289,16 @@
|
||||
"supported": true,
|
||||
"des-short": "网易云点歌",
|
||||
"des": "可以在线搜索并且快速点歌,歌曲信息齐全,支持直接回复点歌。命令:nem。"
|
||||
},
|
||||
{
|
||||
"name": "killallmembers",
|
||||
"version": "1.0",
|
||||
"section": "chat",
|
||||
"maintainer": "Pentacene",
|
||||
"size": "idk",
|
||||
"supported": true,
|
||||
"des-short": "一键扬了群",
|
||||
"des": "⚠⚠慎用! 一件扬了群内所有成员⚠⚠"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user