From 7d417239ba545c3931744f13235ebd0e597907de Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 1 Mar 2020 20:37:28 +0800 Subject: [PATCH] bing up up up & add help --- test.py | 6 +++--- worker/bing.py | 4 +++- worker/help.py | 13 +++++++++++++ 3 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 worker/help.py diff --git a/test.py b/test.py index 737c7f4..03e7130 100644 --- a/test.py +++ b/test.py @@ -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() diff --git a/worker/bing.py b/worker/bing.py index bcb514e..653253a 100644 --- a/worker/bing.py +++ b/worker/bing.py @@ -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 diff --git a/worker/help.py b/worker/help.py new file mode 100644 index 0000000..7d98880 --- /dev/null +++ b/worker/help.py @@ -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 \ No newline at end of file