feat: added nslookup command to galaxy cog

This commit is contained in:
Seaswimmer 2023-08-07 09:42:46 -04:00
parent 952b1c55b6
commit 0c3c975dd6
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -2,6 +2,7 @@ from redbot.core import commands, checks, Config
import discord import discord
from datetime import datetime from datetime import datetime
import re import re
import subprocess
class Galaxy(commands.Cog): class Galaxy(commands.Cog):
"""Custom cog intended for use on the Galaxy discord server. """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) embed.add_field(name="Polaris XP", value=f"{output_to}", inline=False)
await ctx.send(embed=embed) 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() @commands.command()
async def galaxyissues(self, ctx, target: discord.Member = None): async def galaxyissues(self, ctx, target: discord.Member = None):
if ctx.me.id == 1070819799254438039: if ctx.me.id == 1070819799254438039: