maybe fixed ssh connection
This commit is contained in:
parent
55c81f47fb
commit
9a9a74f19f
1 changed files with 9 additions and 8 deletions
|
|
@ -37,14 +37,15 @@ class WakeOnLan(commands.Cog):
|
|||
async def sleep(self, ctx, amount=5):
|
||||
if ctx.author.id == self.admin_id:
|
||||
#use ssh to login and shutdown
|
||||
ssh_client = asyncssh.connect(
|
||||
async with asyncssh.connect(
|
||||
self.stable_diffusion_ip,
|
||||
username=self.stable_diffusion_login,
|
||||
password=self.stable_diffusion_password,
|
||||
timeout=10,
|
||||
)
|
||||
) as ssh_client:
|
||||
try:
|
||||
await ssh_client.run("shutdown /s")
|
||||
result = await ssh_client.run("shutdown /s")
|
||||
await ctx.send(result.stdout)
|
||||
#await ssh_client.run("sudo shutdown -h now")
|
||||
except:
|
||||
self.logger.exception("WakeOnLan: Sleeping failed")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue