mirror of
https://github.com/catspace-dev/unicheckbot.git
synced 2024-11-22 13:56:34 +03:00
fix #12
This commit is contained in:
parent
a37f07e125
commit
b0e7f71d0f
|
@ -21,6 +21,7 @@ start_message = f"""
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@rate_limit
|
@rate_limit
|
||||||
async def start_cmd(msg: Message):
|
async def start_cmd(msg: Message):
|
||||||
await msg.answer(start_message, parse_mode='markdown')
|
await msg.answer(start_message, parse_mode='markdown')
|
|
@ -1,5 +1,6 @@
|
||||||
import whois
|
from whois import whois, parser
|
||||||
from aiogram.types import Message
|
from aiogram.types import Message
|
||||||
|
from aiogram.utils.markdown import quote_html
|
||||||
|
|
||||||
from tgbot.handlers.helpers import validate_local
|
from tgbot.handlers.helpers import validate_local
|
||||||
from tgbot.middlewares.throttling import rate_limit
|
from tgbot.middlewares.throttling import rate_limit
|
||||||
|
@ -21,7 +22,10 @@ localhost_exception = "❗Локальные адреса запрещены!"
|
||||||
|
|
||||||
# TODO: Very shitty code. I should rewrite this.
|
# TODO: Very shitty code. I should rewrite this.
|
||||||
def create_whois_message(domain: str) -> str:
|
def create_whois_message(domain: str) -> str:
|
||||||
domain_info = whois.whois(domain)
|
try:
|
||||||
|
domain_info = whois(domain)
|
||||||
|
except parser.PywhoisError as e:
|
||||||
|
return f"❗ Домен {domain} свободен или не был найден."
|
||||||
domain_name = domain_info.get("domain_name")
|
domain_name = domain_info.get("domain_name")
|
||||||
if domain_name is None:
|
if domain_name is None:
|
||||||
return no_domain_text
|
return no_domain_text
|
||||||
|
|
Loading…
Reference in New Issue
Block a user