From 8a0219cf0208d82ac82e9bacd28648e3dba101da Mon Sep 17 00:00:00 2001 From: Xtao_dada Date: Fri, 7 Aug 2020 13:38:31 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=A3=20Google=20=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=9B=9E=E5=A4=8D=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pagermaid/modules/external.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pagermaid/modules/external.py b/pagermaid/modules/external.py index 998fd80..7ecf51f 100644 --- a/pagermaid/modules/external.py +++ b/pagermaid/modules/external.py @@ -105,10 +105,17 @@ async def googletest(context): """ Searches Google for a string. """ USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:65.0) Gecko/20100101 Firefox/65.0" headers = {"user-agent": USER_AGENT} - if context.arguments == "": + reply = await context.get_reply_message() + query = context.arguments + lang = config['application_language'] + if query: + pass + elif reply: + query = reply.text + else: await context.edit("出错了呜呜呜 ~ 无效的参数。") return - query = context.arguments + query = query.replace(' ', '+') URL = [('https://google.com.hk/search?q=' + query),('https://google.com/search?q=' + query)] await context.edit("正在拉取结果 . . .")