mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-25 10:02:23 +00:00
添加whois插件 (#5)
This commit is contained in:
parent
5c0e3e5438
commit
a7f2790ee1
10
list.json
10
list.json
@ -159,6 +159,16 @@
|
||||
"supported": false,
|
||||
"des-short": "回复你要临时禁言的人的消息来实现XX秒的禁言。",
|
||||
"des": "这个人很懒,什么都没有留下。"
|
||||
},
|
||||
{
|
||||
"name": "whois",
|
||||
"version": "1.0",
|
||||
"section": "daily",
|
||||
"maintainer": "KorenKrita",
|
||||
"size": "1.1 kb",
|
||||
"supported": true,
|
||||
"des-short": "查询域名whois信息",
|
||||
"des": "查看域名是否已被注册、注册日期、过期日期、域名状态、DNS解析服务器等。"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
23
whois.py
Normal file
23
whois.py
Normal file
@ -0,0 +1,23 @@
|
||||
import json
|
||||
import os,sys,codecs
|
||||
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
|
||||
from requests import get
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import obtain_message
|
||||
|
||||
@listener(outgoing=True, command="whois",
|
||||
description="查看域名是否已被注册、注册日期、过期日期、域名状态、DNS解析服务器等。")
|
||||
async def whois(context):
|
||||
await context.edit("获取中 . . .")
|
||||
try:
|
||||
message = await obtain_message(context)
|
||||
except ValueError:
|
||||
await context.edit("出错了呜呜呜 ~ 无效的参数。")
|
||||
return
|
||||
req = get("https://tenapi.cn/whois/?url=" + message)
|
||||
if req.status_code == 200:
|
||||
data = json.loads(req.text)
|
||||
res = 'url: ' + data['data']['url'] + '\n注册商: ' + str(data['data']['注册商']) + '\n联系人: ' + str(data['data']['联系人']) + '\n联系邮箱: ' + str(data['data']['联系邮箱']) + '\n注册时间: ' + str(data['data']['注册时间']) + '\n过期时间: ' + str(data['data']['过期时间']) + '\nDNS: ' + str(data['data']['DNS'])
|
||||
await context.edit(res)
|
||||
else:
|
||||
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")
|
Loading…
Reference in New Issue
Block a user