Compare commits

..

No commits in common. "e2059eac77c673b507e9a172bbf08a4680c72e84" and "ee9b62db5b8dc1aef4e6e5a198c84c546d724363" have entirely different histories.

View file

@ -5,7 +5,6 @@
# ____) | __/ (_| \__ \\ V V /| | | | | | | | | | | | __/ | # ____) | __/ (_| \__ \\ V V /| | | | | | | | | | | | __/ |
# |_____/ \___|\__,_|___/ \_/\_/ |_|_| |_| |_|_| |_| |_|\___|_| # |_____/ \___|\__,_|___/ \_/\_/ |_|_| |_| |_|_| |_| |_|\___|_|
import asyncio
import inspect import inspect
import operator import operator
from functools import partial, partialmethod from functools import partial, partialmethod
@ -83,22 +82,3 @@ class SeaUtils(commands.Cog):
await ctx.send(embed=embed, reference=ctx.message.to_reference(fail_if_not_exists=False)) await ctx.send(embed=embed, reference=ctx.message.to_reference(fail_if_not_exists=False))
else: else:
await ctx.send(content="Object not found!", reference=ctx.message.to_reference(fail_if_not_exists=False)) await ctx.send(content="Object not found!", reference=ctx.message.to_reference(fail_if_not_exists=False))
@commands.command(name='dig', aliases=['dnslookup', 'nslookup'])
@commands.is_owner()
async def dig(self, ctx: commands.Context, name: str, type: str | None = 'A', server: str | None = None, port: int = 53) -> None:
"""Retrieve DNS information for a domain."""
command_opts: list[str | int] = ['dig']
if server:
command_opts.extend(['@', server])
command_opts.extend([name, type])
if port != 53:
command_opts.extend(['-p', port])
command_opts.extend(['+yaml'])
process = await asyncio.create_subprocess_exec(*command_opts, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
stdout, stderr = await process.communicate()
if stderr:
await ctx.send(content=cf.box(text=stderr.decode()))
else:
await ctx.send(content=cf.box(text=stdout.decode(), lang='yaml'))