Liking cljdoc? Tell your friends :D

discljord.connections


connect-bot!clj

(connect-bot! token out-ch & {:keys [buffer-size]})

Creates a connection process which will handle the services granted by Discord which interact over websocket.

Takes a token for the bot, and a channel on which all events from Discord will be sent back across.

Returns a channel used to communicate with the process and send packets to Discord.

Keep in mind that Discord sets a limit to how many shards can connect in a given period. This means that communication to Discord may be bounded based on which shard you use to talk to the server immediately after starting the bot.

Creates a connection process which will handle the services granted by
Discord which interact over websocket.

Takes a token for the bot, and a channel on which all events from Discord
will be sent back across.

Returns a channel used to communicate with the process and send packets to
Discord.

Keep in mind that Discord sets a limit to how many shards can connect in a
given period. This means that communication to Discord may be bounded based
on which shard you use to talk to the server immediately after starting the bot.
sourceraw docstring

connect-shard!clj

(connect-shard! url token shard-id shard-count out-ch & {:keys [buffer-size]})

Takes a gateway URL and a bot token, creates a websocket connected to Discord's servers, and returns a function of no arguments which disconnects it

Takes a gateway URL and a bot token, creates a websocket connected to
Discord's servers, and returns a function of no arguments which disconnects it
sourceraw docstring

connect-shards!clj

(connect-shards! url token shard-count out-ch & {:keys [buffer-size]})

Calls connect-shard! once per shard in shard-count, and returns a sequence of futures of the return results.

Calls connect-shard! once per shard in shard-count, and returns a sequence
of futures of the return results.
sourceraw docstring

disconnect-bot!clj

(disconnect-bot! connection-ch)

Takes the channel returned by connect-bot! and stops the connection.

Takes the channel returned by connect-bot! and stops the connection.
sourceraw docstring

get-websocket-gateway!clj

(get-websocket-gateway! url token)

Gets the gateway from Discord's API, including the number of shards recommended for your bot, and the websocket URL to connect to.

Gets the gateway from Discord's API, including the number of shards recommended
for your bot, and the websocket URL to connect to.
sourceraw docstring

handle-command!cljmultimethod

Handles commands from the outside world.

Takes a vector of futures containing atoms of shard connections, the channel used to send events out of the process, a keyword command type, and any number of command data arguments.

Handles commands from the outside world.

Takes a vector of futures containing atoms of shard connections,
the channel used to send events out of the process, a keyword command type,
and any number of command data arguments.
sourceraw docstring

handle-disconnect!cljmultimethod

Handles the disconnection process for different stop codes.

Takes an integer stop code, the message, a function to reconnect the shard, and a function to reconnect the shard with resume.

Handles the disconnection process for different stop codes.

Takes an integer stop code, the message, a function to reconnect
the shard, and a function to reconnect the shard with resume.
sourceraw docstring

handle-eventcljmultimethod

Handles event payloads sent from Discord in the context of the connection, before it gets to the regular event handlers.

Takes a keyword event type, event data from Discord, an atom containing the shard's state, and the channel for sending events out of the process.

Handles event payloads sent from Discord in the context of the connection,
before it gets to the regular event handlers.

Takes a keyword event type, event data from Discord, an atom containing the shard's
state, and the channel for sending events out of the process.
sourceraw docstring

handle-payload!cljmultimethod

Handles a command payload sent from Discord.

Takes an integer op code, the data sent from Discord, a function to reconnect the shard to Discord, a function to reconnect to Discord with a resume, a function to send a heartbeat to Discord, an atom containing the ack state from the last heartbeat, an atom containing whether the current shard is connected, and an atom containing the shard state, including the seq and session-id.

Handles a command payload sent from Discord.

Takes an integer op code, the data sent from Discord, a function to reconnect
the shard to Discord, a function to reconnect to Discord with a resume,
a function to send a heartbeat to Discord, an atom containing the ack state
from the last heartbeat, an atom containing whether the current shard is connected,
and an atom containing the shard state, including the seq and session-id.
sourceraw docstring

handle-websocket-event!cljmultimethod

Handles events sent from discord over the websocket.

Takes the channel to send events out of the process, a keyword event type, and any number of event data arguments.

Handles events sent from discord over the websocket.

Takes the channel to send events out of the process, a
keyword event type, and any number of event data arguments.
sourceraw docstring

reconnect-websocket!clj

(reconnect-websocket! url
                      token
                      conn
                      ch
                      shard
                      out-ch
                      &
                      {:keys [init-shard-state buffer-size]})

Takes a websocket connection atom and additional connection information, and reconnects a websocket, with options for resume or not.

Takes a websocket connection atom and additional connection information,
and reconnects a websocket, with options for resume or not.
sourceraw docstring

start-communication-loop!clj

(start-communication-loop! shards ch out-ch)

Takes a vector of futures representing the atoms of websocket connections of the shards.

Takes a vector of futures representing the atoms of websocket connections of the shards.
sourceraw docstring

start-event-loop!clj

(start-event-loop! conn ch out-ch)

Starts a go loop which takes events from the channel and dispatches them via multimethod.

Starts a go loop which takes events from the channel and dispatches them
via multimethod.
sourceraw docstring

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

× close