crux_gateway v0.1.0 Crux.Gateway View Source
Main entry point to start the Gateway connection.
Required for this to run are:
:token
to identify with, you can get your bot’s from here.
You want to keep that token secret at all times.
:url
to connect to. Probably something likewss://gateway.discord.gg
. (Do not append query strings)
You usually want to GET the url via
/gateway/bot
along the recommended shard count.
:shard_count
you plan to run altogether.
Can and probably should be retrieved via
/gateway/bot
.
- Optionally
:shards
, which has to be a list of numbers and ranges.
Examples: [1..3]
[1, 2, 3]
[1..3, 8, 9]
If omitted all shards will be run.
- Optionally
:dispatcher
, which has to be a validGenStage.Dispatcher
or a tuple of one and initial state.
See
Crux.Gateway.Connection.Producer
for more info.
Link to this section Summary
Types
Used to specify or override gateway options when initially starting the connection
Functions
Initialises the connection(s) and actually starts the gateway
Link to this section Types
gateway_options() :: %{ optional(:token) => String.t(), optional(:url) => String.t(), optional(:shard_count) => pos_integer(), optional(:shards) => [non_neg_integer() | Range.t()], optional(:dispatcher) => GenStage.Dispatcher.t() | {GenStage.Dispatcher.t(), term()} }
Used to specify or override gateway options when initially starting the connection.
See start/1
Link to this section Functions
start(args :: gateway_options()) :: [Supervisor.on_start_child()]
Initialises the connection(s) and actually starts the gateway.
You can specify or override :token
, :url
, :shard_count
and :shards
here via t:gateway_options
.