Bundled with LeSysBot
power
Reboot or power off the machine, scheduled a minute out and cancellable.
This package can power the machine down. Read the notes before wiring it to an unattended chat.
Install#
Nothing to do — this package ships inside LeSysBot and is available as soon as the installer finishes.
Tools#
This package exposes 3 tools.
reboot()#
Restart the machine one minute from now.
Parameters
Takes no parameters.
Confirmation prompt
⚠️ This will REBOOT the machine in 1 minute. Proceed?
power_off()#
Shut the machine down one minute from now.
Parameters
Takes no parameters.
Confirmation prompt
⚠️ This will POWER OFF the machine in 1 minute. Proceed?
cancel_shutdown()#
Cancel a pending reboot or shutdown before the timer expires.
Parameters
Takes no parameters.
Confirmation prompt
Cancel the pending shutdown/reboot?
Notes#
- The one-minute delay is deliberate: it gives the chat reply time to reach you before the machine goes down, and it leaves a window to run cancel_shutdown if you change your mind.
- The right command is selected per OS. On systemd Linux the shutdown is scheduled through logind and polkit, so it runs as your normal user — no sudo, no setup.
- About ten seconds before the machine actually goes down, LeSysBot pushes a separate heads-up message, so you know the cancellation window has closed.
Source#
Every package is a folder holding a README.md and a tool.py. Read this one on GitHub: lesysbot/lesysbot/tools/power.
To write your own, see Writing tools.