-
Notifications
You must be signed in to change notification settings - Fork 0
/
wiki.py
24 lines (22 loc) · 1011 Bytes
/
wiki.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
try:
from urllib import quote
except:
from urllib.parse import quote
help_msg='''
§r======= §6Minecraft Wiki Searcher §r=======
帮助你更好地搜索Minecraft Wiki~
使用§6!!wiki§r可以叫出本使用方法
使用§6!!wiki [搜索内容]§r可以调用搜索
Minecraft Wiki Searcher Plugin by §6GamerNoTitle
§r======= §6Minecraft Wiki Searcher §r=======
'''
def on_info(server, info):
if info.content == '!!wiki':
server.tell(info.player, help_msg)
else:
if info.content.startswith('!!wiki') and info.is_player:
if len(info.content[7:])==0:
server.tell(info.player, '[wiki]§6参数错误!')
else:
search_content=info.content[7:]
server.execute('tellraw ' + info.player + ' {"text":"[wiki]: 搜索 §6' + search_content + '§r 的结果","underlined":"false","clickEvent":{"action":"open_url","value":"https://minecraft-zh.gamepedia.com/index.php?search=' + quote(search_content) + '"}}')