From fca2ec442c8ac4289c94ceab116fe789b2709225 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Thu, 13 Aug 2020 09:58:11 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A9=20tel=20=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E5=8F=B7=E7=A0=81=E5=BD=92=E5=B1=9E=E5=9C=B0=20=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- list.json | 4 ++-- tel.py | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/list.json b/list.json index ef0c20c..a8960cc 100644 --- a/list.json +++ b/list.json @@ -182,9 +182,9 @@ }, { "name": "tel", - "version": "1.0", + "version": "1.1", "section": "daily", - "maintainer": "KorenKrita", + "maintainer": "KorenKrita、xtaodada", "size": "1 kb", "supported": true, "des-short": "查询手机号码归属地等信息", diff --git a/tel.py b/tel.py index 34dd161..824231c 100644 --- a/tel.py +++ b/tel.py @@ -7,7 +7,7 @@ from pagermaid.utils import obtain_message @listener(outgoing=True, command="tel", description="手机号码归属地等信息查询。") -async def whois(context): +async def tel(context): await context.edit("获取中 . . .") try: message = await obtain_message(context) @@ -17,7 +17,11 @@ async def whois(context): req = get("https://tenapi.cn/tel?tel=" + message) if req.status_code == 200: data = json.loads(req.text) - res = '电话号码:' + str(data['tel']) + '\n' + str(data['local']) + '\n' + str(data['duan']) + '\n' + str(data['type']) + '\n' + str(data['yys']) + '\n' + str(data['bz']) + if not 'msg' in data: + res = '电话号码:' + str(data['tel']) + '\n' + str(data['local']) + '\n' + str(data['duan']) + '\n' + str( + data['type']) + '\n' + str(data['yys']) + '\n' + str(data['bz']) + else: + res = data['msg'] await context.edit(res) else: await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")