xtao-some 修复 guess 一直获取中

This commit is contained in:
xtaodada 2022-01-26 19:48:31 +08:00
parent bdc07208cb
commit d77ce5d7e7
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 8 additions and 8 deletions

View File

@ -52,7 +52,7 @@
}, },
{ {
"name": "xtao-some", "name": "xtao-some",
"version": "1.221", "version": "1.23",
"section": "daily", "section": "daily",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "12.9 kb", "size": "12.9 kb",

View File

@ -3,7 +3,7 @@ import json, requests, re
from urllib.parse import urlparse from urllib.parse import urlparse
from pagermaid import bot, log, version from pagermaid import bot, log, version
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, client
from telethon.errors import ChatAdminRequiredError from telethon.errors import ChatAdminRequiredError
from telethon.errors.rpcerrorlist import FloodWaitError, UserAdminInvalidError from telethon.errors.rpcerrorlist import FloodWaitError, UserAdminInvalidError
from telethon.tl.types import ChannelParticipantsAdmins, ChannelParticipantsBots, ChannelParticipantAdmin from telethon.tl.types import ChannelParticipantsAdmins, ChannelParticipantsBots, ChannelParticipantAdmin
@ -14,12 +14,12 @@ from telethon.tl.types import ChannelParticipantsAdmins, ChannelParticipantsBots
async def guess(context): async def guess(context):
reply = await context.get_reply_message() reply = await context.get_reply_message()
await context.edit("获取中 . . .") await context.edit("获取中 . . .")
if not reply: try:
context.edit("宁需要回复一句话") text = await obtain_message(context)
return True except:
text = {'text': str(reply.message.replace("/guess ", "").replace(" ", ""))} return await context.edit("请先输入一个缩写。")
guess_json = json.loads( text = {'text': text}
requests.post("https://lab.magiconch.com/api/nbnhhsh/guess", data=text, verify=False).content.decode("utf-8")) guess_json = (await client.post("https://lab.magiconch.com/api/nbnhhsh/guess", json=text)).json()
guess_res = [] guess_res = []
if not len(guess_json) == 0: if not len(guess_json) == 0:
for num in range(0, len(guess_json)): for num in range(0, len(guess_json)):