Commits

Jason R. Coombs committed c2276e8

Allow more fine-grained control of chaining 'contains' commands - just pass 'allow_chain=True' in @contains decorator

Comments (0)

Files changed (2)

pmxbot/__init__.py

 		),
 	],
 	librarypaste = 'http://paste.jaraco.com',
-	chain_contains = False,
 )
 "The config object"
 							pmxbot.itertools.generate_results(f),
 							exception_handler
 					)	)
-					if not pmxbot.config.chain_contains:
+					if not handler.allow_chain:
 						break
 		self._handle_output(channel, messages)
 
 	"rate to invoke handler"
 	doc = None
 	class_priority = 1
+	allow_chain = False
 
 class CommandHandler(Handler):
 	type_ = 'command'
 	class_priority = 2
 
 def contains(name, channels=(), exclude=(), rate=1.0, priority=1,
-		doc=None):
+		doc=None, **kwargs):
 	def deco(func):
 		effective_priority = priority+1 if name == '#' else priority
 		_handler_registry.append(ContainsHandler(
 			channels=channels,
 			exclude=exclude,
 			rate=rate,
-			priority=effective_priority))
+			priority=effective_priority,
+			**kwargs))
 		_handler_registry.sort()
 		return func
 	return deco