mirror of
https://github.com/TeamPGM/PagerMaid_Plugins_Pyro.git
synced 2024-11-16 07:39:26 +00:00
xtao-some 修复 wiki (#5)
This commit is contained in:
parent
c332bb9bb2
commit
d0ef94c6d9
@ -2,7 +2,7 @@
|
|||||||
"list": [
|
"list": [
|
||||||
{
|
{
|
||||||
"name": "xtao-some",
|
"name": "xtao-some",
|
||||||
"version": "1.02",
|
"version": "1.021",
|
||||||
"section": "daily",
|
"section": "daily",
|
||||||
"maintainer": "xtaodada",
|
"maintainer": "xtaodada",
|
||||||
"size": "12.9 kb",
|
"size": "12.9 kb",
|
||||||
|
@ -37,12 +37,12 @@ async def guess(_: Client, message: Message):
|
|||||||
description="查询维基百科词条",
|
description="查询维基百科词条",
|
||||||
parameters="<词组>")
|
parameters="<词组>")
|
||||||
async def wiki(_: Client, message: Message):
|
async def wiki(_: Client, message: Message):
|
||||||
message = await message.edit("获取中 . . .")
|
|
||||||
text = message.arguments
|
text = message.arguments
|
||||||
if not text:
|
if not text:
|
||||||
return await message.edit("请先输入一个关键词。")
|
return await message.edit("请先输入一个关键词。")
|
||||||
|
message = await message.edit("获取中 . . .")
|
||||||
try:
|
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"))
|
wiki_json = json.loads(req.content.decode("utf-8"))
|
||||||
except:
|
except:
|
||||||
return await message.edit("出错了呜呜呜 ~ 无法访问到维基百科。")
|
return await message.edit("出错了呜呜呜 ~ 无法访问到维基百科。")
|
||||||
|
Loading…
Reference in New Issue
Block a user