bot: Catch more dig errors
All checks were successful
Build Docker / Build Docker (push) Successful in 16s
All checks were successful
Build Docker / Build Docker (push) Successful in 16s
This commit is contained in:
parent
2ac733f33d
commit
a88376555d
9
bot.py
9
bot.py
@ -141,6 +141,7 @@ async def ssl(ctx, domain: str):
|
||||
await ctx.response.send_message("Please provide a valid domain to check")
|
||||
return
|
||||
|
||||
ctx.response.send_message(f"Checking SSL certificate for {domain}...")
|
||||
message = ""
|
||||
resolver = dns.resolver.Resolver()
|
||||
resolver.nameservers = ["100.74.29.146"]
|
||||
@ -156,7 +157,7 @@ async def ssl(ctx, domain: str):
|
||||
|
||||
|
||||
if not records:
|
||||
await ctx.response.send_message(f"No A record found for {domain}")
|
||||
await ctx.channel.send(f"No A record found for {domain}")
|
||||
return
|
||||
|
||||
# Get the first A record
|
||||
@ -230,16 +231,16 @@ async def ssl(ctx, domain: str):
|
||||
message2 = message[len(message1):]
|
||||
|
||||
|
||||
await ctx.response.send_message(message1)
|
||||
await ctx.channel.send(message1)
|
||||
await ctx.channel.send(message2)
|
||||
|
||||
|
||||
else:
|
||||
await ctx.response.send_message(message)
|
||||
await ctx.channel.send(message)
|
||||
|
||||
# Catch all exceptions
|
||||
except Exception as e:
|
||||
await ctx.response.send_message(f"An error occurred: {e}")
|
||||
await ctx.channel.send(f"An error occurred: {e}")
|
||||
|
||||
|
||||
@tree.command(name="invite", description="Invite me to your server")
|
||||
|
Loading…
Reference in New Issue
Block a user