💩 tel 手机号码归属地 错误修复

This commit is contained in:
xtaodada 2020-08-13 09:58:11 +08:00
parent cd4a49c21d
commit fca2ec442c
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 8 additions and 4 deletions

View File

@ -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": "查询手机号码归属地等信息",

8
tel.py
View File

@ -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 服务器 。")