mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 01:15:34 +00:00
🎉 Portball 1.21 and atadmin_atall 1.1 (#12)
This commit is contained in:
parent
409e804b9b
commit
5567412c9e
@ -6,7 +6,7 @@ from os import remove
|
||||
import re
|
||||
import time
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="atadmins",
|
||||
@listener(is_plugin=True, incoming=True, outgoing=True, command="atadmins",
|
||||
description="一键 AT 本群管理员(仅在群组中有效)",
|
||||
parameters="<要说的话>")
|
||||
async def atadmins(context):
|
||||
@ -34,7 +34,7 @@ async def atadmins(context):
|
||||
# await context.reply(' , '.join(admin_list))
|
||||
await context.delete()
|
||||
|
||||
@listener(outgoing=True, command="atall",
|
||||
@listener(is_plugin=True, incoming=True, outgoing=True, command="atall",
|
||||
description="一键 AT 本群成员(仅在群组中有效)")
|
||||
async def atall(context):
|
||||
await context.edit('正在获取成员列表中...')
|
||||
|
10
list.json
10
list.json
@ -112,7 +112,7 @@
|
||||
},
|
||||
{
|
||||
"name": "atadmins_atall",
|
||||
"version": "1.0",
|
||||
"version": "1.1",
|
||||
"section": "chat",
|
||||
"maintainer": "Pentacene",
|
||||
"size": "2.5 kb",
|
||||
@ -152,11 +152,11 @@
|
||||
},
|
||||
{
|
||||
"name": "portball",
|
||||
"version": "1.1",
|
||||
"version": "1.21",
|
||||
"section": "chat",
|
||||
"maintainer": "丢失了",
|
||||
"size": "3.0 kb",
|
||||
"supported": false,
|
||||
"maintainer": "Pentacene",
|
||||
"size": "3.6 kb",
|
||||
"supported": true,
|
||||
"des-short": "回复你要临时禁言的人的消息来实现XX秒的禁言。",
|
||||
"des": "这个人很懒,什么都没有留下。"
|
||||
},
|
||||
|
28
portball.py
28
portball.py
@ -6,9 +6,9 @@ from datetime import timedelta
|
||||
from telethon.tl.types import ChannelParticipantsAdmins
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="portball",
|
||||
description="回复你要临时禁言的人的消息来实现XX秒的禁言。",
|
||||
parameters="<理由> <时间 单位:秒>")
|
||||
@listener(incoming=True, outgoing=True, command="portball",
|
||||
description="回复你要临时禁言的人的消息来实现XX秒的禁言",
|
||||
parameters="<理由>(空格)<时间/秒>")
|
||||
async def portball(context):
|
||||
reply = await context.get_reply_message()
|
||||
if context.is_group:
|
||||
@ -18,11 +18,8 @@ async def portball(context):
|
||||
last_name = ''
|
||||
else:
|
||||
last_name = reply.sender.last_name
|
||||
if not len(action) == 2:
|
||||
await context.edit('你好蠢诶,没有参数我怎么禁言嘛。')
|
||||
return
|
||||
if int(action[1])<60:
|
||||
notification = await bot.send_message(context.chat_id, '诶呀不要小于60秒啦')
|
||||
notification = await bot.send_message(context.chat_id, '诶呀不要小于60秒啦', reply_to = context.id)
|
||||
await sleep(10)
|
||||
await notification.delete()
|
||||
try:
|
||||
@ -33,31 +30,34 @@ async def portball(context):
|
||||
admins = await context.client.get_participants(context.chat, filter=ChannelParticipantsAdmins)
|
||||
if context.sender in admins:
|
||||
try:
|
||||
await bot.edit_permissions(context.chat_id, reply.sender.id, timedelta(seconds=int(action[1].replace(' ',''))), send_messages=False)
|
||||
await bot.send_message(
|
||||
await bot.edit_permissions(context.chat_id, reply.sender.id, timedelta(seconds=int(action[1].replace(' ',''))), 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)
|
||||
portball_message = await bot.send_message(
|
||||
context.chat_id,
|
||||
f'[{reply.sender.first_name}{last_name}](tg://user?id={reply.sender.id}) 由于 {action[0]} \n'
|
||||
f'被暂时禁言{action[1]}秒',
|
||||
reply_to = reply.id
|
||||
)
|
||||
await context.delete()
|
||||
await sleep(int(action[1].replace(' ','')))
|
||||
await portball_message.delete()
|
||||
except rpcerrorlist.UserAdminInvalidError:
|
||||
notification = await bot.send_message(context.chat_id, '错误:我没有管理员权限或我的权限比被封禁的人要小')
|
||||
notification = await bot.send_message(context.chat_id, '错误:我没有管理员权限或我的权限比被封禁的人要小', reply_to = context.id)
|
||||
await sleep(10)
|
||||
await notification.delete()
|
||||
except rpcerrorlist.ChatAdminRequiredError:
|
||||
notification = await bot.send_message(context.chat_id, '错误:我没有管理员权限或我的权限比被封禁的人要小')
|
||||
notification = await bot.send_message(context.chat_id, '错误:我没有管理员权限或我的权限比被封禁的人要小', reply_to = context.id)
|
||||
await sleep(10)
|
||||
await notification.delete()
|
||||
else:
|
||||
notification = await bot.send_message(context.chat_id, '诶呀你不是管理员,不要给人家塞口球啊')
|
||||
notification = await bot.send_message(context.chat_id, '诶呀你不是管理员,不要给人家塞口球啊', reply_to = context.id)
|
||||
await sleep(10)
|
||||
await notification.delete()
|
||||
else:
|
||||
notification = await bot.send_message(context.chat_id, '你好蠢诶,都没有回复人,我哪知道你要搞谁的事情……')
|
||||
notification = await bot.send_message(context.chat_id, '你好蠢诶,都没有回复人,我哪知道你要搞谁的事情……', reply_to = context.id)
|
||||
await sleep(10)
|
||||
await notification.delete()
|
||||
else:
|
||||
notification = await bot.send_message(context.chat_id, '你好蠢诶,又不是群组,怎么禁言啦!')
|
||||
notification = await bot.send_message(context.chat_id, '你好蠢诶,又不是群组,怎么禁言啦!', reply_to = context.id)
|
||||
await sleep(10)
|
||||
await notification.delete()
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user