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

Link to this function _voice_setup_gather_data(caller_pid, data \\ %{}, state) View Source

Start a voice connection listener process

Link to this function handle_event(arg, state) View Source

Callback implementation for c::websocket_client.init/1.

Callback implementation for c::websocket_client.onconnect/2.

Link to this function ondisconnect(arg, state) View Source

Callback implementation for c::websocket_client.ondisconnect/2.

Link to this function socket_url(opts) View Source
socket_url(map()) :: String.t()
Link to this function status_update(state, new_status) View Source
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 missing nil is used.

Examples

new_status = %{idle_since: 123456, game_name: "some game"}
Client.status_update(state, new_status)
Link to this function voice_state_update(client_pid, guild_id, channel_id, user_id, options \\ %{}) View Source
voice_state_update(pid(), String.t(), String.t(), String.t(), map()) :: atom()

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})
Link to this function websocket_handle(arg, socket, state) View Source

Handle binary data sent by Discord over the Websocket

Link to this function websocket_info(arg1, connection, state) View Source

Initiate voice connection update state call

Link to this function websocket_terminate(reason, conn_state, state) View Source

Callback implementation for c::websocket_client.websocket_terminate/3.