Add xiaoice command

This commit is contained in:
Richard Chien
2017-01-11 20:43:37 +08:00
parent 260878c220
commit 656190e70f
5 changed files with 58 additions and 34 deletions

View File

@ -4,7 +4,7 @@ import requests
from lxml import etree
from command import CommandRegistry
from commands import core
from commands import core, ai
__registry__ = cr = CommandRegistry()
@ -73,14 +73,14 @@ def weather(args_text, ctx_msg):
core.echo('请在命令后加上要查的城市哦~(命令和城市用空格或逗号隔开)', ctx_msg)
return
data = core.tuling123(city + '天气', ctx_msg, internal=True)
data = ai.tuling123(city + '天气', ctx_msg, internal=True)
core.echo(data.get('text', ''), ctx_msg)
@cr.register('joke')
@cr.register('笑话', '说笑话', '说个笑话')
def weather(_, ctx_msg):
data = core.tuling123('说个笑话', ctx_msg, internal=True)
data = ai.tuling123('说个笑话', ctx_msg, internal=True)
core.echo(data.get('text', ''), ctx_msg)
@ -91,7 +91,7 @@ def weather(args_text, ctx_msg):
if not query:
core.echo('请在命令后加上要查的关键词哦~(命令和关键词用空格或逗号隔开)', ctx_msg)
return
data = core.tuling123('百科 ' + query, ctx_msg, internal=True)
data = ai.tuling123('百科 ' + query, ctx_msg, internal=True)
core.echo(data.get('text', ''), ctx_msg)