mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 00:35:36 +00:00
parent
fe1782dab0
commit
8efa4cdc21
31
README.md
31
README.md
@ -56,22 +56,35 @@
|
||||
- `denyu` : 在某群中强制禁言某用户。
|
||||
- `nthmsg` : 获取你发送的第 n 条消息。
|
||||
- `portball` : 回复你要临时禁言的人的消息来实现XX秒的禁言。
|
||||
- `da` : 删除所有信息。
|
||||
- `diss` : 祖安对线语录。
|
||||
- `shangliu` : 上流对话工具。
|
||||
- `killallmembers` : 一键扬了群。
|
||||
- `aff` : 光速发Aff信息。
|
||||
- `stickertopic` : 贴纸转图片。
|
||||
- `vip` : vip 捐赠用户功能。
|
||||
- `calculator` : 小型计算器。
|
||||
- `paolu` : 一键跑路(删所有消息并禁言)。
|
||||
- `keyword` : 群组关键词自动回复插件。
|
||||
- `msgst` : 每天定时发送消息。
|
||||
- profile (资料类)
|
||||
- `autochangename` : 自动更新 last_name 为时间等。
|
||||
- `throwit` : 生成一张 扔头像 图片。
|
||||
- `mjx` : 随机带评价买家秀,随机涩气买家秀。
|
||||
- `eat` : 生成一张 吃头像 图片。
|
||||
- `mjx` : 随机发一张淘宝买家秀
|
||||
- daily (便民类)
|
||||
- `weather` : 查询天气。
|
||||
- `xtao-some` : 一大堆便民功能。
|
||||
- `yb-dl` : 上传 Youtube、Bilibili 视频到 telegram。
|
||||
- `rate` : 汇率转换。
|
||||
- `netease` : 网易云热评。
|
||||
- `netease` : 随机一条网易云音乐热评。
|
||||
- `hyperlink` : 生成隐藏链接。
|
||||
- `whois` : 查询域名信息
|
||||
- `resou` : 知乎,抖音,微博实时热搜
|
||||
- `tel` : 查询手机号码归属地等信息
|
||||
- `neteaseshuffle` : 随即一首网易云热门曲目
|
||||
- `neteasemusic` : 发送一首来自网易云的音乐
|
||||
- `shangliu` : 彩虹屁生成器,毒鸡汤生成器,营销号生成器
|
||||
- `diss` : 祖安语言生成器
|
||||
- `resou` : 微博,知乎,抖音实时热搜,B站实时排行榜。
|
||||
- `tel` : 查询手机号码归属地等信息。
|
||||
- `whois` : 查询域名whois信息。
|
||||
- `cosplay-multi` : 多网站随机获取Cos图。
|
||||
- `meizi` : 多网站随机获取写真。
|
||||
- `acg-multi` : 多网站随机获取ACG图。
|
||||
- `neteaseshuffle` : 随机网抑热歌。
|
||||
- `neteasemusic` : 网易云搜歌/随机热歌/点歌。
|
||||
- `videodl` : 下载YTB/B站视频。
|
||||
|
108
keyword.py
108
keyword.py
@ -145,58 +145,62 @@ async def send_reply(chat_id, reply_msg, context):
|
||||
update_last_time = False
|
||||
could_send_msg = valid_time(chat_id)
|
||||
for re_type, re_msg in reply_msg:
|
||||
catch_pattern = r"\$\{func_(?P<str>((?!\}).)+)\}"
|
||||
count = 0
|
||||
while re.search(catch_pattern, re_msg) and count < 20:
|
||||
func_name = re.search(catch_pattern, re_msg).group("str")
|
||||
try:
|
||||
module = import_module(f"plugins.keyword_func.{func_name}")
|
||||
func_data = await module.main(context)
|
||||
except:
|
||||
func_data = "[RE]"
|
||||
re_msg = re_msg.replace("${func_%s}" % func_name, str(func_data))
|
||||
count += 1
|
||||
for k, v in replace_data.items():
|
||||
re_msg = re_msg.replace(f"${k}", str(v))
|
||||
type_parse = re_type.split(",")
|
||||
for s in type_parse:
|
||||
if len(s) >= 5 and "ext_" == s[0:4] and is_num(s[4:]):
|
||||
chat_id = int(s[4:])
|
||||
break
|
||||
if "plain" in type_parse:
|
||||
if could_send_msg:
|
||||
update_last_time = True
|
||||
await bot.send_message(chat_id, re_msg, reply_to = None)
|
||||
elif "reply" in type_parse and chat_id == real_chat_id:
|
||||
if could_send_msg:
|
||||
update_last_time = True
|
||||
await bot.send_message(chat_id, re_msg, reply_to = context.id)
|
||||
elif "file" in type_parse and len(re_msg.split()) >= 2:
|
||||
if could_send_msg:
|
||||
update_last_time = True
|
||||
if not path.exists("/tmp"):
|
||||
mkdir("/tmp")
|
||||
re_data = re_msg.split()
|
||||
file_name = "/tmp/" + re_data[0]
|
||||
if re_data[1][0:7] == "file://":
|
||||
copyfile(re_data[1][7:], file_name)
|
||||
else:
|
||||
file_get = requests.get(" ".join(re_data[1:]))
|
||||
with open(file_name, "wb") as f:
|
||||
f.write(file_get.content)
|
||||
reply_to = None
|
||||
if "reply" in re_type.split(","):
|
||||
reply_to = context.id
|
||||
await bot.send_file(chat_id, file_name, reply_to = reply_to, force_document = True)
|
||||
remove(file_name)
|
||||
elif "op" in type_parse:
|
||||
if re_msg == "delete":
|
||||
await context.delete()
|
||||
elif re_msg.split()[0] == "sleep" and len(re_msg.split()) == 2:
|
||||
sleep_time = re_msg.split()[1]
|
||||
if is_num(sleep_time):
|
||||
await asyncio.sleep(int(sleep_time))
|
||||
chat_id = real_chat_id
|
||||
try:
|
||||
catch_pattern = r"\$\{func_(?P<str>((?!\}).)+)\}"
|
||||
count = 0
|
||||
while re.search(catch_pattern, re_msg) and count < 20:
|
||||
func_name = re.search(catch_pattern, re_msg).group("str")
|
||||
try:
|
||||
module = import_module(f"plugins.keyword_func.{func_name}")
|
||||
func_data = await module.main(context)
|
||||
except:
|
||||
func_data = "[RE]"
|
||||
re_msg = re_msg.replace("${func_%s}" % func_name, str(func_data))
|
||||
count += 1
|
||||
for k, v in replace_data.items():
|
||||
re_type = re_type.replace(f"${k}", str(v))
|
||||
re_msg = re_msg.replace(f"${k}", str(v))
|
||||
type_parse = re_type.split(",")
|
||||
for s in type_parse:
|
||||
if len(s) >= 5 and "ext_" == s[0:4] and is_num(s[4:]):
|
||||
chat_id = int(s[4:])
|
||||
break
|
||||
if "plain" in type_parse:
|
||||
if could_send_msg:
|
||||
update_last_time = True
|
||||
await bot.send_message(chat_id, re_msg, reply_to = None)
|
||||
elif "reply" in type_parse and chat_id == real_chat_id:
|
||||
if could_send_msg:
|
||||
update_last_time = True
|
||||
await bot.send_message(chat_id, re_msg, reply_to = context.id)
|
||||
elif "file" in type_parse and len(re_msg.split()) >= 2:
|
||||
if could_send_msg:
|
||||
update_last_time = True
|
||||
if not path.exists("/tmp"):
|
||||
mkdir("/tmp")
|
||||
re_data = re_msg.split()
|
||||
file_name = "/tmp/" + re_data[0]
|
||||
if re_data[1][0:7] == "file://":
|
||||
copyfile(re_data[1][7:], file_name)
|
||||
else:
|
||||
file_get = requests.get(" ".join(re_data[1:]))
|
||||
with open(file_name, "wb") as f:
|
||||
f.write(file_get.content)
|
||||
reply_to = None
|
||||
if "reply" in re_type.split(","):
|
||||
reply_to = context.id
|
||||
await bot.send_file(chat_id, file_name, reply_to = reply_to, force_document = True)
|
||||
remove(file_name)
|
||||
elif "op" in type_parse:
|
||||
if re_msg == "delete":
|
||||
await context.delete()
|
||||
elif re_msg.split()[0] == "sleep" and len(re_msg.split()) == 2:
|
||||
sleep_time = re_msg.split()[1]
|
||||
if is_num(sleep_time):
|
||||
await asyncio.sleep(int(sleep_time))
|
||||
chat_id = real_chat_id
|
||||
except:
|
||||
pass
|
||||
if update_last_time:
|
||||
global group_last_time
|
||||
group_last_time[int(chat_id)] = time.time()
|
||||
|
Loading…
Reference in New Issue
Block a user