bot: Catch more dig errors
All checks were successful
Build Docker / Build Docker (push) Successful in 16s

This commit is contained in:
Nathan Woodburn 2023-09-27 18:14:34 +10:00
parent 2ac733f33d
commit a88376555d
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

9
bot.py
View File

@ -141,6 +141,7 @@ async def ssl(ctx, domain: str):
await ctx.response.send_message("Please provide a valid domain to check") await ctx.response.send_message("Please provide a valid domain to check")
return return
ctx.response.send_message(f"Checking SSL certificate for {domain}...")
message = "" message = ""
resolver = dns.resolver.Resolver() resolver = dns.resolver.Resolver()
resolver.nameservers = ["100.74.29.146"] resolver.nameservers = ["100.74.29.146"]
@ -156,7 +157,7 @@ async def ssl(ctx, domain: str):
if not records: 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 return
# Get the first A record # Get the first A record
@ -230,16 +231,16 @@ async def ssl(ctx, domain: str):
message2 = message[len(message1):] message2 = message[len(message1):]
await ctx.response.send_message(message1) await ctx.channel.send(message1)
await ctx.channel.send(message2) await ctx.channel.send(message2)
else: else:
await ctx.response.send_message(message) await ctx.channel.send(message)
# Catch all exceptions # Catch all exceptions
except Exception as e: 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") @tree.command(name="invite", description="Invite me to your server")