(add-handler! handler)
(clear-extensions!)
(clear-handlers!)
(create-bot bot-name)
(create-bot bot-name prefix)
(create-bot bot-name prefix auth)
Creates a bot that will dynamically dispatch to different extensions based on <prefix><command> style messages.
Creates a bot that will dynamically dispatch to different extensions based on <prefix><command> style messages.
(defcommand command
[client-param message-param]
docstring?
options?
&
command-body)
Defines a one-off command and adds that to the global extension registry. This is a single function that will respond to commands and is not a part of a larger command infrastructure.
Example: (defcommand botsay [client message] (say (:content message)) (delete message))
The above code expands into the following:
(do (defn botsay [client message] (say (:content message)) (delete message))
(register-extension! :botsay botsay))
Defines a one-off command and adds that to the global extension registry. This is a single function that will respond to commands and is not a part of a larger command infrastructure. Example: (defcommand botsay [client message] (say (:content message)) (delete message)) The above code expands into the following: (do (defn botsay [client message] (say (:content message)) (delete message)) (register-extension! :botsay botsay))
(defextension extension-name [client-param message-param] docstring? & impls)
Defines a multi-method with the supplied name with a 2-arity dispatch function which dispatches based upon the first word in the message. It also defines a :default which responds back with an error.
Example: (defextension test-extension [client message] "Optional global extension documentation" (:say "Optional command documentation" (say message))
(:greet (say "Hello Everyone!"))
(:kick (doseq [user (:user-mentions message)] (let [guild-id (get-in message [:channel :guild-id] message)] (http/kick client guild-id user)))))
Arguments: extension-name :: String -- The name of the extension, and subsequent multi-method being defined. arg-vector :: Vector -- A 2-element vector defining the argument vector for the extension. The first argument is the client being passed to the message docstring? :: String -- Optional documentation that can be supplied for this extension. impls :: Forms -- A sequence of lists, each representing a command implementation. The first argument to each implementation is a keyword representing the command being implemented. Optionally, the first argument in the implementation can be documentation for this particular command.
Defines a multi-method with the supplied name with a 2-arity dispatch function which dispatches based upon the first word in the message. It also defines a :default which responds back with an error. Example: (defextension test-extension [client message] "Optional global extension documentation" (:say "Optional command documentation" (say message)) (:greet (say "Hello Everyone!")) (:kick (doseq [user (:user-mentions message)] (let [guild-id (get-in message [:channel :guild-id] message)] (http/kick client guild-id user))))) Arguments: extension-name :: String -- The name of the extension, and subsequent multi-method being defined. arg-vector :: Vector -- A 2-element vector defining the argument vector for the extension. The first argument is the client being passed to the message docstring? :: String -- Optional documentation that can be supplied for this extension. impls :: Forms -- A sequence of lists, each representing a command implementation. The first argument to each implementation is a keyword representing the command being implemented. Optionally, the first argument in the implementation can be documentation for this particular command.
(defhandler handler-name [prefix-param client-param message-param] & body)
This is used to create custom message handlers, for which all messages received by the bot will be passed through. This is used f or the creation of advanced bot functionality such as automatic moderation, alias creation, etc.
This is used to create custom message handlers, for which all messages received by the bot will be passed through. This is used f or the creation of advanced bot functionality such as automatic moderation, alias creation, etc.
(delete message)
(get-clojure-files folder)
Given a directory, returns all '.clj' files in that folder.
Given a directory, returns all '.clj' files in that folder.
(get-extensions)
(get-handlers)
(help-command-handler client message)
(help18021 _ _)
Look at help information for the available extensions.
Look at help information for the available extensions.
(load-clojure-files-in-folder! folder)
Given a directory, loads all of the .clj files in that directory tree. This can be used to dynamically load extensions defined with defextension or manually calling register-extension! out of a folder.
Given a directory, loads all of the .clj files in that directory tree. This can be used to dynamically load extensions defined with defextension or manually calling register-extension! out of a folder.
(load-extension-folders!)
(pm message)
(register-builtins!)
(register-extension! extension-name extension-function)
(register-extension! extension-name extension-function extension-options)
Creates a mapping between the supplied extension name and the handler function in the global extension registry.
Creates a mapping between the supplied extension name and the handler function in the global extension registry.
(register-extension-docs! extension-name documentation)
Add the documentation for this particular extension to the global extension documentation registry.
Add the documentation for this particular extension to the global extension documentation registry.
(reload-command-handler client message)
(say message)
(start)
Creates a bot where the extensions are those present in all Clojure files present in the directories supplied. This allows you to dynamically add files to a extensions/ directory and have them get automatically loaded by the bot when it starts up.
Creates a bot where the extensions are those present in all Clojure files present in the directories supplied. This allows you to dynamically add files to a extensions/ directory and have them get automatically loaded by the bot when it starts up.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close