bing up up up & add help

This commit is contained in:
SiHuan 2020-03-01 20:37:28 +08:00
parent 30095f8f04
commit 7d417239ba
3 changed files with 19 additions and 4 deletions

View file

@ -1,5 +1,5 @@
from worker import emmm
debug = True
debug = False
def de(e):
if debug:
@ -15,9 +15,9 @@ while(inp):
package = __import__(name='worker.'+ worker, fromlist=worker)
Ans_ = getattr(package,'Ans')
except Exception as e:
# de(e)
de(e)
Ans_ = emmm.Ans
# de(Ans_)
de(Ans_)
try:
Ans = Ans_(parms,uid=0,gid=0,role='owner',raw_msg={'message':'/' + inp})
Message = Ans.GETMSG()

View file

@ -19,7 +19,9 @@ class Ans(StdAns):
try:
resp = requests.get(url=url,params=params,headers=headers).json()
result = resp['webPages']['value'][0]
msg = '[CQ:at,qq=' + str(self.uid) + ']' + '咱帮你🔍到了这个\nTitle: ' + result['name']+'\nLink: '+result['url']+'\n'+result['snippet']
msg = '[CQ:at,qq=' + str(self.uid) + ']' + '咱帮你🔍到了这个\n' + result['name']
self.sendmsg(msg)
msg = result['url']
except:
msg = '什么东西坏掉了,大概是bing吧...不可能是咱!'
return msg

13
worker/help.py Normal file
View file

@ -0,0 +1,13 @@
from zzcore import StdAns
from config import ALLWORKERS
class Ans(StdAns):
def GETMSG(self):
if ALLWORKERS:
msg = '咱支持下面的'+str(len(ALLWORKERS)) + '个命令呢.'
for work in ALLWORKERS:
msg = msg + '\n' + work
else:
msg = '某人忘了往congif里写配置了吧,笨蛋!'
return msg