add wolfram
This commit is contained in:
parent
95fcae5d5a
commit
663f3f4576
4 changed files with 33 additions and 1 deletions
9
req.txt
9
req.txt
|
@ -1,19 +1,28 @@
|
|||
astroid==2.3.3
|
||||
autopep8==1.5
|
||||
certifi==2019.11.28
|
||||
chardet==3.0.4
|
||||
Click==7.0
|
||||
Flask==1.1.1
|
||||
idna==2.9
|
||||
importlib-metadata==1.5.0
|
||||
inflect==4.1.0
|
||||
isort==4.3.21
|
||||
itsdangerous==1.1.0
|
||||
jaraco.itertools==5.0.0
|
||||
Jinja2==2.11.1
|
||||
lazy-object-proxy==1.4.3
|
||||
MarkupSafe==1.1.1
|
||||
mccabe==0.6.1
|
||||
more-itertools==8.2.0
|
||||
pycodestyle==2.5.0
|
||||
pylint==2.4.4
|
||||
requests==2.23.0
|
||||
six==1.14.0
|
||||
typed-ast==1.4.1
|
||||
urllib3==1.25.8
|
||||
Werkzeug==1.0.0
|
||||
wolframalpha==4.0.0
|
||||
wrapt==1.11.2
|
||||
xmltodict==0.12.0
|
||||
zipp==3.0.0
|
||||
|
|
2
route.py
2
route.py
|
@ -5,6 +5,8 @@ def ZZRouter(data):
|
|||
gid = data['group_id']
|
||||
role = data['sender']['role']
|
||||
parms = str.split(data['message'][1:])
|
||||
if not parms:
|
||||
parms[0] = 'help'
|
||||
worker = parms[0]
|
||||
|
||||
try:
|
||||
|
|
2
test.py
2
test.py
|
@ -1,5 +1,5 @@
|
|||
from worker import emmm
|
||||
debug = False
|
||||
debug = True
|
||||
|
||||
def de(e):
|
||||
if debug:
|
||||
|
|
21
worker/wolfram.py
Normal file
21
worker/wolfram.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
from zzcore import StdAns
|
||||
from config import WOLFRAMALPHAAPPID
|
||||
import wolframalpha
|
||||
|
||||
def wolframsearch(query):
|
||||
client = wolframalpha.Client(WOLFRAMALPHAAPPID)
|
||||
res = client.query(query)
|
||||
return res
|
||||
|
||||
class Ans(StdAns):
|
||||
def GETMSG(self):
|
||||
if len(self.parms) < 2:
|
||||
return '不加参数是坏文明!'
|
||||
|
||||
try:
|
||||
res = wolframsearch(self.raw_msg['message'][9:])
|
||||
msg = next(res.results).text
|
||||
except Exception as e:
|
||||
print(e)
|
||||
msg = '什么东西坏掉了,大概是Wolfram | Alpha吧...不可能是咱!'
|
||||
return
|
Loading…
Reference in a new issue