Liking cljdoc? Tell your friends :D

discljord.connections.impl

Implementation of websocket connections to Discord.

Implementation of websocket connections to Discord.
raw docstring

*handle-re-shard*clj

Determines if the bot will re-shard on its own, or require user coordination. If bound to true and a re-shard occurs, the bot will make a request to discord for the new number of shards to connect with and then connect them. If bound to false, then a :re-shard event will be sent to the user library and all shards will be disconnected.

Determines if the bot will re-shard on its own, or require user coordination.
If bound to true and a re-shard occurs, the bot will make a request to discord
for the new number of shards to connect with and then connect them. If bound
to false, then a :re-shard event will be sent to the user library and all
shards will be disconnected.
sourceraw docstring

*stop-on-fatal-code*clj

Bind to to true to disconnect the entire bot after a fatal stop code.

Bind to to true to disconnect the entire bot after a fatal stop code.
sourceraw docstring

after-timeout!clj

(after-timeout! f timeout)

Calls a function of no arguments after the given timeout. Returns a channel which will have the return value of the function put on it.

Calls a function of no arguments after the given `timeout`.
Returns a channel which will have the return value of the function put on it.
sourceraw docstring

buffer-sizeclj

The suggested size of a buffer; default: 4MiB.

The suggested size of a buffer; default: 4MiB.
sourceraw docstring

connect-shards!clj

(connect-shards! output-ch communication-ch url token shard-count shard-ids)

Connects a set of shards with the given shard-ids. Returns nil.

Connects a set of shards with the given `shard-ids`.
Returns nil.
sourceraw docstring

connect-websocket!clj

(connect-websocket! buffer-size url event-ch)

Connect a websocket to the url that puts all events onto the event-ch. Events are represented as vectors with a keyword for the event type and then event data as the rest of the vector based on the type of event.

| Type | Data | |---------------+------| | :connect | None. | :disconnect | Stop code, string message. | :error | Error value. | :message | String message.

Connect a websocket to the `url` that puts all events onto the `event-ch`.
Events are represented as vectors with a keyword for the event type and then
event data as the rest of the vector based on the type of event.

| Type          | Data |
|---------------+------|
| `:connect`    | None.
| `:disconnect` | Stop code, string message.
| `:error`      | Error value.
| `:message`    | String message.
sourceraw docstring

fatal-code?clj

Set of stop codes which after recieving, discljord will disconnect all shards.

Set of stop codes which after recieving, discljord will disconnect all shards.
sourceraw docstring

get-shard-from-guildclj

(get-shard-from-guild guild-id guild-count)
source

get-websocket-gatewayclj

(get-websocket-gateway url token)

Gets the shard count and websocket endpoint from Discord's API.

Takes the url of the gateway and the token of the bot.

Returns a map with the keys :url, :shard-count, and :session-start limit, or nil in the case of an error.

Gets the shard count and websocket endpoint from Discord's API.

Takes the `url` of the gateway and the `token` of the bot.

Returns a map with the keys :url, :shard-count, and :session-start limit, or
nil in the case of an error.
sourceraw docstring

handle-bot-fx!cljmultimethod

Handles a bot-level side effect triggered by a shard. This method should never block, and should not do intense computation. Takes a place to output events to the library user, the url to connect sockets, the bot's token, the vector of shards, a vector of channels which resolve to the shard's next state, the index of the shard the effect is from, and the effect. Returns a vector of the vector of shards and the vector of shard channels.

Handles a bot-level side effect triggered by a shard.
This method should never block, and should not do intense computation. Takes a
place to output events to the library user, the url to connect sockets, the
bot's token, the vector of shards, a vector of channels which resolve to the
shard's next state, the index of the shard the effect is from, and the effect.
Returns a vector of the vector of shards and the vector of shard channels.
sourceraw docstring

handle-communication!cljmultimethod

Handles communicating to the shards. Takes an event vector, a vector of shards, and a vector of channels which resolve to each shard's next state, and returns a vector of the vector of shards and the vector of channels.

Handles communicating to the `shards`.
Takes an `event` vector, a vector of `shards`, and a vector of channels which
resolve to each shard's next state, and returns a vector of the vector of
shards and the vector of channels.
sourceraw docstring

handle-discord-eventcljmultimethod

Handles discord events for a specific shard, specifying effects.

Handles discord events for a specific shard, specifying effects.
sourceraw docstring

handle-payloadcljmultimethod

Update a shard based on a message. Takes a shard and msg and returns a map with a :shard and an :effects vector.

Update a `shard` based on a message.
Takes a `shard` and `msg` and returns a map with a :shard and an :effects
vector.
sourceraw docstring

handle-shard-communication!cljmultimethod

Processes a communication event on the given shard for side effects. Returns a map with the new :shard and bot-evel :effects to process.

Processes a communication `event` on the given `shard` for side effects.
Returns a map with the new :shard and bot-evel :effects to process.
sourceraw docstring

handle-shard-fx!cljmultimethod

Processes an event on a given shard for side effects. Returns a map with the new :shard and bot-level :effects to process.

Processes an `event` on a given `shard` for side effects.
Returns a map with the new :shard and bot-level :effects to process.
sourceraw docstring

handle-websocket-eventcljmultimethod

Updates a shard based on shard events. Takes a shard and a shard event vector and returns a map of the new state of the shard and zero or more events to process.

Updates a `shard` based on shard events.
Takes a `shard` and a shard event vector and returns a map of the new state of
the shard and zero or more events to process.
sourceraw docstring

identify-limiterclj

source

make-shardclj

(make-shard id shard-count)

Creates a new shard with the given id and shard-count.

Creates a new shard with the given `id` and `shard-count`.
sourceraw docstring

new-session-stop-code?clj

Set of stop codes after which a resume isn't possible.

Set of stop codes after which a resume isn't possible.
sourceraw docstring

re-shard-stop-code?clj

Stop codes which Discord will send when the bot needs to be re-sharded.

Stop codes which Discord will send when the bot needs to be re-sharded.
sourceraw docstring

run-on-agent-with-limitclj

(run-on-agent-with-limit a f millis)

Runs the given function on the agent, then other actions wait millis.

Runs the given function on the agent, then other actions wait `millis`.
sourceraw docstring

should-resume?clj

(should-resume? shard)

Returns if a shard should try to resume.

Returns if a shard should try to resume.
sourceraw docstring

step-shard!clj

(step-shard! shard url token)

Starts a process to step a shard, handling side-effects. Returns a channel which will have a map with the new :shard and a vector of :effects for the entire bot to respond to placed on it after the next item the socket may respond to occurs.

Starts a process to step a `shard`, handling side-effects.
Returns a channel which will have a map with the new `:shard` and a vector of
`:effects` for the entire bot to respond to placed on it after the next item
the socket may respond to occurs.
sourceraw docstring

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

× close