jubot.handler

Jubot handler utilities.

collect

(collect ns-regexp)
Return composition of public handler functions in specified namespaces.

Params
  ns-regexp - A regular expression which specifies namespaces for searching handler functions.
Return
  A handler function.

comp

(comp)(comp & fs)
Compose handler functions.

Params
  fs - Sequence of handler functions.
Return
  Composition of handler functions.

HANDLER_REGEXP

The handler name regular expression
for collecting handler functions automatically.

help-handler-fn

(help-handler-fn ns-regexp)
Returns handler function to show handler helps.

Params
  :ns-regexp - a regular-expression which specifies bot's namespace.
Return
  A handler function.

public-handlers

(public-handlers ns-regexp)
Return sequence of public handler functions which matched HANDLER_REGEXP in specified namespaces.

Params
  ns-regexp - A regular expression which specifies namespaces for searching handler functions.
Return
  Sequence of handler functions.

regexp

(regexp {:keys [text], :as option} & reg-fn-list)
Choose and call handler function by specified regular expression.

Params
  option      - An argument that is passed to original handler function.
  reg-fn-list - Pair of regular expression and function.
                The paired function is called,
                if the regular expression is matched.

                In addition to original handler input,
                `re-find` result will be passed to
                the paired function with `match` key.
Return
  Result of a chosen handler function.