Implementation namespace for discljord.connections
.
Implementation namespace for `discljord.connections`.
(connect-shard! url
token
shard-id
shard-count
out-ch
comm-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
(connect-shards! url token shard-count out-ch comm-ch & {:keys [buffer-size]})
Calls connect-shard! once per shard in shard-count, and returns a sequence of promises of the return results.
Calls connect-shard! once per shard in shard-count, and returns a sequence of promises of the return results.
(get-websocket-gateway! url token)
Gets the shard count and websocket endpoint from Discord's API.
Gets the shard count and websocket endpoint from Discord's API.
Handles commands from the outside world.
Takes an atom of a vector of promises 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 an atom of a vector of promises 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 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.
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.
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.
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.
(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.
(start-communication-loop! shards token ch out-ch comm-ch)
Takes a vector of promises representing the atoms of websocket connections of the shards.
Takes a vector of promises representing the atoms of websocket connections of the shards.
(start-event-loop! conn ch out-ch comm-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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close