User Tools

Site Tools


melanobot:configuration:handlers

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

melanobot:configuration:handlers [2015/05/12 10:02]
melanosuchus
melanobot:configuration:handlers [2015/05/26 15:35]
Line 1: Line 1:
-====== Message Handlers ====== 
-Message handlers perform an action when a message matches the conditions that trigger the handler. 
  
-Note that all handler classes start with a capital letter. 
- 
-See [[melanobot:​Modules|Modules]] for a list of concrete handlers. 
- 
-===== Handler ===== 
-Base class for all handlers. 
- 
-  * **priority** ''​0''​ -- Priority for messages generated by the handler 
-  * **enabled** ''​1''​ -- If ''​0''​ the handler will be completely ignored from the config. ​ 
- 
-===== SimpleAction ===== 
-Inherits [[#​Handler]]. 
- 
-Base class for all handler triggered by a fixed string at the beginning of the message. 
- 
-  * **trigger** -- String which triggers the handler. Derived classes have all their own default value (Unless otherwise specified, the default is a lowercase version of the handler type) 
-  * **public** ''​true''​ -- Whether the reply shall be given visible by everyone (otherwise only to the user triggering the handler) 
-  * **direct** ''​false''​ -- Whether the handler is triggered only from messages explicitly directed to the bot or can be triggered by any message. (Examples of direct messages on IRC are private messages or channel messages beginning with the IRC bot name) 
- 
-===== Templates ===== 
-The template system allows to create complex handler with custom parameters. 
- 
-==== Template Definition ==== 
-Templates are defined in the **templates** top-level group. 
-Their name is determined by the key used here.  
- 
-They are required to have the **type** key, which specifies which handler type this template is going to become. (Most likely [[melanobot:​modules:​core#​Group]] is the most useful). 
- 
-Then it can contain anything allowed in a definition of the corresponding handler type. 
- 
-In addition to the normal handler keys, template definitions allow to declare parameters, which will be replaced when the template is instantiated. 
-Parameters are defined as simple keys whose name starts with **@** their value (if any) will be used as default when not expressed by the instantiation. 
- 
-All values containing those parameters (including the **@**) will be replaced to the correct values. 
- 
-==== Template Instantiation ==== 
-A template instantiation uses the same form as a handler instantiation with "​**Template**"​ as type. 
- 
-The require the key ''​**template**''​ to be the name of the template to instantiate. 
- 
-Then any parameter defined in the template can be assigned a value. 
-Here parameters don't use the leading **@**. 
- 
- 
-===== Connection ===== 
-To make some things easier, connections can be defined wherever a handler can. Of course Connections are not affected by groups or other handler-specific settings. 
melanobot/configuration/handlers.txt · Last modified: 2015/05/26 15:35 (external edit)