💠 删除无效的AT管理员,增加拼音首字母缩写释义工具

This commit is contained in:
xtaodada 2020-04-02 20:59:40 +08:00
parent 015d5980f7
commit 30090fa7a0
No known key found for this signature in database
GPG Key ID: 39EFACA711DF5D8C
2 changed files with 34 additions and 22 deletions

View File

@ -175,28 +175,6 @@ async def hitokoto(context):
await context.edit(f"{hitokoto_json['hitokoto']} - {hitokoto_json['from']} ({str(hitokoto_type)})")
@listener(outgoing=True, command="admin",
description="@ 本群的管理员 (谨慎使用)")
async def get_admin(context):
""" It can let you at all admins. """
if context.is_group:
await context.edit("正在获取管理员列表。")
get_admin_lists = []
try:
async for user in bot(GetParticipantsRequest(channel=context.chat_id,
filter=ChannelParticipantsAdmins,
offset=42,
limit=100,
hash=0
)):
get_admin_lists.extend(['[' + str(user.first_name) + '](tg://user?id=' + str(user.id) + ')'])
await context.edit(' '.join(get_admin_lists))
except:
await context.edit("出错了呜呜呜 ~")
else:
await context.edit("出错了呜呜呜 ~ 当前聊天不是群聊。")
@listener(outgoing=True, command="source",
description="显示原始 PagerMaid git 存储库的URL。")
async def source(context):

34
some-plugins/xtao-some.py Normal file
View File

@ -0,0 +1,34 @@
""" Pagermaid plugin base. """
import json, requests
from pagermaid import bot, log
from pagermaid.listener import listener
@listener(outgoing=True, command="guess",
description="能不能好好说话? - 拼音首字母缩写释义工具 (需要回复一句话)")
async def guess(context):
reply = await context.get_reply_message()
await context.edit("获取中 . . .")
if reply:
reply_id = reply.id
else:
return True
text = {'text': str(reply.message.replace("/guess ", "").replace(" ", ""))}
guess_json = json.loads(
requests.post("https://lab.magiconch.com/api/nbnhhsh/guess", data=text, verify=False).content.decode("utf-8"))
guess_res = []
if not len(guess_json) == 0:
for num in range(0, len(guess_json)):
guess_res1 = json.loads(json.dumps(guess_json[num]))
guess_res1_name = guess_res1['name']
try:
guess_res1_ans = ", ".join(guess_res1['trans'])
except:
try:
guess_res1_ans = ", ".join(guess_res1['inputting'])
except:
guess_res1_ans = "尚未录入"
guess_res.extend(["词组:" + guess_res1_name + "\n释义:" + guess_res1_ans])
await context.edit("\n\n".join(guess_res))
else:
await context.edit("没有匹配到拼音首字母缩写")