Fix whois

This commit is contained in:
nexy7574 2023-12-05 21:14:13 +00:00
parent 61fb6cb382
commit 8f94fbed2d

View file

@ -2341,10 +2341,12 @@ class OtherCog(commands.Cog):
return await ctx.respond("Invalid domain.") return await ctx.respond("Invalid domain.")
process = await asyncio.create_subprocess_exec( process = await asyncio.create_subprocess_exec(
"whois", "-H", url.hostname, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, text=True "whois", "-H", url.hostname, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
) )
stdout, stderr = await process.communicate() stdout, stderr = await process.communicate()
await process.wait() await process.wait()
stdout = stdout.decode("utf-8", "replace")
stderr = stderr.decode("utf-8", "replace")
if process.returncode != 0: if process.returncode != 0:
return await ctx.respond(f"Error:\n```{stderr[:3900]}```") return await ctx.respond(f"Error:\n```{stderr[:3900]}```")