X-Git-Url: https://jfr.im/git/erebus.git/blobdiff_plain/a865743922e1bfad987e69bc421fb2b2cae70c2d..b68479d779c98ec06a1d66290dba8d98fb40f068:/modules/resources.py diff --git a/modules/resources.py b/modules/resources.py index 520f762..606bdc7 100644 --- a/modules/resources.py +++ b/modules/resources.py @@ -1,13 +1,15 @@ # Erebus IRC bot - Author: Erebus Team -# simple module example +# vim: fileencoding=utf-8 +# resource-usage module # This file is released into the public domain; see http://unlicense.org/ # module info modinfo = { 'author': 'Erebus Team', 'license': 'public domain', - 'compatible': [1], # compatible module API versions - 'depends': [], # other modules required to work properly? + 'compatible': [0], + 'depends': [], + 'softdeps': ['help'], } # preamble @@ -19,9 +21,10 @@ modstop = lib.modstop # module code import resource -@lib.hook(needchan=False, glevel=lib.MANAGER) +@lib.hook(needchan=False, wantchan=True, glevel=lib.MANAGER) +@lib.help(None, "show RAM usage") def ram(bot, user, chan, realtarget, *args): - if chan is not None and realtarget == chan.name: replyto = chan + if chan is not None: replyto = chan else: replyto = user try: @@ -31,9 +34,10 @@ def ram(bot, user, chan, realtarget, *args): bot.fastmsg(replyto, "Memory usage (MiB): %r" % (res.ru_maxrss/1024.0)) -@lib.hook(needchan=False, glevel=lib.MANAGER) +@lib.hook(needchan=False, wantchan=True, glevel=lib.MANAGER) +@lib.help(None, "show resource usage") def resources(bot, user, chan, realtarget, *args): - if chan is not None and realtarget == chan.name: replyto = chan + if chan is not None: replyto = chan else: replyto = user try: