Discord Elixir v1.1.4 DiscordEx.Client.Utility

Utilty methods to be used for discord clients.

Normalizers, Encoders, and Decoders

Summary

Functions

Generic function for updating the value of an agent process

Generic function for getting the value from an agent process

Convert atom to string

Get the atom value of and opcode using an integer value

Build a binary payload for discord communication

Build a json payload for discord communication

Decode json payload received from discord into a map

Functions

agent_update(agent, n)

Specs

agent_update(pid, any) :: nil

Generic function for updating the value of an agent process

agent_value(agent)

Specs

agent_value(pid) :: any

Generic function for getting the value from an agent process

normalize_atom(atom)

Specs

normalize_atom(atom) :: String.t

Convert atom to string

opcode(codes, value)

Specs

opcode(map, atom) :: integer
opcode(map, integer) :: atom

Get the atom value of and opcode using an integer value

payload_build(op, data, seq_num \\ nil, event_name \\ nil)

Specs

payload_build(number, map, number, String.t) :: binary

Build a binary payload for discord communication

payload_build_json(op, data, seq_num \\ nil, event_name \\ nil)

Specs

payload_build_json(number, map, number, String.t) :: binary

Build a json payload for discord communication

payload_decode(codes, arg)

Specs

payload_decode(list, {atom, binary}) :: map
payload_decode(list, {atom, binary}) :: map

Decode json payload received from discord into a map