Skip to content

Commit

Permalink
Upd
Browse files Browse the repository at this point in the history
  • Loading branch information
DoroWolf authored Mar 14, 2024
1 parent e9d7710 commit bdf0a0a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions modules/whois/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from whois import whois

from config import Config
from core.builtins import Bot
from core.builtins import Bot, Image, Plain
from core.component import module
from core.logger import Logger
from core.utils.image import msgchain2image
from core.utils.text import parse_time_string


Expand All @@ -21,13 +22,17 @@ def process(input_):
@w.handle('<domain> {{whois.help}}')
async def _(msg: Bot.MessageSession, domain: str):
res = await get_whois(msg, domain)
await msg.finish(res)
img = await msgchain2image([Plain(res)])
if img:
await msg.finish([Image(img)])
else:
await msg.finish(res)


async def get_whois(msg, domain):
try:
info = whois(domain)
Logger.info(str(info))
Logger.debug(str(info))
except BaseException:
await msg.finish(msg.locale.t("whois.message.get_failed"))

Expand Down

0 comments on commit bdf0a0a

Please sign in to comment.