Esempio n. 1
0
 def __init__(self, interestede, stope):
     self.done = False
     self.q = Queue()
     #assume interestede (&stope) may be string for single event
     # (because I accidently made that mistake!)
     if isIterable(interestede):
         self.interestede = set(interestede)
     else:
         self.interestede = set((interestede, ))
     if isIterable(stope):
         self.stope = set(stope)
     else:
         self.stope = set((stope, ))
Esempio n. 2
0
def help(event, bot):
    #inspect.getdoc
    #eventmap[etype]["command"].setdefault(commandname, []).append(mapping)
    cmd, arg = argumentSplit(event.argument, 2)
    # other modules should not do this:
    if cmd:
        cmds = bot._settings.dispatcher.getCommandFuncs(cmd)
        if cmds:
            for func, command in cmds:
                if arg:
                    h = functionHelp(func, arg)
                    if h: bot.say(h)
                    else: bot.say("No help for (%s) available." % cmd)
                else:
                    h = functionHelp(func)
                    if h:
                        if isIterable(command):
                            bot.say("%s Aliases: %s" % (h, ", ".join(command)))
                        else:
                            bot.say(h)
                    else:
                        bot.say("No help for (%s) available." % cmd)
        else:
            bot.say("Command %s not found." % cmd)

    else:
        cmds = bot._settings.dispatcher.getCommands()
        try:
            cmds.remove("eval")
        except ValueError:
            pass
        cmds.sort()
        bot.say(" ".join(cmds))
Esempio n. 3
0
def help(event, bot):
	""" help [argument].  If argument is specified, get the help string for that command.
	Otherwise list all commands (same as commands function).
	"""
	cmd, arg = argumentSplit(event.argument, 2)
	# other modules should probably not do this:
	if cmd:
		cmd_mappings = blockingCallFromThread(reactor, _filter_mappings, bot, event.isPM, cmd)
		if cmd_mappings:
			for mapping in cmd_mappings:
				if arg:
					h = functionHelp(mapping.function, arg)
					if h: bot.say(h)
					else: bot.say("No help for (%s) available." % cmd)
				else:
					h = functionHelp(mapping.function)
					if h:
						command = mapping.command
						if isIterable(command) and len(command) > 1:
							bot.say("%s Aliases: %s" % (h, ", ".join(command)))
						else:
							bot.say(h)
					else:
						bot.say("No help for (%s) available." % cmd)
		else:
			bot.say("Command %s not found." % cmd)
	else:
		list_commands(bot, event.isPM())
Esempio n. 4
0
def help(event, bot):
    """ help [argument].  If argument is specified, get the help string for that command.
	Otherwise list all commands (same as commands function).
	"""
    cmd, arg = argumentSplit(event.argument, 2)
    # other modules should probably not do this:
    if cmd:
        cmd_mappings = blockingCallFromThread(reactor, _filter_mappings, bot,
                                              event.isPM, cmd)
        if cmd_mappings:
            for mapping in cmd_mappings:
                if arg:
                    h = functionHelp(mapping.function, arg)
                    if h: bot.say(h)
                    else: bot.say("No help for (%s) available." % cmd)
                else:
                    h = functionHelp(mapping.function)
                    if h:
                        command = mapping.command
                        if isIterable(command) and len(command) > 1:
                            bot.say("%s Aliases: %s" % (h, ", ".join(command)))
                        else:
                            bot.say(h)
                    else:
                        bot.say("No help for (%s) available." % cmd)
        else:
            bot.say("Command %s not found." % cmd)
    else:
        list_commands(bot, event.isPM())
Esempio n. 5
0
	def __init__(self, interestede, stope):
		# Cannot both be empty
		assert(interestede or stope)
		self.done = False
		self.q = Queue()

		# Coerce string/unicode to a set and force lower
		# all event_types are lower in lookups/dispatch
		if isIterable(interestede):
			self.interestede = set(x.lower() for x in interestede)
		elif interestede:
			self.interestede = set((interestede.lower(),))
		else:
			self.interestede = set((None,))

		if isIterable(stope):
			self.stope = set(x.lower() for x in stope)
		elif interestede:
			self.stope = set((stope.lower(),))
		else:
			self.stope = set((None,))