xtao-some 修复 wiki (#5)

This commit is contained in:
omg-xtao 2022-06-10 22:41:32 +08:00 committed by GitHub
parent c332bb9bb2
commit d0ef94c6d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@
"list": [
{
"name": "xtao-some",
"version": "1.02",
"version": "1.021",
"section": "daily",
"maintainer": "xtaodada",
"size": "12.9 kb",

View File

@ -37,12 +37,12 @@ async def guess(_: Client, message: Message):
description="查询维基百科词条",
parameters="<词组>")
async def wiki(_: Client, message: Message):
message = await message.edit("获取中 . . .")
text = message.arguments
if not text:
return await message.edit("请先输入一个关键词。")
message = await message.edit("获取中 . . .")
try:
req = await client.get("https://zh.wikipedia.org/w/api.php?action=query&list=search&format=json&formatversion=2&srsearch=" + message)
req = await client.get("https://zh.wikipedia.org/w/api.php?action=query&list=search&format=json&formatversion=2&srsearch=" + text)
wiki_json = json.loads(req.content.decode("utf-8"))
except:
return await message.edit("出错了呜呜呜 ~ 无法访问到维基百科。")