]> jfr.im git - erebus.git/blobdiff - modules/userinfo.py
weather module
[erebus.git] / modules / userinfo.py
index fb0e111d4ecfddaff6476ad60a79d6e843f64c87..03545a606241ffb7aa936600bf23be02365b278b 100644 (file)
@@ -1,13 +1,14 @@
 # Erebus IRC bot - Author: Erebus Team
-# trivia module
+# userinfo 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': [2],
+       'depends': [],
+       'softdeps': ['help'],
 }
 
 # preamble
@@ -43,7 +44,7 @@ def getauth(thing):
                if thing.auth is not None:
                        return "#"+thing.auth
        elif isinstance(thing, basestring):
-               if thing[0] == "#":
+               if thing.startswith("#"):
                        return thing
                else:
                        if parent.user(thing).auth is not None:
@@ -71,10 +72,10 @@ def _set(user, key, value):
        db.setdefault(str(user).lower(), {})[key] = value #but set nick too
 
 #commands
-@lib.hook(needchan=False)
+@lib.hook(needchan=False, wantchan=True)
 @lib.help("[<target>]", "lists info items known about someone", "<target> may be a nick, or an auth in format '#auth'", "it defaults to yourself")
 def getitems(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
 
        if len(args) > 0:
@@ -84,11 +85,11 @@ def getitems(bot, user, chan, realtarget, *args):
 
        bot.msg(replyto, "%(user)s: %(target)s has the following info items: %(items)s" % {'user':user,'target':target,'items':(', '.join(_keys(target)))})
 
-@lib.hook(needchan=False)
+@lib.hook(needchan=False, wantchan=True)
 @lib.help("[<target>] <item>", "gets an info item about someone", "<target> may be a nick, or an auth in format '#auth'", "it defaults to yourself")
 @lib.argsGE(1)
 def getinfo(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
 
        if len(args) > 1: