bot: Added curl command
All checks were successful
Build Docker / Build Docker (push) Successful in 23s

This commit is contained in:
Nathan Woodburn 2023-08-12 15:18:21 +10:00
parent e033f2e137
commit bb3d517bcd
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

12
bot.py
View File

@ -82,6 +82,18 @@ 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}")
@tree.command(name="curl", description="HTTP request")
async def curl(ctx, url: str):
try:
proxyURL = "https://proxy.hnsproxy.au"
response = requests.get(url, proxies={"http": proxyURL, "https": proxyURL},verify=False)
output = response.text
if (len(output) > 1900):
output = output[:1900]
await ctx.response.send_message(f"Response for {url}:\n{output}")
except requests.exceptions.RequestException as e:
await ctx.response.send_message(f"An error occurred: {e}")