Discord Elixir v1.1.18 DiscordEx.Client View Source
Connect to Discord to recieve and send data in realtime
You shouldn’t be using this directly apart from calling start_link/1
and status_update/2
. You should pass it to a handler.
Examples
token = "<your-token>"
DiscordEx.Client.start_link(%{token: token, handler: DiscordEx.EchoBot})
#=> {:ok, #PID<0.178.0>}
Link to this section Summary
Functions
Start a voice connection listener process
Callback implementation for c::websocket_client.init/1
Callback implementation for c::websocket_client.onconnect/2
Callback implementation for c::websocket_client.ondisconnect/2
Changes your status
Voice State Update for Users ( move users around voice channels )
Handle binary data sent by Discord over the Websocket
Initiate voice connection update state call
Callback implementation for c::websocket_client.websocket_terminate/3
Link to this section Functions
Start a voice connection listener process
Callback implementation for c::websocket_client.init/1
.
Callback implementation for c::websocket_client.onconnect/2
.
Callback implementation for c::websocket_client.ondisconnect/2
.
status_update(map(), map()) :: nil
Changes your status
Parameters
new_status: map with new status
Supported keys in that map:
:idle_since
and:game_name
. If some of them are missingnil
is used.
Examples
new_status = %{idle_since: 123456, game_name: "some game"}
Client.status_update(state, new_status)
Voice State Update for Users ( move users around voice channels )
Parameters
- client_pid: Base client process
- guild_id: Which guild to move this user in
- channel_id: Which channel the user is in or you want to move them to
- user_id: User to manipulate
- options: Options to set on the user
Examples
DiscordEx.Client.voice_state_update(client, guild_id, user_id, channel_id, %{self_deaf: true, self_mute: false})
Handle binary data sent by Discord over the Websocket
Initiate voice connection update state call
Callback implementation for c::websocket_client.websocket_terminate/3
.