From bb3d517bcdd2d87fed0bb4ce08c8454e226d99dc Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Sat, 12 Aug 2023 15:18:21 +1000 Subject: [PATCH] bot: Added curl command --- bot.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bot.py b/bot.py index a9723b9..766b3ac 100644 --- a/bot.py +++ b/bot.py @@ -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}")