Liking cljdoc? Tell your friends :D

discord.bot


add-handler!clj

(add-handler! handler)
source

build-extensionsclj

(build-extensions key-func-pairs)
source

build-inline-extensionsclj

(build-inline-extensions key-func-pairs)
(build-inline-extensions fn-key fn-body)
(build-inline-extensions fn-key fn-body command-options)
source

create-botclj

(create-bot bot-name extensions)
(create-bot bot-name extensions prefix)
(create-bot bot-name extensions 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.
sourceraw docstring

create-extensionclj

(create-extension command handler)
source

defcommandcljmacro

(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))
sourceraw docstring

defextensioncljmacro

(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.
sourceraw docstring

defhandlercljmacro

(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.
sourceraw docstring

deleteclj

(delete message)
source

doc-separatorclj

source

extension-docsclj

source

extension-registryclj

source

from-filescljmacro

(from-files bot-name prefix folders)

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.
sourceraw docstring

get-clojure-filesclj

(get-clojure-files folder)

Given a directory, returns all '.clj' files in that folder.

Given a directory, returns all '.clj' files in that folder.
sourceraw docstring

get-handlersclj

(get-handlers)
source

get-registered-extensionsclj

(get-registered-extensions)

Returns the current extension-registry as a list of Extensions.

Returns the current extension-registry as a list of Extensions.
sourceraw docstring

help17970clj

(help17970 _ _)

Look at help information for the available extensions.

Look at help information for the available extensions.
sourceraw docstring

load-clojure-files-in-folder!clj

(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.
sourceraw docstring

message-handlersclj

source

pmclj

(pm message)
source

register-extension!clj

(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.
sourceraw docstring

register-extension-docs!clj

(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.
sourceraw docstring

sayclj

(say message)
source

with-extensionscljmacro

(with-extensions bot-name prefix & key-func-pairs)

Given a name, prefix and series of :keyword-function pairs, builds a new bot inside of a with-open block that will sleep the while background threads manage the bot.

Given a name, prefix and series of :keyword-function pairs, builds a new bot inside of a
with-open block that will sleep the while background threads manage the bot.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close