Merge branch 'master' into master

This commit is contained in:
AAA 2020-08-29 19:44:07 +08:00 committed by GitHub
commit 2b778c5c2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 64 additions and 5 deletions

View File

@ -6,7 +6,7 @@ from os import remove
import re import re
import time import time
@listener(is_plugin=True, incoming=True, outgoing=True, command="atadmins", @listener(is_plugin=True, outgoing=True, command="atadmins",
description="一键 AT 本群管理员(仅在群组中有效)", description="一键 AT 本群管理员(仅在群组中有效)",
parameters="<要说的话>") parameters="<要说的话>")
async def atadmins(context): async def atadmins(context):
@ -34,7 +34,7 @@ async def atadmins(context):
# await context.reply(' , '.join(admin_list)) # await context.reply(' , '.join(admin_list))
await context.delete() await context.delete()
@listener(is_plugin=True, incoming=True, outgoing=True, command="atall", @listener(is_plugin=True, outgoing=True, command="atall",
description="一键 AT 本群成员(仅在群组中有效)") description="一键 AT 本群成员(仅在群组中有效)")
async def atall(context): async def atall(context):
await context.edit('正在获取成员列表中...') await context.edit('正在获取成员列表中...')

49
killallmembers.py Normal file
View 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()

View File

@ -112,7 +112,7 @@
}, },
{ {
"name": "atadmins_atall", "name": "atadmins_atall",
"version": "1.1", "version": "1.11",
"section": "chat", "section": "chat",
"maintainer": "Pentacene", "maintainer": "Pentacene",
"size": "2.5 kb", "size": "2.5 kb",
@ -289,6 +289,16 @@
"supported": true, "supported": true,
"des-short": "网易云点歌", "des-short": "网易云点歌",
"des": "可以在线搜索并且快速点歌歌曲信息齐全支持直接回复点歌。命令nem。" "des": "可以在线搜索并且快速点歌歌曲信息齐全支持直接回复点歌。命令nem。"
},
{
"name": "killallmembers",
"version": "1.0",
"section": "chat",
"maintainer": "Pentacene",
"size": "idk",
"supported": true,
"des-short": "一键扬了群",
"des": "⚠⚠慎用! 一件扬了群内所有成员⚠⚠"
} }
] ]
} }

View File

@ -334,7 +334,7 @@ async def nem(context):
try: try:
content = requests.get( content = requests.get(
url=real_url, headers=self.headers).content url=real_url, headers=self.headers).content
with open(file, 'wb') as fp: with open(file, 'wb', encoding='utf8') as fp:
fp.write(content) fp.write(content)
except: except:
print('服务器连接出错') print('服务器连接出错')
@ -373,7 +373,7 @@ async def nem(context):
';', ', ') + " - " + "**" + info['title'] + "**" ';', ', ') + " - " + "**" + info['title'] + "**"
if ccimported is False: if ccimported is False:
with open(name, 'wb') as f: with open(name, 'wb', encoding='utf8') as f:
f.write(music.content) f.write(music.content)
if (path.getsize(name) / 1024) < 100: if (path.getsize(name) / 1024) < 100:
remove(name) remove(name)