Created
March 14, 2016 17:54
-
-
Save quantenProjects/2ad38687ed7b768576b1 to your computer and use it in GitHub Desktop.
simple server status check for https://github.com/hangoutsbot/hangoutsbot don't forget to activate the plugin in the config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| execute w and df -h on server | |
| """ | |
| import plugins | |
| import subprocess | |
| def _initialize(bot): | |
| plugins.register_admin_command(['w']) | |
| plugins.register_admin_command(['df']) | |
| def w(bot, event, *args): | |
| string = subprocess.Popen(["w"], stdout=subprocess.PIPE).communicate()[0].decode("utf-8").replace("\n","<br><br>") | |
| yield from bot.coro_send_message(event.conv_id, string) | |
| def df(bot, event, *args): | |
| string = subprocess.Popen(["df","-h"], stdout=subprocess.PIPE).communicate()[0].decode("utf-8").replace("\n","<br><br>") | |
| yield from bot.coro_send_message(event.conv_id, string) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment