Ekztazy.ActivityType

A User activity. More details here.

Fields

name           :: String
type           :: Int
url            :: OptionalNullable{String}
timestamps     :: Optional{Ekztazy.ActivityTimestamps}
application_id :: Optional{Snowflake}
details        :: OptionalNullable{String}
state          :: OptionalNullable{String}
emoji          :: OptionalNullable{Ekztazy.ActivityEmoji}
party          :: Optional{Ekztazy.ActivityParty}
assets         :: Optional{Ekztazy.ActivityAssets}
secrets        :: Optional{Ekztazy.ActivitySecrets}
instance       :: Optional{Bool}
flags          :: Optional{Int}
Ekztazy.ActivityAssetsType

Images and hover text for an Activity. More details here.

Fields

large_image :: Optional{String}
large_text  :: Optional{String}
small_image :: Optional{String}
small_text  :: Optional{String}
Ekztazy.ActivitySecretsType

Secrets for Rich Presence joining and spectating of an Activity. More details here.

Fields

join     :: Optional{String}
spectate :: Optional{String}
match    :: Optional{String}
Ekztazy.ApplicationCommandType

An Application Command. More details here.

Fields

id                  :: OptionalNullable{Snowflake}
type                :: Optional{Int}
application_id      :: Snowflake
guild_id            :: Optional{Snowflake}
name                :: String
description         :: String
options             :: Optional{Vector{Ekztazy.ApplicationCommandOption}}
default_permissions :: Optional{Bool}
version             :: Optional{Snowflake}
Ekztazy.ApplicationCommandOptionType

Application Command Option. More details here.

Fields

value         :: Any
type          :: Optional{Int}
name          :: Optional{String}
description   :: Optional{String}
required      :: Optional{Bool}
min_value     :: Optional{Number}
max_value     :: Optional{Number}
autocomplete  :: Optional{Bool}
choices       :: Optional{Vector{Ekztazy.ApplicationCommandChoice}}
options       :: Optional{Vector{Ekztazy.ApplicationCommandOption}}
channel_types :: Optional{Vector{Int}}
focused       :: Optional{Bool}
Ekztazy.AttachmentType

A Message attachment. More details here.

Fields

id        :: Snowflake
filename  :: String
size      :: Int
url       :: String
proxy_url :: String
height    :: Optional{Int}
width     :: Optional{Int}
Ekztazy.AuditLogType

An audit log. More details here.

Fields

webhooks          :: Vector{Ekztazy.Webhook}
users             :: Vector{Ekztazy.User}
audit_log_entries :: Vector{Ekztazy.AuditLogEntry}
Ekztazy.AuditLogChangeType

A change item in an AuditLogEntry.

The first type parameter is the type of new_value and old_value. The second is the type of the entity that new_value and old_value belong(ed) to.

More details here.

Fields

new_value :: Optional{T} where T
old_value :: Optional{T} where T
key       :: String
type      :: Type{U} where U
Ekztazy.AuditLogEntryType

An entry in an AuditLog. More details here.

Fields

target_id   :: Nullable{Snowflake}
changes     :: Optional{Vector{Ekztazy.AuditLogChange}}
user_id     :: Snowflake
id          :: Snowflake
action_type :: Int
options     :: Optional{Ekztazy.AuditLogOptions}
reason      :: Optional{String}
Ekztazy.AuditLogOptionsType

Optional information in an AuditLogEntry. More details here.

Fields

delete_member_days :: Optional{Int}
members_removed    :: Optional{Int}
channel_id         :: Optional{Snowflake}
count              :: Optional{Int}
id                 :: Optional{Snowflake}
type               :: Optional{Int}
role_name          :: Optional{String}
Ekztazy.BanType

A User ban. More details here.

Fields

reason :: Nullable{String}
user   :: Ekztazy.User
Ekztazy.CacheFilterType
CacheFilter(f::Function) -> CacheFilter

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

Ekztazy.CacheForeverType
CacheForever() -> CacheForever

Store everything and never evict items from the cache.

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

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

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

Evict items from the cache after ttl has elapsed.

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.

Ekztazy.ComponentType

An interactable component. More details here.

Fields

type        :: Int
custom_id   :: Optional{String}
value       :: Optional{String}
disabled    :: Optional{Bool}
style       :: Optional{Int}
label       :: Optional{String}
emoji       :: Optional{Ekztazy.Emoji}
url         :: Optional{String}
options     :: Optional{Vector{Ekztazy.SelectOption}}
placeholder :: Optional{String}
min_values  :: Optional{Int}
max_values  :: Optional{Int}
components  :: Optional{Vector{Ekztazy.Component}}
Ekztazy.ConnectionType

A User connection to an external service (Twitch, YouTube, etc.). More details here.

Fields

id           :: String
name         :: String
type         :: String
revoked      :: Bool
integrations :: Vector{Ekztazy.Integration}
Ekztazy.ContextType
Context(
    data::Dict{Symbol, Any}
)

Context is a wrapper for a Dict{Symbol, Any} with some special functionality.

Ekztazy.ContextMethod
Context(; kwargs...) -> Context

Generates a context based on kwargs.

Ekztazy.DiscordChannelType

A Discord channel. More details here.

Note: The name Channel is already used, hence the prefix.

Fields

id                    :: Snowflake
type                  :: Optional{Int}
guild_id              :: Optional{Snowflake}
position              :: Optional{Int}
permission_overwrites :: Optional{Vector{Ekztazy.Overwrite}}
name                  :: Optional{String}
topic                 :: OptionalNullable{String}
nsfw                  :: Optional{Bool}
last_message_id       :: OptionalNullable{Snowflake}
bitrate               :: Optional{Int}
user_limit            :: Optional{Int}
rate_limit_per_user   :: Optional{Int}
recipients            :: Optional{Vector{Ekztazy.User}}
icon                  :: OptionalNullable{String}
owner_id              :: Optional{Snowflake}
application_id        :: Optional{Snowflake}
parent_id             :: OptionalNullable{Snowflake}
last_pin_timestamp    :: OptionalNullable{DateTime}
Ekztazy.EmbedType

A Message embed. More details here.

Fields

title       :: Optional{String}
type        :: Optional{String}
description :: Optional{String}
url         :: Optional{String}
timestamp   :: Optional{DateTime}
color       :: Optional{Int}
footer      :: Optional{Ekztazy.EmbedFooter}
image       :: Optional{Ekztazy.EmbedImage}
thumbnail   :: Optional{Ekztazy.EmbedThumbnail}
video       :: Optional{Ekztazy.EmbedVideo}
provider    :: Optional{Ekztazy.EmbedProvider}
author      :: Optional{Ekztazy.EmbedAuthor}
fields      :: Optional{Vector{Ekztazy.EmbedField}}
Ekztazy.EmbedAuthorType

An Embed's author information. More details here.

Fields

name           :: Optional{String}
url            :: Optional{String}
icon_url       :: Optional{String}
proxy_icon_url :: Optional{String}
Ekztazy.EmbedFooterType

An Embed's footer information. More details here.

Fields

text           :: String
icon_url       :: Optional{String}
proxy_icon_url :: Optional{String}
Ekztazy.EmbedImageType

An Embed's image information. More details here.

Fields

url       :: Optional{String}
proxy_url :: Optional{String}
height    :: Optional{Int}
width     :: Optional{Int}
Ekztazy.EmbedThumbnailType

An Embed's thumbnail image information. More details here.

Fields

url       :: Optional{String}
proxy_url :: Optional{String}
height    :: Optional{Int}
width     :: Optional{Int}
Ekztazy.EmbedVideoType

An Embed's video information. More details here.

Fields

url    :: Optional{String}
height :: Optional{Int}
width  :: Optional{Int}
Ekztazy.EmojiType

An emoji. More details here.

Fields

id             :: Nullable{Snowflake}
name           :: String
roles          :: Optional{Vector{Snowflake}}
user           :: Optional{Ekztazy.User}
require_colons :: Optional{Bool}
managed        :: Optional{Bool}
animated       :: Optional{Bool}
Ekztazy.GuildType

A Discord guild (server). More details here.

Fields

id                            :: Snowflake
name                          :: String
icon                          :: Nullable{String}
splash                        :: OptionalNullable{String}
owner                         :: Optional{Bool}
owner_id                      :: Optional{Snowflake}
permissions                   :: Optional{String}
region                        :: Optional{String}
afk_channel_id                :: OptionalNullable{Snowflake}
afk_timeout                   :: Optional{Int}
embed_enabled                 :: Optional{Bool}
embed_channel_id              :: OptionalNullable{Snowflake}
verification_level            :: Optional{Int}
default_message_notifications :: Optional{Int}
explicit_content_filter       :: Optional{Int}
roles                         :: Optional{Vector{Ekztazy.Role}}
emojis                        :: Optional{Vector{Ekztazy.Emoji}}
features                      :: Optional{Vector{String}}
mfa_level                     :: Optional{Int}
application_id                :: OptionalNullable{Snowflake}
widget_enabled                :: Optional{Bool}
widget_channel_id             :: OptionalNullable{Snowflake}
system_channel_id             :: OptionalNullable{Snowflake}
joined_at                     :: Optional{DateTime}
large                         :: Optional{Bool}
unavailable                   :: Optional{Bool}
member_count                  :: Optional{Int}
max_members                   :: Optional{Int}
voice_states                  :: Optional{Vector{Ekztazy.VoiceState}}
members                       :: Optional{Vector{Ekztazy.Member}}
channels                      :: Optional{Vector{Ekztazy.DiscordChannel}}
presences                     :: Optional{Vector{Ekztazy.Presence}}
max_presences                 :: OptionalNullable{Int}
vanity_url_code               :: OptionalNullable{String}
description                   :: OptionalNullable{String}
banner                        :: OptionalNullable{String}
Ekztazy.HandlerType
Handler(
    f::Function
    d::Dict{Symbol, Any}
)

Handler is a wrapper for a Dict{Symbol, Any} that also contains a function.

Ekztazy.HandlerMethod
Handler(; kwargs...) -> Handler

Generates a handler based on kwargs and a function.

Ekztazy.IntegrationType

A Guild integration. More details here.

Fields

id                  :: Snowflake
name                :: String
type                :: String
enabled             :: Bool
syncing             :: Bool
role_id             :: Snowflake
expire_behaviour    :: Int
expire_grace_period :: Int
user                :: Ekztazy.User
account             :: Ekztazy.IntegrationAccount
synced_at           :: DateTime
Ekztazy.InteractionType

An interaction. More details here.

Fields

id             :: Nullable{Snowflake}
application_id :: Nullable{Snowflake}
type           :: Int
data           :: OptionalNullable{Ekztazy.InteractionData}
guild_id       :: Optional{Snowflake}
channel_id     :: Optional{Snowflake}
member         :: Optional{Ekztazy.Member}
user           :: Optional{Ekztazy.User}
token          :: String
version        :: Optional{Int}
message        :: Optional{Ekztazy.Message}
Ekztazy.InteractionDataType

Data for an interaction. More details here.

Fields

id             :: OptionalNullable{Snowflake}
name           :: OptionalNullable{String}
type           :: OptionalNullable{Int}
resolved       :: Optional{Ekztazy.ResolvedData}
options        :: Optional{Vector{Ekztazy.ApplicationCommandOption}}
custom_id      :: OptionalNullable{String}
component_type :: OptionalNullable{Int}
components     :: OptionalNullable{Vector{Ekztazy.Component}}
values         :: Optional{Vector{String}}
target_id      :: Optional{Snowflake}
Ekztazy.InviteType

An invite to a Guild. More details here.

Fields

code                       :: String
guild                      :: Optional{Ekztazy.Guild}
channel                    :: Ekztazy.DiscordChannel
approximate_presence_cound :: Optional{Int}
approximate_member_count   :: Optional{Int}
Ekztazy.InviteMetadataType

Metadata for an Invite. More details here.

Fields

inviter    :: Ekztazy.User
uses       :: Int
max_uses   :: Int
max_age    :: Int
temporary  :: Bool
created_at :: DateTime
revoked    :: Bool
Ekztazy.MemberType

A Guild member. More details here.

Fields

user          :: Optional{Ekztazy.User}
nick          :: OptionalNullable{String}
roles         :: Vector{Snowflake}
joined_at     :: DateTime
premium_since :: OptionalNullable{DateTime}
deaf          :: Optional{Bool}
mute          :: Optional{Bool}
Ekztazy.MessageType

A message sent to a DiscordChannel. More details here.

Fields

id                :: Snowflake
channel_id        :: Snowflake
guild_id          :: Optional{Snowflake}
author            :: Optional{Ekztazy.User}
member            :: Optional{Ekztazy.Member}
content           :: Optional{String}
timestamp         :: Optional{DateTime}
edited_timestamp  :: OptionalNullable{DateTime}
tts               :: Optional{Bool}
mention_everyone  :: Optional{Bool}
mentions          :: Optional{Vector{Ekztazy.User}}
mention_roles     :: Optional{Vector{Snowflake}}
attachments       :: Optional{Vector{Ekztazy.Attachment}}
message_reference :: Optional{Ekztazy.MessageReference}
embeds            :: Optional{Vector{Ekztazy.Embed}}
reactions         :: Optional{Vector{Ekztazy.Reaction}}
nonce             :: OptionalNullable{Snowflake}
pinned            :: Optional{Bool}
webhook_id        :: Optional{Snowflake}
type              :: Optional{Int}
activity          :: Optional{Ekztazy.MessageActivity}
application       :: Optional{Ekztazy.MessageApplication}
Ekztazy.MessageApplicationType

A Rich Presence Message's application information. More details here.

Fields

id          :: Snowflake
cover_image :: Optional{String}
description :: String
icon        :: String
name        :: String
Ekztazy.OverwriteType

A permission overwrite. More details here.

Fields

id    :: Snowflake
type  :: Int
allow :: String
deny  :: String
Ekztazy.PresenceType

A User's presence. More details here.

Fields

user       :: Ekztazy.User
roles      :: Optional{Vector{Snowflake}}
game       :: Nullable{Ekztazy.Activity}
guild_id   :: Optional{Snowflake}
status     :: String
activities :: Vector{Ekztazy.Activity}
Ekztazy.ResponseType

A wrapper around a response from the REST API. Every function which wraps a Discord REST API endpoint returns a Future which will contain a value of this type. To retrieve the Response from the Future, use fetch. See also: fetchval.

Fields

  • val::Nullable{T}: The object contained in the HTTP response. For example, for a call to get_channel_message, this value will be a Message.
  • ok::Bool: The state of the request. If true, then it is safe to access val.
  • http_response::Nullable{HTTP.Messages.Response}: The underlying HTTP response, if a request was made.
  • exception::Nullable{Exception}: The caught exception, if one is thrown.

Examples

Multiple API calls which immediately return Futures and can be awaited:

futures = map(i -> create_message(c, channel_id; content=string(i)), 1:10);
other_work_here()
resps = fetch.(futures)

Skipping error checks and returning the value directly:

guild = fetchval(create_guild(c; name="foo"))
Ekztazy.RoleType

A User role. More details here.

Fields

id          :: Snowflake
name        :: String
color       :: Optional{Int}
hoist       :: Optional{Bool}
position    :: Optional{Int}
permissions :: Optional{String}
managed     :: Optional{Bool}
mentionable :: Optional{Bool}
Ekztazy.SelectOptionType

A select option. More details here.

Fields

label       :: String
value       :: String
description :: Optional{String}
emoji       :: Optional{Ekztazy.Emoji}
default     :: Optional{Bool}
Ekztazy.UnavailableGuildType

An unavailable Discord guild (server). More details here.

Fields

id          :: Snowflake
unavailable :: Optional{Bool}
Ekztazy.UserType

A Discord user. More details here.

Fields

id            :: Snowflake
username      :: Optional{String}
discriminator :: Optional{String}
avatar        :: OptionalNullable{String}
bot           :: Optional{Bool}
mfa_enabled   :: Optional{Bool}
locale        :: Optional{String}
verified      :: Optional{Bool}
email         :: OptionalNullable{String}
Ekztazy.VoiceRegionType

A region for a Guild's voice server. More details here.

Fields

id         :: String
name       :: String
vip        :: Bool
optimal    :: Bool
deprecated :: Bool
custom     :: Bool
Ekztazy.VoiceStateType

A User's voice connection status. More details here.

Fields

guild_id   :: Optional{Snowflake}
channel_id :: Nullable{Snowflake}
user_id    :: Snowflake
member     :: Optional{Ekztazy.Member}
session_id :: String
deaf       :: Bool
mute       :: Bool
self_deaf  :: Bool
self_mute  :: Bool
suppress   :: Bool
Ekztazy.WebhookType

A Webhook. More details here.

Fields

id         :: Snowflake
guild_id   :: Optional{Snowflake}
channel_id :: Snowflake
user       :: Optional{Ekztazy.User}
name       :: Nullable{String}
avatar     :: Nullable{String}
token      :: Optional{String}
Base.isopenMethod
isopen(c::Client) -> Bool

Determine whether the Client is connected to the gateway.

Base.openMethod
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.

Ekztazy.OptionMethod
Option(; kwargs...) -> ApplicationCommandOption

Helper function that creates an ApplicationCommandOption`

Ekztazy.OptionsMethod
Options(args...) -> Vector{ApplicationCommandOption}

Calls Option on each Vector in the args.

Ekztazy.ack_interactionMethod
ack_interaction(c::Client, int_id::Snowflake, int_token::String; kwargs...)

Respond to an interaction with code 5.

Ekztazy.add_handler!Method
add_handler!(c::Client, handler::Handler)

Adds a handler to the client.

Ekztazy.add_handler!Method
add_handler!(c::Client, handler::Handler)

Bulk adds handlers to the client.

Ekztazy.command!Method
command!(
    f::Function
    c::Client
    name::AbstractString
    description::AbstractString;
    kwargs...
)

Adds a handler for INTERACTION CREATE gateway events where the InteractionData's name field matches name. Adds this command to c.commands or c.guild_commands based on the presence of guild. The f parameter signature should be:

    (ctx::Context, args...) -> Any 

Where args is a list of all the Command Options

For example a command that takes a user u and a number n as input should have this signature:

(ctx::Context, u::User, n::Int) -> Any

and the arguments would automatically get converted.

Note: The argument names must match the Option names. The arguments can be ordered in any way. If no type is specified, no conversion will be performed, so Discord objects will be Snowflakes.

Ekztazy.component!Method
component!(
    f::Function
    c::Client
    custom_id::AbstractString
    kwargs...
)

Adds a handler for INTERACTION CREATE gateway events where the InteractionData's custom_id field matches custom_id. The f parameter signature should be:

(ctx::Context) -> Any 
Ekztazy.contextMethod
context(t::Symbol, data::Dict{Symbol, Any}) -> Context

Checks if the Context needs to be created in a special way based on the event provided by t.

Then, returns the generated context.

Ekztazy.createFunction
create(c::Client, ::Type{T}, args...; kwargs...) -> Future{Response}

Create, add, send, etc.

Examples

Sending a Message:

create(c, Message, channel; content="foo")

Creating a new DiscordChannel:

create(c, DiscordChannel, guild; name="bar")

Banning a Member:

create(c, Ban, guild, member; reason="baz")
Ekztazy.create_followup_messageMethod
create_followup_message(c::Client, int_id::Snowflake, int_token::String; kwargs...) -> Message

Creates a followup message for an interaction.

Ekztazy.create_reactionMethod
create_reaction(c::Client, channel::Integer, message::Integer, emoji::StringOrChar)

React to a Message. If emoji is a custom Emoji, it should be formatted "name:id".

Ekztazy.deleteFunction
delete(c::Client, x::T, args...) -> Future{Response}

Delete, remove, discard, etc.

Examples

Kicking a Member:

delete(c, member)

Unbanning a Member:

delete(c, ban, guild)

Deleting all Reactions from a Message (note: this is the only update/delete method which takes a type parameter):

delete(c, Reaction, message)
Ekztazy.disable_cache!Method
disable_cache!(c::Client)
disable_cache!(f::Function, c::Client)

Disable the cache. do syntax is also accepted.

Ekztazy.edit_interactionMethod
edit_interaction(c::Client, int_id::Snowflake, int_token::String; kwargs...)

Edit a followup message for an interaction.

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

Enable the cache. do syntax is also accepted.

Ekztazy.execute_webhookMethod
execute_webhook(
    c::Client,
    webhook::Integer,
    token::AbstractString;
    wait::Bool=false,
    kwargs...,
) -> Message

Execute a Webhook. If wait is not set, no Message is returned. More details here.

Ekztazy.extopsMethod

Return an empty Dict if the list of options used is missing.

Ekztazy.extopsMethod
extops(ops::Vector)

Creates a Dict of option name -> option value for the given vector of ApplicationCommandOption. If the option is of Subcommand type, creates a dict for all its subcommands.

Ekztazy.fetchvalMethod
fetchval(f::Future{Response{T}}) -> Nullable{T}

Shortcut for fetch(f).val: Fetch a Response and return its value. Note that there are no guarantees about the response's success and the value being returned, and it discards context that can be useful for debugging, such as HTTP responses and caught exceptions.

Ekztazy.filter_rangesMethod
filter_ranges(u::Vector{UnitRange{Int}})

Filter a list of ranges, discarding ranges included in other ranges from the list.

Example

julia> Ekztazy.filter_ranges([1:5, 3:8, 1:20, 2:16, 10:70, 25:60, 5:35, 50:90, 10:70])
4-element Vector{UnitRange{Int64}}:
 1:20
 5:35
 50:90
 10:70
Ekztazy.get_reactionsMethod
get_reactions(
    c::Client,
    channel::Integer,
    message::Integer,
    emoji::StringOrChar,
) -> Vector{User}

Get the Users who reacted to a Message with an Emoji.

Ekztazy.get_vanity_urlMethod
get_vanity_url(c::Client, guild::Integer) -> Invite

Get a Guild's vanity URL, if it supports that feature.

Ekztazy.handleMethod

Calls handle with a list of all found handlers.

Ekztazy.handleMethod
handle(
    c::Client
    handlers,
    data
)

Determines whether handlers are appropriate to call and calls them if so. Creates an AbstractContext based on the event using the data provided and passes it to the handler.

Ekztazy.has_permissionMethod
has_permission(perms::Integer, perm::Permission) -> Bool

Determine whether a bitwise OR of permissions contains one Permission.

Examples

julia> has_permission(0x0420, PERM_VIEW_CHANNEL)
true

julia> has_permission(0x0420, PERM_ADMINISTRATOR)
false

julia> has_permission(0x0008, PERM_MANAGE_ROLES)
true
Ekztazy.heartbeat_pingMethod
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.

Ekztazy.ismeMethod
isme(c::Client, ctx::Context) -> Bool

Returns whether the context is a Message Context sent by the bot user.

Ekztazy.obtainMethod
obtain(c::Client, ::Type{T}, args...; kwargs...) -> T

Equivalent to retrieve, but blocks and returns the object of type T

Ekztazy.on_channel_create!Method
on_channel_create!(
    f::Function
    c::Client
)

Adds a handler for the CHANNEL_CREATE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_channel_delete!Method
on_channel_delete!(
    f::Function
    c::Client
)

Adds a handler for the CHANNEL_DELETE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_channel_pins_update!Method
on_channel_pins_update!(
    f::Function
    c::Client
)

Adds a handler for the CHANNEL_PINS_UPDATE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_channel_update!Method
on_channel_update!(
    f::Function
    c::Client
)

Adds a handler for the CHANNEL_UPDATE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_guild_ban_add!Method
on_guild_ban_add!(
    f::Function
    c::Client
)

Adds a handler for the GUILD_BAN_ADD gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_guild_ban_remove!Method
on_guild_ban_remove!(
    f::Function
    c::Client
)

Adds a handler for the GUILD_BAN_REMOVE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_guild_create!Method
on_guild_create!(
    f::Function
    c::Client
)

Adds a handler for the GUILD_CREATE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_guild_delete!Method
on_guild_delete!(
    f::Function
    c::Client
)

Adds a handler for the GUILD_DELETE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_guild_emojis_update!Method
on_guild_emojis_update!(
    f::Function
    c::Client
)

Adds a handler for the GUILD_EMOJIS_UPDATE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_guild_integrations_update!Method
on_guild_integrations_update!(
    f::Function
    c::Client
)

Adds a handler for the GUILD_INTEGRATIONS_UPDATE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_guild_member_add!Method
on_guild_member_add!(
    f::Function
    c::Client
)

Adds a handler for the GUILD_MEMBER_ADD gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_guild_member_remove!Method
on_guild_member_remove!(
    f::Function
    c::Client
)

Adds a handler for the GUILD_MEMBER_REMOVE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_guild_member_update!Method
on_guild_member_update!(
    f::Function
    c::Client
)

Adds a handler for the GUILD_MEMBER_UPDATE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_guild_members_chunk!Method
on_guild_members_chunk!(
    f::Function
    c::Client
)

Adds a handler for the GUILD_MEMBERS_CHUNK gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_guild_role_create!Method
on_guild_role_create!(
    f::Function
    c::Client
)

Adds a handler for the GUILD_ROLE_CREATE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_guild_role_delete!Method
on_guild_role_delete!(
    f::Function
    c::Client
)

Adds a handler for the GUILD_ROLE_DELETE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_guild_role_update!Method
on_guild_role_update!(
    f::Function
    c::Client
)

Adds a handler for the GUILD_ROLE_UPDATE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_guild_update!Method
on_guild_update!(
    f::Function
    c::Client
)

Adds a handler for the GUILD_UPDATE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_interaction_create!Method
on_interaction_create!(
    f::Function
    c::Client
)

Adds a handler for the INTERACTION_CREATE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_message_create!Method
on_message_create!(
    f::Function
    c::Client
)

Adds a handler for the MESSAGE_CREATE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_message_delete!Method
on_message_delete!(
    f::Function
    c::Client
)

Adds a handler for the MESSAGE_DELETE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_message_delete_bulk!Method
on_message_delete_bulk!(
    f::Function
    c::Client
)

Adds a handler for the MESSAGE_DELETE_BULK gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_message_reaction_add!Method
on_message_reaction_add!(
    f::Function
    c::Client
)

Adds a handler for the MESSAGE_REACTION_ADD gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_message_reaction_remove!Method
on_message_reaction_remove!(
    f::Function
    c::Client
)

Adds a handler for the MESSAGE_REACTION_REMOVE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_message_reaction_remove_all!Method
on_message_reaction_remove_all!(
    f::Function
    c::Client
)

Adds a handler for the MESSAGE_REACTION_REMOVE_ALL gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_message_update!Method
on_message_update!(
    f::Function
    c::Client
)

Adds a handler for the MESSAGE_UPDATE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_presence_update!Method
on_presence_update!(
    f::Function
    c::Client
)

Adds a handler for the PRESENCE_UPDATE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_ready!Method
on_ready!(
    f::Function
    c::Client
)

Adds a handler for the READY gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_resumed!Method
on_resumed!(
    f::Function
    c::Client
)

Adds a handler for the RESUMED gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_typing_start!Method
on_typing_start!(
    f::Function
    c::Client
)

Adds a handler for the TYPING_START gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_user_update!Method
on_user_update!(
    f::Function
    c::Client
)

Adds a handler for the USER_UPDATE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_voice_server_update!Method
on_voice_server_update!(
    f::Function
    c::Client
)

Adds a handler for the VOICE_SERVER_UPDATE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_voice_state_update!Method
on_voice_state_update!(
    f::Function
    c::Client
)

Adds a handler for the VOICE_STATE_UPDATE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.on_webhooks_update!Method
on_webhooks_update!(
    f::Function
    c::Client
)

Adds a handler for the WEBHOOKS_UPDATE gateway event. The f parameter's signature should be:

    (ctx::Context) -> Any 
Ekztazy.optMethod
opt(ctx::Context)

Helper function that is equivalent to calling extops(ctx.interaction.data.options)

Ekztazy.plaintextMethod
plaintext(m::Message) -> String
plaintext(c::Client, m::Message) -> String

Get the Message contents with any User mentions replaced with their plaintext. If a Client is provided, DiscordChannels Role are also replaced. However, only channels and roles stored in state are replaced; no API requests are made.

Ekztazy.respond_to_interactionMethod
respond_to_interaction(c::Client, int_id::Snowflake, int_token::String; kwargs...) -> Message

Respond to an interaction with code 4.

Ekztazy.retrieveFunction
retrieve(c::Client, ::Type{T}, args...; kwargs...) -> Future{Response{T}}

Retrieve, get, list, etc.

Examples

Getting the Client's User:

retrieve(c, User)

Getting a Guild's DiscordChannels:

retrieve(c, DiscordChannel, guild)

Getting an Invite to a Guild by code:

retrieve(c, Invite, "abcdef")
Ekztazy.select!Method
select!(
    f::Function
    c::Client
    custom_id::AbstractString
    args::Vector{Tuple}
    kwargs...
)

Adds a handler for INTERACTION CREATE gateway events where the InteractionData's custom_id field matches custom_id. The f parameter signature should be:

(ctx::Context, choices::Vector{String}) -> Any 
Ekztazy.set_gameMethod
set_game(
    c::Client,
    game::AbstractString;
    type::Int=AT.GAME,
    since::Nullable{Int}=c.presence["since"],
    status::Union{PresenceStatus, AbstractString}=c.presence["status"],
    afk::Bool=c.presence["afk"],
    kwargs...,
) -> Bool

Shortcut for update_status to set the Client's Activity. Any additional keywords are passed into the activity section.

Ekztazy.split_messageMethod
split_message(text::AbstractString; chunk_limit::UInt=2000,
              extrastyles::Vector{Regex}=Vector{Regex}(),
              forcesplit::Bool = true) -> Vector{String}

Split a message into chunks with at most chunk_limit length, preserving formatting.

The chunk_limit has as default the 2000 character limit of Discord's messages, but can be changed to any nonnegative integer.

Formatting is specified by STYLES) and can be aggregated with the extrastyles argument.

Discord limits messages to 2000, so the code forces split if format breaking cannot be avoided. If desired, however, this behavior can be lifter by setting forcesplit to false.

Examples

julia> split_message("foo")
1-element Vector{String}:
 "foo"

julia> split_message(repeat('.', 1995) * "**hello, world**")[2]
"**hello, world**"

julia> split_message("**hello**, *world*", chunk_limit=10)
2-element Vector{String}:
 "**hello**,"
 "*world*"

julia> split_message("**hello**, _*beautiful* world_", chunk_limit=15)
┌ Warning: message was forced-split to fit the desired chunk length limit 15
└ @ Main REPL[66]:28
3-element Vector{String}:
 "**hello**,"
 "_*beautiful* wo"
 "rld_"

julia> split_message("**hello**, _*beautiful* world_", chunk_limit=15, forcesplit=false)
┌ Warning: message could not be split into chunks smaller than the length limit 15
└ @ Main REPL[66]:32
2-element Vector{String}:
 "**hello**,"
 "_*beautiful* world_"

julia> split_message("**hello**\n=====\n", chunk_limit=12)
2-element Vector{String}:
 "**hello**\n=="
 "==="
  
julia> split_message("**hello**\n≡≡≡≡≡\n", chunk_limit=12, extrastyles = [r"\n≡+\n"])
2-element Vector{String}:
 "**hello**"
 "≡≡≡≡≡"
Ekztazy.updateFunction
update(c::Client, x::T, args...; kwargs...) -> Future{Response}

Update, edit, modify, etc.

Examples

Editing a Message:

update(c, message; content="foo2")

Modifying a Webhook:

update(c, webhook; name="bar2")

Updating a Role:

update(c, role, guild; permissions=8)
Ekztazy.update_ack_interactionMethod
update_ack_interaction(c::Client, int_id::Snowflake, int_token::String; kwargs...) -> Message

Respond to an interaction with code 6.

Ekztazy.update_message_intMethod
update_message_int(c::Client, int_id::Snowflake, int_token::String; kwargs...)

Respond to an interaction with code 7.

Ekztazy.update_statusMethod
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.

Ekztazy.update_voice_stateMethod
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.

Ekztazy.@deferred_fetchMacro
@deferred_fetch [functions...] block

Identical to @fetch, but Futures are not fetched until the end of the block. This is more efficient, but only works when there are no data dependencies in the block.

Examples

This will work:

@deferred_fetch begin
    guild_resp = create(c, Guild; name="foo")
    channel_resp = retrieve(c, DiscordChannel, 123)
end

This will not, because the second call is dependent on the first value:

@deferred_fetch begin
    guild_resp = create(c, Guild; name="foo")
    channels_resp = retrieve(c, DiscordChannel, guild_resp.val)
end
Ekztazy.@fetchMacro
@fetch [functions...] block

Wrap all calls to the specified CRUD functions (create, retrieve, update, and delete) with fetch inside a block. If no functions are specified, all CRUD functions are wrapped.

Examples

Wrapping all CRUD functions:

@fetch begin
    guild_resp = create(c, Guild; name="foo")
    guild_resp.ok || error("Request for new guild failed")
    channel_resp = retrieve(c, DiscordChannel, guild_resp.val)
end

Wrapping only calls to retrieve:

@fetch retrieve begin
    resp = retrieve(c, DiscordChannel, 123)
    future = create(c, Message, resp.val; content="foo")  # Behaves normally.
end