Example #1
0
    def action(self, complete):
        msg=complete.message()
        pluginBlacklist=["special"]
        if len(msg.split()) == 1:
            if msg.split()[0] in globalv.aliasExtensions.keys():
                if globalv.aliasExtensions[msg.split()[0]]=="":
                    return ["PRIVMSG $C$ :Alias has no additional arguments"]
                return ["PRIVMSG $C$ :!%s %s"%(globalv.basePlugin[msg.split()[0]], globalv.aliasExtensions[msg.split()[0]].strip())]
            else:
                return ["PRIVMSG $C$ : Command is not an alias!"]
        if msg.split()[0] in pluginBlacklist and not (isAllowed(complete.userMask())>=getLevel(complete.cmd()[0])):
            msg=["PRIVMSG $C$ :Restricted plugin!"]
        if msg.split()[0] not in globalv.loadedPlugins.keys():
            try:
                load_alias(msg.split()[0], ' '.join(msg.split()[1:]))
                msg=["PRIVMSG $C$ :Alias successful."]
            except:
                msg=["PRIVMSG $C$ :Alias unsuccessful. Are you sure %s is a valid plugin?"%msg.split()[1]]

        else:
            msg=[]
            message=lambda x:msg.append("PRIVMSG $C$ :"+x)
            message("Alias unsuccessful. Syntax: "+globalv.commandCharacter+"alias [word] [command] [optional arguments]")
            message("Optional Arguments can include $C$, which will expand to the channel name, $U$, which will expand to the username of the person who sends it.")
            message("You can also use $number$ style syntax, where number is a one or two digit number representing the word of the input to take. (As in, $2$ would extract \"hi\" from \"!command hey hi\". Additionally, a + or - after the number can be used to grab all words before or after that word.")
        return msg
Example #2
0
 def action(self, complete):
     name=complete.message().split()[0]
     loadAs=""
     if len(complete.message().split())==3:
         loadAs = complete.message().split()[2]
     loadBlacklist=["special"]
     if name.lower() in loadBlacklist and isAllowed(complete.userMask())<150:
         return ["PRIVMSG $C$ :Owner only plugin!"]
     if isAllowed(complete.userMask())<getLevel(complete.cmd()[0]):
         return ["PRIVMSG $C$ :Sorry, only elevated users can load plugins!"]
     if name in globalv.loadedAliases.keys():
         try:
             extension=globalv.loadedAliases[name]
             unload_plugin(name)
             pluginName=extension.split()[0]
             x=__import__(pluginName)
             reload(x)
             globalv.loadedPlugins[pluginName]=x.pluginClass()
             load_alias(name, extension)
             msg="Reloaded alias "+name+" successfully!"
         except Exception as detail:
             msg="Load failure: "+str(detail)
     else:
         try:
             state=load_plugin(name, loadAs)
             msg="oaded "+name+" successfully!"
             msg="L"+msg if state==0 else "Rel"+msg
         except Exception as detail:
             msg="Load failure: "+str(detail)
     if complete.message().split()[1:]==["silently"]:
         return [""]
     else:
         return ["PRIVMSG $C$ :"+msg]
Example #3
0
    def action(self, complete):
        msg = complete.message()
        pluginBlacklist = ["special"]
        if len(msg.split()) == 1:
            if msg.split()[0] in globalv.aliasExtensions.keys():
                if globalv.aliasExtensions[msg.split()[0]] == "":
                    return ["PRIVMSG $C$ :Alias has no additional arguments"]
                return [
                    "PRIVMSG $C$ :!%s %s" %
                    (globalv.basePlugin[msg.split()[0]],
                     globalv.aliasExtensions[msg.split()[0]].strip())
                ]
            else:
                return ["PRIVMSG $C$ : Command is not an alias!"]
        if msg.split()[0] in pluginBlacklist and not (isAllowed(
                complete.userMask()) >= getLevel(complete.cmd()[0])):
            msg = ["PRIVMSG $C$ :Restricted plugin!"]
        if msg.split()[0] not in globalv.loadedPlugins.keys():
            try:
                load_alias(msg.split()[0], ' '.join(msg.split()[1:]))
                msg = ["PRIVMSG $C$ :Alias successful."]
            except:
                msg = [
                    "PRIVMSG $C$ :Alias unsuccessful. Are you sure %s is a valid plugin?"
                    % msg.split()[1]
                ]

        else:
            msg = []
            message = lambda x: msg.append("PRIVMSG $C$ :" + x)
            message("Alias unsuccessful. Syntax: " + globalv.commandCharacter +
                    "alias [word] [command] [optional arguments]")
            message(
                "Optional Arguments can include $C$, which will expand to the channel name, $U$, which will expand to the username of the person who sends it."
            )
            message(
                "You can also use $number$ style syntax, where number is a one or two digit number representing the word of the input to take. (As in, $2$ would extract \"hi\" from \"!command hey hi\". Additionally, a + or - after the number can be used to grab all words before or after that word."
            )
        return msg
Example #4
0
    def action(self, complete):
        for line in settingsHandler.readSetting(
                "alias", "aliasName, aliasPlugin, aliasArguments"):
            load_alias(line[0], ' '.join(line[1:]))

        return ["PRIVMSG $C$ :Ok, done."]
Example #5
0
    def action(self, complete):
        for line in settingsHandler.readSetting("alias","aliasName, aliasPlugin, aliasArguments"):
            load_alias(line[0], ' '.join(line[1:]))

        return ["PRIVMSG $C$ :Ok, done."]