From 0c3c975dd6f0480954f7cb02dd7858fe27eace2f Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Mon, 7 Aug 2023 09:42:46 -0400 Subject: [PATCH] feat: added nslookup command to galaxy cog --- galaxy/galaxy.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/galaxy/galaxy.py b/galaxy/galaxy.py index f38aa91..8badfae 100644 --- a/galaxy/galaxy.py +++ b/galaxy/galaxy.py @@ -2,6 +2,7 @@ from redbot.core import commands, checks, Config import discord from datetime import datetime import re +import subprocess class Galaxy(commands.Cog): """Custom cog intended for use on the Galaxy discord server. @@ -32,6 +33,18 @@ class Galaxy(commands.Cog): embed.add_field(name="Polaris XP", value=f"{output_to}", inline=False) await ctx.send(embed=embed) + @commands.command() + @checks.is_owner() + async def nslookup(self, ctx: commands.Context, *, website: str): + try: + result = subprocess.run(['nslookup', website], capture_output=True, text=True, check=True) + await ctx.send(result.stdout) + except subprocess.CalledProcessError as e: + await ctx.send(f"Error executing nslookup: {e}") + except FileNotFoundError: + await ctx.send("nslookup command not found. Make sure you have nslookup installed and it's in your system PATH.") + + @commands.command() async def galaxyissues(self, ctx, target: discord.Member = None): if ctx.me.id == 1070819799254438039: