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]
|
host = msg.split("@", 1)[1]
|
||||||
cache = host in bot.dns
|
cache = host in bot.dns
|
||||||
dnsbl, raws = conf.dnsblHandler(bot, nick, host, chan)
|
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:
|
except IndexError:
|
||||||
try:
|
try:
|
||||||
host = message.split(" ", 1)[1]
|
host = message.split(" ", 1)[1]
|
||||||
cache = host in bot.dns
|
cache = host in bot.dns
|
||||||
dnsbl, raws = conf.dnsblHandler(bot, "thisusernameshouldbetoolongtoeveractuallybeinuse", host, chan)
|
dnsbl, raws = conf.dnsblHandler(
|
||||||
bot.msg(f"Blacklist check: {'(Cached) ' if cache else ''}{dnsbl if dnsbl else 'Safe.'} ({raws})", chan)
|
bot, "thisusernameshouldbetoolongtoeveractuallybeinuse", host, chan
|
||||||
|
)
|
||||||
|
bot.msg(
|
||||||
|
f"Blacklist check: {'(Cached) ' if cache else ''}{dnsbl if dnsbl else 'Safe.'} ({raws})",
|
||||||
|
chan,
|
||||||
|
)
|
||||||
except Exception as E:
|
except Exception as E:
|
||||||
bot.msg("Blacklist Lookup Failed. Error recorded to bot logs.", chan)
|
bot.msg("Blacklist Lookup Failed. Error recorded to bot logs.", chan)
|
||||||
bot.log(str(E), "FATAL")
|
bot.log(str(E), "FATAL")
|
||||||
|
|
|
@ -198,7 +198,11 @@ def dnsblHandler(
|
||||||
dnsblStatus = "Not enabled"
|
dnsblStatus = "Not enabled"
|
||||||
dnsblResps = {}
|
dnsblResps = {}
|
||||||
if bot.dnsblMode != "none":
|
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}
|
bot.dns[hostname] = {"status": dnsblStatus, "resps": dnsblResps}
|
||||||
if dnsblStatus:
|
if dnsblStatus:
|
||||||
match bot.dnsblMode:
|
match bot.dnsblMode:
|
||||||
|
|
Loading…
Reference in a new issue