diff --git a/bot.py b/bot.py index 711c9f1..14c3103 100644 --- a/bot.py +++ b/bot.py @@ -36,6 +36,9 @@ activityMessage="over the server" statusType="watching" +dns_ip = "194.50.5.26" +dns_port = 53 + # Commands @tree.command(name="ping", description="Check bot connection") async def ping(ctx): @@ -79,8 +82,8 @@ async def botstatus(ctx, message: str, statusmethod: str = None): async def dig(ctx, domain: str, record_type: str = "A"): record_type = record_type.upper() resolver = dns.resolver.Resolver() - resolver.nameservers = ["10.2.1.15"] - resolver.port = 5350 + resolver.nameservers = [dns_ip] + resolver.port = dns_port try: # Query the DNS record response = resolver.resolve(domain, record_type) @@ -95,6 +98,8 @@ async def dig(ctx, domain: str, record_type: str = "A"): await ctx.response.send_message(f"Domain {domain} not found.") except dns.exception.DNSException as e: await ctx.response.send_message(f"An error occurred: {e}") + except Exception as e: + await ctx.response.send_message(f"An error occurred: {e}") @tree.command(name="curl", description="HTTP request") async def curl(ctx, url: str): @@ -153,8 +158,8 @@ async def ssl(ctx, domain: str, showcert: bool = False, notifymeonexpiry: bool = await ctx.response.send_message(f"Checking SSL certificate for {domain}...") message = "" resolver = dns.resolver.Resolver() - resolver.nameservers = ["10.2.1.15"] - resolver.port = 5350 + resolver.nameservers = [dns_ip] + resolver.port = dns_port domain_check = False try: # Query the DNS record @@ -334,8 +339,8 @@ async def checkForSSLExpiry(): userid, domain = line.split(",") print(f"Checking SSL certificate for {domain}...", flush=True) resolver = dns.resolver.Resolver() - resolver.nameservers = ["10.2.1.15"] - resolver.port = 5350 + resolver.nameservers = [dns_ip] + resolver.port = dns_port try: # Query the DNS record response = resolver.resolve(domain, "A")