From 0849e3f09b803d63fc112865c014e1a0648c6475 Mon Sep 17 00:00:00 2001 From: neersighted Date: Thu, 29 Mar 2012 18:22:22 -0700 Subject: [PATCH] tweaks to .sys --- plugins/system.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/system.py b/plugins/system.py index f8bb9ee..d83abf5 100755 --- a/plugins/system.py +++ b/plugins/system.py @@ -4,6 +4,7 @@ import platform from util import hook +@hook.command("memory", autohelp=False) @hook.command(autohelp=False) def mem(inp): ".mem -- Display the bot's current memory usage." @@ -12,8 +13,8 @@ def mem(inp): status_file = open("/proc/%d/status" % os.getpid()).read() line_pairs = re.findall(r"^(\w+):\s*(.*)\s*$", status_file, re.M) status = dict(line_pairs) - keys = 'VmSize VmLib VmData VmExe VmRSS VmStk'.split() - return '\x02, '.join(key + ':\x02' + status[key] for key in keys) + keys = 'VmSize VmRSS VmStk'.split() + return '\x02, '.join(key + ': \x02' + status[key] for key in keys) elif os.name == 'nt': cmd = "tasklist /FI \"PID eq %s\" /FO CSV /NH" % os.getpid() @@ -23,10 +24,11 @@ def mem(inp): for amount in re.findall(r'([,0-9]+) K', out): total += int(amount.replace(',', '')) - return 'Memory usage: \x02%d kB\x02' % total + return '\x02Memory Usage: %s kB\x02' % total return mem.__doc__ +@hook.command("system", autohelp=False) @hook.command(autohelp=False) def sys(inp): ".sys -- Retrieves information about the host system."