Formatting
This commit is contained in:
parent
433f57beb8
commit
af89d25fce
2 changed files with 16 additions and 4 deletions
14
commands.py
14
commands.py
|
@ -292,13 +292,21 @@ def check(bot: bare.bot, chan: str, name: str, message: str) -> None:
|
|||
host = msg.split("@", 1)[1]
|
||||
cache = host in bot.dns
|
||||
dnsbl, raws = conf.dnsblHandler(bot, nick, host, chan)
|
||||
bot.msg(f"Blacklist check: {'(Cached) ' if cache else ''}{dnsbl if dnsbl else 'Safe.'} ({raws})", chan)
|
||||
bot.msg(
|
||||
f"Blacklist check: {'(Cached) ' if cache else ''}{dnsbl if dnsbl else 'Safe.'} ({raws})",
|
||||
chan,
|
||||
)
|
||||
except IndexError:
|
||||
try:
|
||||
host = message.split(" ", 1)[1]
|
||||
cache = host in bot.dns
|
||||
dnsbl, raws = conf.dnsblHandler(bot, "thisusernameshouldbetoolongtoeveractuallybeinuse", host, chan)
|
||||
bot.msg(f"Blacklist check: {'(Cached) ' if cache else ''}{dnsbl if dnsbl else 'Safe.'} ({raws})", chan)
|
||||
dnsbl, raws = conf.dnsblHandler(
|
||||
bot, "thisusernameshouldbetoolongtoeveractuallybeinuse", host, chan
|
||||
)
|
||||
bot.msg(
|
||||
f"Blacklist check: {'(Cached) ' if cache else ''}{dnsbl if dnsbl else 'Safe.'} ({raws})",
|
||||
chan,
|
||||
)
|
||||
except Exception as E:
|
||||
bot.msg("Blacklist Lookup Failed. Error recorded to bot logs.", chan)
|
||||
bot.log(str(E), "FATAL")
|
||||
|
|
|
@ -198,7 +198,11 @@ def dnsblHandler(
|
|||
dnsblStatus = "Not enabled"
|
||||
dnsblResps = {}
|
||||
if bot.dnsblMode != "none":
|
||||
dnsblStatus, dnsblResps = dnsbl(hostname) if not hostname in bot.dns else (bot.dns[hostname]["status"], bot.dns[hostname]["resps"])
|
||||
dnsblStatus, dnsblResps = (
|
||||
dnsbl(hostname)
|
||||
if not hostname in bot.dns
|
||||
else (bot.dns[hostname]["status"], bot.dns[hostname]["resps"])
|
||||
)
|
||||
bot.dns[hostname] = {"status": dnsblStatus, "resps": dnsblResps}
|
||||
if dnsblStatus:
|
||||
match bot.dnsblMode:
|
||||
|
|
Loading…
Reference in a new issue