mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 12:55:38 +00:00
🎉 atadmins_atall denyu hyperlink
This commit is contained in:
parent
ff56bcb3bd
commit
f5650b8507
@ -52,6 +52,8 @@
|
|||||||
- `dme` : 反 TG desktop 防撤回插件。
|
- `dme` : 反 TG desktop 防撤回插件。
|
||||||
- `autorm` : 在指定的时间后删除自己的消息。
|
- `autorm` : 在指定的时间后删除自己的消息。
|
||||||
- `sendat` : 定时发送消息。
|
- `sendat` : 定时发送消息。
|
||||||
|
- `atadmins_atall` : 一键 AT 本群管理员、群员。
|
||||||
|
- `denyu` : 在某群中强制禁言某用户。
|
||||||
- profile (资料类)
|
- profile (资料类)
|
||||||
- `autochangename` : 自动更新 last_name 为时间等。
|
- `autochangename` : 自动更新 last_name 为时间等。
|
||||||
- `throwit` : 生成一张 扔头像 图片。
|
- `throwit` : 生成一张 扔头像 图片。
|
||||||
@ -59,6 +61,7 @@
|
|||||||
- `weather` : 查询天气。
|
- `weather` : 查询天气。
|
||||||
- `xtao-some` : 一大堆便民功能。
|
- `xtao-some` : 一大堆便民功能。
|
||||||
- `yb-dl` : 上传 Youtube、Bilibili 视频到 telegram。
|
- `yb-dl` : 上传 Youtube、Bilibili 视频到 telegram。
|
||||||
- `rate` : 汇率转换
|
- `rate` : 汇率转换。
|
||||||
- `netease` : 网易云热评
|
- `netease` : 网易云热评。
|
||||||
|
- `hyperlink` : 生成隐藏链接。
|
||||||
|
|
||||||
|
67
atadmins_atall.py
Normal file
67
atadmins_atall.py
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
from telethon.tl.types import ChannelParticipantsAdmins
|
||||||
|
from pagermaid import bot
|
||||||
|
from pagermaid.listener import listener
|
||||||
|
from telethon.errors.rpcbaseerrors import BadRequestError
|
||||||
|
from os import remove
|
||||||
|
import re
|
||||||
|
import time
|
||||||
|
|
||||||
|
@listener(is_plugin=True, outgoing=True, command="atadmins",
|
||||||
|
description="一键 AT 本群管理员(仅在群组中有效)",
|
||||||
|
parameters="<要说的话>")
|
||||||
|
async def atadmins(context):
|
||||||
|
await context.edit('正在获取管理员列表中...')
|
||||||
|
chat = await context.get_chat()
|
||||||
|
try:
|
||||||
|
admins = await context.client.get_participants(chat, filter=ChannelParticipantsAdmins)
|
||||||
|
except:
|
||||||
|
await context.edit('请在群组中运行。')
|
||||||
|
return True
|
||||||
|
admin_list = []
|
||||||
|
if context.arguments == '':
|
||||||
|
say = '召唤本群所有管理员'
|
||||||
|
else:
|
||||||
|
say = context.arguments
|
||||||
|
for admin in admins:
|
||||||
|
if not admin.bot:
|
||||||
|
if admin.username is not None:
|
||||||
|
admin_list.extend(['@'+ admin.username])
|
||||||
|
elif admin.first_name is not None:
|
||||||
|
admin_list.extend(['[' + admin.first_name + '](tg://user?id=' + str(admin.id) + ')'])
|
||||||
|
send_list = ' , '.join(admin_list)
|
||||||
|
# print(send_list)
|
||||||
|
await context.reply("%s:\n\n%s" % (say, send_list))
|
||||||
|
# await context.reply(' , '.join(admin_list))
|
||||||
|
await context.delete()
|
||||||
|
|
||||||
|
@listener(outgoing=True, command="atall",
|
||||||
|
description="一键 AT 本群成员(仅在群组中有效)")
|
||||||
|
async def atall(context):
|
||||||
|
await context.edit('正在获取成员列表中...')
|
||||||
|
chat = await context.get_chat()
|
||||||
|
try:
|
||||||
|
users = await context.client.get_participants(chat)
|
||||||
|
except:
|
||||||
|
await context.edit('请在群组中运行。')
|
||||||
|
return True
|
||||||
|
user_list = []
|
||||||
|
if context.arguments == '':
|
||||||
|
say = '召唤本群所有成员'
|
||||||
|
else:
|
||||||
|
say = context.arguments
|
||||||
|
for user in users:
|
||||||
|
if not user.bot:
|
||||||
|
if len(user_list) < 128:
|
||||||
|
if user.username is not None:
|
||||||
|
user_list.extend(['@'+ user.username])
|
||||||
|
elif user.first_name is not None:
|
||||||
|
user_list.extend(['[' + user.first_name + '](tg://user?id=' + str(user.id) + ')'])
|
||||||
|
else:
|
||||||
|
user_list_old = user_list
|
||||||
|
text = ' , '.join(user_list_old)
|
||||||
|
await context.reply("%s:\n\n%s" % (say, text))
|
||||||
|
user_list = []
|
||||||
|
time.sleep(1)
|
||||||
|
text = ' , '.join(user_list)
|
||||||
|
await context.reply("%s:\n\n%s" % (say, text))
|
||||||
|
await context.delete()
|
65
denyu.py
Normal file
65
denyu.py
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
""" PagerMaid module for different ways to avoid users. """
|
||||||
|
|
||||||
|
# Plugin by fruitymelon
|
||||||
|
|
||||||
|
from pagermaid import redis, log, redis_status
|
||||||
|
from pagermaid.listener import listener
|
||||||
|
|
||||||
|
@listener(is_plugin=True, outgoing=True, command="denyu",
|
||||||
|
description="在某群中强制禁言某用户,需要删除他人消息权限,需要 redis",
|
||||||
|
parameters="<userid> <true|false|status> 或直接回复用户并指定 <true|false|status>")
|
||||||
|
async def denyu(context):
|
||||||
|
""" Toggles denying of a user. """
|
||||||
|
if not redis_status():
|
||||||
|
await context.edit("出错了呜呜呜 ~ Redis 离线,无法运行。")
|
||||||
|
return
|
||||||
|
myself = await context.client.get_me()
|
||||||
|
self_user_id = myself.id
|
||||||
|
uid = None
|
||||||
|
offset = 0
|
||||||
|
if len(context.parameter) != 2:
|
||||||
|
reply_to_msg = await context.get_reply_message()
|
||||||
|
if not reply_to_msg:
|
||||||
|
await context.edit("出错了呜呜呜 ~ 无效的参数。")
|
||||||
|
return
|
||||||
|
uid = reply_to_msg.sender.id
|
||||||
|
offset = 1
|
||||||
|
else:
|
||||||
|
uid = context.parameter[0]
|
||||||
|
try:
|
||||||
|
context.parameter[1 - offset]
|
||||||
|
except IndexError:
|
||||||
|
await context.edit("请指定参数 <true|false|status>!")
|
||||||
|
return
|
||||||
|
if context.parameter[1 - offset] == "true":
|
||||||
|
if context.chat_id == self_user_id:
|
||||||
|
await context.edit("在?为什么要在收藏夹里面用?")
|
||||||
|
return
|
||||||
|
redis.set(f"denieduser.{context.chat_id}.{uid}", "true")
|
||||||
|
await context.delete()
|
||||||
|
await log(f"ChatID {context.chat_id} UserID {uid} 已被添加到自动拒绝对话列表中。")
|
||||||
|
elif context.parameter[1 - offset] == "false":
|
||||||
|
if context.chat_id == self_user_id:
|
||||||
|
await context.edit("在?为什么要在收藏夹里面用?")
|
||||||
|
return
|
||||||
|
redis.delete(f"denieduser.{context.chat_id}.{uid}")
|
||||||
|
await context.delete()
|
||||||
|
await log(f"ChatID {context.chat_id} UserID {uid} 已从自动拒绝对话列表中移除。")
|
||||||
|
elif context.parameter[1 - offset] == "status":
|
||||||
|
if redis.get(f"denieduser.{context.chat_id}.{uid}"):
|
||||||
|
await context.edit("emm...当前对话的该用户已存在于自动拒绝对话列表中。")
|
||||||
|
else:
|
||||||
|
await context.edit("emm...当前对话不存在与自动拒绝对话列表中。")
|
||||||
|
else:
|
||||||
|
await context.edit("出错了呜呜呜 ~ 无效的参数。")
|
||||||
|
|
||||||
|
@listener(incoming=True, ignore_edited=True)
|
||||||
|
async def message_removal_user(context):
|
||||||
|
""" Event handler to infinitely delete denied messages. """
|
||||||
|
if not redis_status():
|
||||||
|
return
|
||||||
|
uid = context.sender_id
|
||||||
|
if redis.get(f"denieduser.{context.chat_id}.{uid}"):
|
||||||
|
# 避免和 -deny 冲突
|
||||||
|
if not redis.get(f"denied.chat_id.{context.chat_id}"):
|
||||||
|
await context.delete()
|
12
hyperlink.py
Normal file
12
hyperlink.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
""" Pagermaid hyperlink plugin. by @OahiewUoil """
|
||||||
|
|
||||||
|
from pagermaid.listener import listener
|
||||||
|
|
||||||
|
@listener(is_plugin=True, outgoing=True, command="hl",
|
||||||
|
description="生成隐藏链接。非链接的纯文字将直接隐藏。",
|
||||||
|
parameters="<link>")
|
||||||
|
async def hyperlink(context):
|
||||||
|
await context.edit(f"正在生成 . . .")
|
||||||
|
if context.arguments:
|
||||||
|
link = context.arguments
|
||||||
|
await context.edit(f"[ㅤㅤㅤㅤㅤㅤㅤ]({link})", link_preview=False)
|
30
list.json
30
list.json
@ -109,6 +109,36 @@
|
|||||||
"supported": true,
|
"supported": true,
|
||||||
"des-short": "随机一条网易云音乐评论。",
|
"des-short": "随机一条网易云音乐评论。",
|
||||||
"des": "这个人很懒,什么都没有留下。"
|
"des": "这个人很懒,什么都没有留下。"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "atadmins_atall",
|
||||||
|
"version": "1.0",
|
||||||
|
"section": "chat",
|
||||||
|
"maintainer": "Pentacene",
|
||||||
|
"size": "2.5 kb",
|
||||||
|
"supported": true,
|
||||||
|
"des-short": "一键 AT 本群管理员、群员。",
|
||||||
|
"des": "仅在群组中有效。"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "denyu",
|
||||||
|
"version": "1.0",
|
||||||
|
"section": "chat",
|
||||||
|
"maintainer": "fruitymelon",
|
||||||
|
"size": "2.7 kb",
|
||||||
|
"supported": true,
|
||||||
|
"des-short": "在某群中强制禁言某用户。",
|
||||||
|
"des": "需要删除他人消息权限,需要 redis。"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "hyperlink",
|
||||||
|
"version": "1.0",
|
||||||
|
"section": "daily",
|
||||||
|
"maintainer": "OahiewUoil",
|
||||||
|
"size": "0.5 kb",
|
||||||
|
"supported": true,
|
||||||
|
"des-short": "生成隐藏链接。",
|
||||||
|
"des": "非链接的纯文字将直接隐藏。"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user