mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-20 02:26:32 +01:00
Lax jimmy's filters
This commit is contained in:
parent
f1b28a528f
commit
aa6e7f2889
1 changed files with 4 additions and 5 deletions
|
@ -612,7 +612,7 @@ class OtherCog(commands.Cog):
|
||||||
|
|
||||||
async def blacklist_check() -> bool | str:
|
async def blacklist_check() -> bool | str:
|
||||||
async with aiofiles.open("domains.txt") as blacklist:
|
async with aiofiles.open("domains.txt") as blacklist:
|
||||||
for ln in await blacklist.readlines():
|
for ln in iter(lambda l: l.strip(), await blacklist.readline()):
|
||||||
if not ln.strip():
|
if not ln.strip():
|
||||||
continue
|
continue
|
||||||
if re.match(ln.strip(), url.netloc):
|
if re.match(ln.strip(), url.netloc):
|
||||||
|
@ -626,7 +626,6 @@ class OtherCog(commands.Cog):
|
||||||
return "DNS blacklist"
|
return "DNS blacklist"
|
||||||
except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer, dns.resolver.LifetimeTimeout, AttributeError):
|
except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer, dns.resolver.LifetimeTimeout, AttributeError):
|
||||||
return "Invalid domain or DNS error"
|
return "Invalid domain or DNS error"
|
||||||
else:
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
done, pending = await asyncio.wait(
|
done, pending = await asyncio.wait(
|
||||||
|
@ -642,7 +641,7 @@ class OtherCog(commands.Cog):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return await ctx.respond("Something went wrong. Try again?\n")
|
return await ctx.respond("Something went wrong. Try again?\n")
|
||||||
result = await done
|
result = await done
|
||||||
if result is not True:
|
if not result:
|
||||||
return await ctx.edit(
|
return await ctx.edit(
|
||||||
content="That domain is blacklisted, doesn't exist, or there was no answer from the DNS server."
|
content="That domain is blacklisted, doesn't exist, or there was no answer from the DNS server."
|
||||||
f" ({result!r})"
|
f" ({result!r})"
|
||||||
|
@ -651,7 +650,7 @@ class OtherCog(commands.Cog):
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
await ctx.edit(content=f"Preparing to screenshot <{friendly_url}>... (16%, checking filters)")
|
await ctx.edit(content=f"Preparing to screenshot <{friendly_url}>... (16%, checking filters)")
|
||||||
okay = await (pending or done_tasks).pop()
|
okay = await (pending or done_tasks).pop()
|
||||||
if okay is not True:
|
if not okay:
|
||||||
return await ctx.edit(
|
return await ctx.edit(
|
||||||
content="That domain is blacklisted, doesn't exist, or there was no answer from the DNS server."
|
content="That domain is blacklisted, doesn't exist, or there was no answer from the DNS server."
|
||||||
f" ({result!r})"
|
f" ({result!r})"
|
||||||
|
|
Loading…
Reference in a new issue