Commits

Jason R. Coombs  committed ab73a89

Updated pmxbot plugins to not require a callable be specified, simplifying the basic usage.

  • Participants
  • Parent commits b7fc1b5
  • Tags 1101.2

Comments (0)

Files changed (2)

 
     entry_points = {
         'pmxbot_handlers': [
-            'plugin_name = mylib.mymodule:initialize_func',
+            'plugin name = mylib.mymodule',
         ],
     },
 
 During startup (and after loading the traditional script-based plugins),
-pmxbot will load `mylib.mymodule` and call `initialize_func` from that
-module (with no parameters).
-`plugin_name` can be anything, but should be a name suitable to
-identify the plugin. It is not necessary that initialize_func do
-anything at all, but it must be present, and will be called during
-startup.
+pmxbot will load `mylib.mymodule`. `plugin name` can be anything, but should
+be a name suitable to identify the plugin (and it will be displayed during
+pmxbot startup).
+
+If your plugin requires any initialization, specify an initialization function
+(or class method) in the entry point. For example::
+
+    'plugin name = mylib.mymodule:initialize_func'
+
+On startup, pmxbot will call `initialize_func` with no parameters.
 
 Within the script you'll want to import the decorates you need to use with:
 `from pmxbot.botbase import command, contains, execdelay, execat`. You'll then

File pmxbot/pmxbot.py

 		try:
 			log.info('Loading %s', ep.name)
 			init_func = ep.load()
-			init_func()
+			if callable(init_func):
+				init_func()
 		except Exception:
 			log.exception("Error initializing plugin %s." % ep)