-
Notifications
You must be signed in to change notification settings - Fork 5
Usable functions in modules
nemunaire edited this page Sep 8, 2014
·
3 revisions
When a module is loaded by the nemubot importer, some imports are made to include basic bot features.
-
add_hook(store, hook)
: add a hook (Hook
class) in the given hook_store (string). -
del_hook(store, hook)
: remove a hook (Hook
class) from the given hook_store (string). -
add_event(event)
: add a new event to the list (give a filledEvent
class). Return the event id. -
add_event_eid(event, eid)
: add an event with a fixed event id. Return the event id. -
del_event(eid)
: remove the eid event.
Instead of returning all response with the return
keyword, you can use the
send_response
function.
For example:
send_response(server, response)
The server
argument can be a string or a Server
class.
The response
argument has to be Response
class.
-
save()
: force saving the data module.
-
print(msg)
: display a message on shell; -
print_debug(msg)
: display a message on shell, only if debug-mode is on.
-
CONF
: the module configuration
-
DEBUG
: boolean storing debuging state of this module; -
DIR
: address to the module directory; -
name
: internal name of the module; -
REGISTERED_HOOKS
: list which save hooks register by this module (mainly used for unload); -
REGISTERED_EVENTS
: list which save events register by this module (mainly used for unload).