Client

Ekztazy.ClientType
Client(
    token::String
    application_id::Snowflake
    intents::Int;
    presence::Union{Dict, NamedTuple}=Dict(),
    strategies::Dict{DataType, <:CacheStrategy}=Dict(),
    version::Int=9,
) -> Client

A Discord bot. Clients can connect to the gateway, respond to events, and make REST API calls to perform actions such as sending/deleting messages, kicking/banning users, etc.

Bot Token

A bot token can be acquired by creating a new application here. Make sure not to hardcode the token into your Julia code! Use an environment variable or configuration file instead.

Application ID

The application id for your bot can be found here. Make sure not to hardcode the application id into your Julia code! Use an environment variable or configuration file instead.

Intents

Integer representing intents. More information here.

Presence

The presence keyword sets the bot's presence upon connection. It also sets defaults for future calls to set_game. The schema here must be followed.

Cache Control

By default, most data that comes from Discord is cached for later use. However, to avoid memory leakage, not all of it is kept forever. The default setings are to keep everything but Messages, which are deleted after 6 hours, forever. Although the default settings are sufficient for most workloads, you can specify your own strategies per type with the strategies keyword. Keys can be any of the following:

For potential values, see CacheStrategy.

The cache can also be disabled/enabled permanently and temporarily as a whole with enable_cache! and disable_cache!.

API Version

The version keyword chooses the Version of the Discord API to use. Using anything but 9 is not officially supported by the Ekztazy.jl developers.

Sharding

Sharding is handled automatically. The number of available processes is the number of shards that are created. See the sharding example for more details.

source
Ekztazy.enable_cache!Function
enable_cache!(c::Client)
enable_cache!(f::Function c::Client)

Enable the cache. do syntax is also accepted.

source
Ekztazy.disable_cache!Function
disable_cache!(c::Client)
disable_cache!(f::Function, c::Client)

Disable the cache. do syntax is also accepted.

source

Gateway

Base.openFunction
open(c::Client; delay::Period=Second(7))

Connect a Client to the Discord gateway.

The delay keyword is the time between shards connecting. It can be increased from its default if you are using multiple shards and frequently experiencing invalid sessions upon connection.

source
Ekztazy.update_voice_stateFunction
update_voice_state(
    c::Client,
    guild::Integer,
    channel::Nullable{Integer},
    mute::Bool,
    deaf::Bool,
) -> Bool

Join, move, or disconnect from a voice channel. A VoiceStateUpdate event is sent by the gateway in response. More details here.

source
Ekztazy.update_statusFunction
update_status(
    c::Client,
    since::Nullable{Int},
    activity::Nullable{Activity},
    status::Union{PresenceStatus, AbstractString},
    afk::Bool,
) -> Bool

Indicate a presence or status update. A PresenceUpdate event is sent by the gateway in response. More details here.

source
Ekztazy.heartbeat_pingFunction
heartbeat_ping(c::Client) -> Nullable{Period}

Get the Client's ping time to the gateway. If the client is not connected, or no heartbeats have been sent/acknowledged, nothing is returned.

source

Caching

Ekztazy.CacheTTLType
CacheTTL(ttl::Period) -> CacheTTL

Evict items from the cache after ttl has elapsed.

source
Ekztazy.CacheLRUType
CacheLRU(size::Int) -> CacheLRU

Evict the least recently used item from the cache when there are more than size items.

source
Ekztazy.CacheFilterType
CacheFilter(f::Function) -> CacheFilter

Only store value v at key k if f(v) === true (k is always v.id).

source