]> jfr.im git - erebus.git/blobdiff - modules/chanops.py
trivia - small bugfixes
[erebus.git] / modules / chanops.py
index 984815c8734b15250e5bc5bbc86d908b532a7268..c4310f8032a9bd252b93ecaa30de82c5d25a1b47 100644 (file)
@@ -1,12 +1,13 @@
 # Erebus IRC bot - Author: Erebus Team
-# !EVAL and !EXEC commands
+# vim: fileencoding=utf-8
+# chanop commands
 # This file is released into the public domain; see http://unlicense.org/
 
 # module info
 modinfo = {
        'author': 'Erebus Team',
        'license': 'public domain',
-       'compatible': [1,2],
+       'compatible': [0],
        'depends': [],
        'softdeps': ['help'],
 }
@@ -25,12 +26,9 @@ import ctlmod
 def module(name):
        return lib.mod(name)
 
-@lib.hook(None, clevel=lib.OP)
-@lib.help("<nick|#auth> [<reason>]", "kick <nick>, or all using <#auth>")
-@lib.argsGE(1)
 def _kick(bot, user, chan, realtarget, *args):
        people = []
-       if args[0][0] == "#":
+       if args[0].startswith("#"):
                people = bot.parent.getuserbyauth(args[0][1:])
        else:
                people = [args[0]]
@@ -52,12 +50,17 @@ def kick(bot, user, chan, realtarget, *args):
        bot.msg(user, "Done. Kicked %d people." % (number))
 
 @lib.hook(None, clevel=lib.OP)
-@lib.help("<nick> [<reason>]", "kick all using the auth of <nick>")
+@lib.help("<nick|#auth> [<reason>]", "kick all using the auth of <nick>")
 @lib.argsGE(1)
 def kickall(bot, user, chan, realtarget, *args):
-       auth = bot.parent.user(args[0]).auth
+       target = args[0]
+       if target[0] == "#" and len(target) > 1:
+               auth = target[1:]
+       else:
+               auth = bot.parent.user(args[0]).auth
+
        if auth is not None:
-               number = _kick(bot, user, chan, realtarget, "#"+bot.parent.user(args[0]).auth, *args[1:])
+               number = _kick(bot, user, chan, realtarget, "#"+auth, *args[1:])
                bot.msg(user, "Done. Kicked %d people." % (number))
        else:
                bot.msg(user, "I don't know that person's auth.")
@@ -90,14 +93,14 @@ def deop(bot, user, chan, realtarget, *args):
        bot.msg(user, "Deopped.")
 
 @lib.hook(None, clevel=lib.OP)
-@lib.help("[<nick>] [...]", "")
+@lib.help("[<nick>] [...]", "voices yourself or <nick>s")
 def voice(bot, user, chan, realtarget, *args):
        if len(args) == 0: args = (user.nick,)
        _mode(bot, chan, "+", "v", args)
        bot.msg(user, "Voiced.")
 
 @lib.hook(None, clevel=lib.OP)
-@lib.help("[<nick>] [...]", "")
+@lib.help("[<nick>] [...]", "devoices yourself or <nick>s")
 def devoice(bot, user, chan, realtarget, *args):
        if len(args) == 0: args = (user.nick,)
        _mode(bot, chan, "-", "v", args)