17 lines
553 B
Python
17 lines
553 B
Python
|
import subprocess
|
||
|
|
||
|
import pinhook.plugin
|
||
|
|
||
|
@pinhook.plugin.command('&date', help_text='Current date')
|
||
|
def get_time(msg):
|
||
|
out = subprocess.check_output(['date']).decode().strip()
|
||
|
return pinhook.plugin.message(out)
|
||
|
|
||
|
@pinhook.plugin.command('&load', help_text='Current CPU Load')
|
||
|
@pinhook.plugin.command('&uptime', help_text='Current Server Uptime')
|
||
|
def uptime(msg):
|
||
|
out = subprocess.check_output(['uptime']).decode().strip()
|
||
|
if msg.cmd == '&load':
|
||
|
out = ', '.join(out.split(',')[-3:]).strip()
|
||
|
return pinhook.plugin.message(out)
|