mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-26 02:40:53 +00:00
xtao-some 支持清理群内死号。
This commit is contained in:
parent
9023c1d4b9
commit
cf2a0defb1
@ -62,7 +62,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "xtao-some",
|
"name": "xtao-some",
|
||||||
"version": "1.161",
|
"version": "1.17",
|
||||||
"section": "daily",
|
"section": "daily",
|
||||||
"maintainer": "xtaodada",
|
"maintainer": "xtaodada",
|
||||||
"size": "18.8 kb",
|
"size": "18.8 kb",
|
||||||
@ -492,7 +492,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "rape",
|
"name": "rape",
|
||||||
"version": "1.01",
|
"version": "1.02",
|
||||||
"section": "chat",
|
"section": "chat",
|
||||||
"maintainer": "Pentacene",
|
"maintainer": "Pentacene",
|
||||||
"size": "4.0 kb",
|
"size": "4.0 kb",
|
||||||
|
14
rape.py
14
rape.py
@ -19,11 +19,11 @@ async def rape(context):
|
|||||||
reply = await context.get_reply_message()
|
reply = await context.get_reply_message()
|
||||||
if context.is_group:
|
if context.is_group:
|
||||||
if reply:
|
if reply:
|
||||||
if reply.sender.last_name == None:
|
if reply.sender.last_name is None:
|
||||||
reply_last_name = ''
|
reply_last_name = ''
|
||||||
else:
|
else:
|
||||||
reply_last_name = reply.sender.last_name
|
reply_last_name = reply.sender.last_name
|
||||||
if context.sender.last_name == None:
|
if context.sender.last_name is None:
|
||||||
context_last_name = ''
|
context_last_name = ''
|
||||||
else:
|
else:
|
||||||
context_last_name = context.sender.last_name
|
context_last_name = context.sender.last_name
|
||||||
@ -48,13 +48,18 @@ async def rape(context):
|
|||||||
pin_messages=False)
|
pin_messages=False)
|
||||||
await context.client.send_message(
|
await context.client.send_message(
|
||||||
context.chat_id,
|
context.chat_id,
|
||||||
f'[{context.sender.first_name} {context_last_name}](tg://user?id={context.sender.id}) 由于乱玩管理员命令 已被禁言60秒',
|
f'[{context.sender.first_name} {context_last_name}](tg://user?id={context.sender.id}) '
|
||||||
|
f'由于乱玩管理员命令 已被禁言60秒',
|
||||||
reply_to=reply.id
|
reply_to=reply.id
|
||||||
)
|
)
|
||||||
await context.delete()
|
await context.delete()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
if context.sender.last_name is None:
|
||||||
|
context_last_name = ''
|
||||||
|
else:
|
||||||
|
context_last_name = context.sender.last_name
|
||||||
if context.arguments == '':
|
if context.arguments == '':
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
@ -80,7 +85,8 @@ async def rape(context):
|
|||||||
change_info=False, pin_messages=False)
|
change_info=False, pin_messages=False)
|
||||||
await context.client.send_message(
|
await context.client.send_message(
|
||||||
context.chat_id,
|
context.chat_id,
|
||||||
f'[{context.sender.first_name}{context_last_name}](tg://user?id={context.sender.id}) 由于乱玩管理员命令 已被禁言60秒',
|
f'[{context.sender.first_name}{context_last_name}](tg://user?id={context.sender.id}) '
|
||||||
|
f'由于乱玩管理员命令 已被禁言60秒',
|
||||||
reply_to=context.id
|
reply_to=context.id
|
||||||
)
|
)
|
||||||
await context.delete()
|
await context.delete()
|
||||||
|
12
xtao-some.py
12
xtao-some.py
@ -5,6 +5,7 @@ from pagermaid import bot, log
|
|||||||
from pagermaid.listener import listener, config
|
from pagermaid.listener import listener, config
|
||||||
from pagermaid.utils import clear_emojis, obtain_message, attach_log, alias_command
|
from pagermaid.utils import clear_emojis, obtain_message, attach_log, alias_command
|
||||||
from telethon.errors import ChatAdminRequiredError
|
from telethon.errors import ChatAdminRequiredError
|
||||||
|
from telethon.tl.types import ChannelParticipantsAdmins
|
||||||
|
|
||||||
|
|
||||||
@listener(is_plugin=True, outgoing=True, command=alias_command("guess"),
|
@listener(is_plugin=True, outgoing=True, command=alias_command("guess"),
|
||||||
@ -282,10 +283,19 @@ async def getdel(context):
|
|||||||
try:
|
try:
|
||||||
await context.edit('遍历成员中。。。')
|
await context.edit('遍历成员中。。。')
|
||||||
chat = await context.get_chat()
|
chat = await context.get_chat()
|
||||||
|
admins = await context.client.get_participants(context.chat, filter=ChannelParticipantsAdmins)
|
||||||
|
need_kick = False
|
||||||
|
if context.sender in admins:
|
||||||
|
need_kick = True
|
||||||
async for member in bot.iter_participants(chat):
|
async for member in bot.iter_participants(chat):
|
||||||
if member.deleted:
|
if member.deleted:
|
||||||
member_count += 1
|
member_count += 1
|
||||||
await context.edit(f'此频道/群组的死号数:`{member_count}`')
|
if need_kick:
|
||||||
|
await context.client.kick_participant(context.chat_id, member.id)
|
||||||
|
if need_kick:
|
||||||
|
await context.edit(f'此频道/群组的死号数:`{member_count}`,并且已经清理完毕。')
|
||||||
|
else:
|
||||||
|
await context.edit(f'此频道/群组的死号数:`{member_count}`。')
|
||||||
except ChatAdminRequiredError:
|
except ChatAdminRequiredError:
|
||||||
await context.edit('未加入此频道。')
|
await context.edit('未加入此频道。')
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user