Jason R. Coombs avatar Jason R. Coombs committed 7a483f7

Use attributes of handler rather than tuple

Comments (0)

Files changed (1)

 
 		messages = ()
 		for handler in _handler_registry:
-			typ, name, f, doc, channels, exclude, rate, priority = handler
 			exception_handler = functools.partial(
 				self._handle_exception,
-				type = typ,
-				name = name,
-				doc = doc,
+				type = handler.type_,
+				name = handler.name,
+				doc = handler.doc,
 				)
-			if typ in ('command', 'alias') and cmd.lower() == '!%s' % name:
-				f = functools.partial(f, c, e, channel, nick, cmd_args)
+			if (handler.type_ in ('command', 'alias')
+					and cmd.lower() == '!%s' % handler.name):
+				f = functools.partial(handler.func, c, e, channel, nick,
+					cmd_args)
 				messages = pmxbot.itertools.trap_exceptions(
 					pmxbot.itertools.generate_results(f),
 					exception_handler
 				)
 				break
-			elif typ in ('contains', '#') and name in lc_msg:
-				f = functools.partial(f, c, e, channel, nick, msg)
+			elif (handler.type_ in ('contains', '#')
+					and handler.name in lc_msg):
+				f = functools.partial(handler.func, c, e, channel, nick, msg)
 				if (
-						not channels and not exclude
-						or channel in channels
-						or exclude and channel not in exclude
-						or channels == "logged"
+						not handler.channels and not handler.exclude
+						or channel in handler.channels
+						or handler.exclude and channel not in handler.exclude
+						or handler.channels == "logged"
 							and channel in pmxbot.config.log_channels
-						or channels == "unlogged"
+						or handler.channels == "unlogged"
 							and channel not in pmxbot.config.log_channels
-						or exclude == "logged"
+						or handler.exclude == "logged"
 							and channel not in pmxbot.config.log_channels
-						or exclude == "unlogged"
+						or handler.exclude == "unlogged"
 							and channel in pmxbot.config.log_channels
 						):
-					if random.random() > rate:
+					if random.random() > handler.rate:
 						continue
 					messages = itertools.chain(messages,
 						pmxbot.itertools.trap_exceptions(
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.