mirror of
https://github.com/TeamPGM/PagerMaid_Plugins_Pyro.git
synced 2024-11-24 20:07:35 +00:00
xtaodada
fb5a3f5baf
All checks were successful
Github commit to telegram / build (push) Successful in 13s
28 lines
1007 B
Python
28 lines
1007 B
Python
from pyrogram import Client
|
|
|
|
from pagermaid.dependence import client
|
|
from pagermaid.enums import Message
|
|
from pagermaid.listener import listener
|
|
|
|
|
|
@listener(command="whois", description="查看域名是否已被注册、注册日期、过期日期、域名状态、DNS解析服务器等。")
|
|
async def whois(_: Client, context: Message):
|
|
try:
|
|
message = context.arguments
|
|
except ValueError:
|
|
await context.edit("出错了呜呜呜 ~ 无效的参数。")
|
|
return
|
|
req = await client.get(f"https://namebeta.com/api/search/check?query={message}")
|
|
|
|
if req.status_code == 200:
|
|
try:
|
|
data = (
|
|
req.json()["whois"]["whois"].split("For more information")[0].rstrip()
|
|
)
|
|
except:
|
|
await context.edit("出错了呜呜呜 ~ 可能是域名不正确。")
|
|
return
|
|
await context.edit(f"<code>{data}</code>")
|
|
else:
|
|
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")
|