Ekztazy.STYLES
— ConstantRegex expressions for split_message
to not break Discord formatting.
Ekztazy.AbstractGuild
— TypeA Discord guild (server). Can either be an UnavailableGuild
or a Guild
.
Ekztazy.Activity
— TypeA 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.ActivityAssets
— TypeEkztazy.ActivityEmoji
— TypeEkztazy.ActivityParty
— TypeEkztazy.ActivitySecrets
— TypeEkztazy.ActivityTimestamps
— TypeEkztazy.ApplicationCommand
— TypeAn 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.ApplicationCommandChoice
— TypeEkztazy.ApplicationCommandOption
— TypeApplication 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.Attachment
— TypeEkztazy.AuditLog
— TypeAn audit log. More details here.
Fields
webhooks :: Vector{Ekztazy.Webhook}
users :: Vector{Ekztazy.User}
audit_log_entries :: Vector{Ekztazy.AuditLogEntry}
Ekztazy.AuditLogChange
— TypeA 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.AuditLogEntry
— TypeEkztazy.AuditLogOptions
— TypeOptional 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.Ban
— TypeEkztazy.CacheFilter
— TypeCacheFilter(f::Function) -> CacheFilter
Only store value v
at key k
if f(v) === true
(k
is always v.id
).
Ekztazy.CacheForever
— TypeCacheForever() -> CacheForever
Store everything and never evict items from the cache.
Ekztazy.CacheLRU
— TypeCacheLRU(size::Int) -> CacheLRU
Evict the least recently used item from the cache when there are more than size
items.
Ekztazy.CacheNever
— TypeCacheNever() -> CacheNever
Don't store anything in the cache.
Ekztazy.CacheStrategy
— TypeA method of handling cache insertion and eviction.
Ekztazy.CacheTTL
— TypeCacheTTL(ttl::Period) -> CacheTTL
Evict items from the cache after ttl
has elapsed.
Ekztazy.Client
— TypeClient(
token::String
application_id::Snowflake
intents::Int;
presence::Union{Dict, NamedTuple}=Dict(),
strategies::Dict{DataType, <:CacheStrategy}=Dict(),
version::Int=9,
) -> Client
A Discord bot. Client
s 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 Message
s, 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.Component
— TypeAn 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.Connection
— TypeEkztazy.Context
— TypeContext(
data::Dict{Symbol, Any}
)
Context is a wrapper for a Dict{Symbol, Any}
with some special functionality.
Ekztazy.Context
— MethodContext(; kwargs...) -> Context
Generates a context based on kwargs.
Ekztazy.DiscordChannel
— TypeA 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.Embed
— TypeA 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.EmbedAuthor
— TypeEkztazy.EmbedField
— TypeEkztazy.EmbedFooter
— TypeEkztazy.EmbedImage
— TypeEkztazy.EmbedProvider
— TypeEkztazy.EmbedThumbnail
— TypeEkztazy.EmbedVideo
— TypeEkztazy.Emoji
— TypeAn 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.Guild
— TypeA 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.GuildEmbed
— TypeEkztazy.Handler
— TypeHandler(
f::Function
d::Dict{Symbol, Any}
)
Handler is a wrapper for a Dict{Symbol, Any}
that also contains a function.
Ekztazy.Handler
— MethodHandler(; kwargs...) -> Handler
Generates a handler based on kwargs and a function.
Ekztazy.Integration
— TypeEkztazy.IntegrationAccount
— TypeEkztazy.Interaction
— TypeAn 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.InteractionData
— TypeData 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.Invite
— TypeEkztazy.InviteMetadata
— TypeEkztazy.Member
— TypeEkztazy.Message
— TypeA 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.MessageActivity
— TypeEkztazy.MessageApplication
— TypeEkztazy.Overwrite
— TypeA permission overwrite. More details here.
Fields
id :: Snowflake
type :: Int
allow :: String
deny :: String
Ekztazy.Permission
— TypeBitwise permission flags. More details here.
Ekztazy.Presence
— TypeEkztazy.Reaction
— TypeEkztazy.Response
— TypeA 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 toget_channel_message
, this value will be aMessage
.ok::Bool
: The state of the request. Iftrue
, then it is safe to accessval
.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 Future
s 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.Role
— TypeEkztazy.SelectOption
— TypeA select option. More details here.
Fields
label :: String
value :: String
description :: Optional{String}
emoji :: Optional{Ekztazy.Emoji}
default :: Optional{Bool}
Ekztazy.UnavailableGuild
— TypeAn unavailable Discord guild (server). More details here.
Fields
id :: Snowflake
unavailable :: Optional{Bool}
Ekztazy.User
— TypeA 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.VoiceRegion
— TypeEkztazy.VoiceState
— TypeEkztazy.Webhook
— TypeA 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.close
— Methodclose(c::Client)
Disconnect the Client
from the gateway.
Base.isopen
— Methodisopen(c::Client) -> Bool
Determine whether the Client
is connected to the gateway.
Base.open
— Methodopen(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.
Base.wait
— Methodwait(c::Client)
Wait for an open Client
to close.
Ekztazy.Option
— MethodOption(; kwargs...) -> ApplicationCommandOption
Helper function that creates an ApplicationCommandOption`
Ekztazy.Options
— MethodOptions(args...) -> Vector{ApplicationCommandOption}
Calls Option
on each Vector in the args.
Ekztazy.ack_interaction
— Methodack_interaction(c::Client, int_id::Snowflake, int_token::String; kwargs...)
Respond to an interaction with code 5.
Ekztazy.add_guild_member
— MethodEkztazy.add_guild_member_role
— MethodEkztazy.add_handler!
— Methodadd_handler!(c::Client, handler::Handler)
Adds a handler to the client.
Ekztazy.add_handler!
— Methodadd_handler!(c::Client, handler::Handler)
Bulk adds handlers to the client.
Ekztazy.add_pinned_channel_message
— Methodadd_pinned_channel_message(c::Client, channel::Integer, message::Integer)
Pin a Message
in a DiscordChannel
.
Ekztazy.begin_guild_prune
— MethodEkztazy.bulk_delete_messages
— MethodEkztazy.bulk_overwrite_application_commands
— Methodbulk_overwrite_application_commands(c::Client, guild::Snowflake, cmds::Vector{ApplicationCommand}) -> Vector{ApplicationCommand}
Overwrites global ApplicationCommand
s with the given cmds vector.
Ekztazy.bulk_overwrite_application_commands
— Methodbulk_overwrite_application_commands(c::Client, guild::Snowflake, cmds::Vector{ApplicationCommand}) -> Vector{ApplicationCommand}
Overwrites guild ApplicationCommand
s with the given cmds vector.
Ekztazy.command!
— Methodcommand!(
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 Snowflake
s.
Ekztazy.component!
— Methodcomponent!(
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.context
— Methodcontext(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.create
— Functioncreate(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_application_command
— Methodcreate_application_command(c::Client, guild::Snowflake; kwargs...) -> ApplicationCommand
Creates a guild ApplicationCommand
.
Ekztazy.create_application_command
— Methodcreate_application_command(c::Client; kwargs...) -> ApplicationCommand
Creates a global ApplicationCommand
.
Ekztazy.create_channel_invite
— Methodcreate_channel_invite(c::Client, channel::Integer; kwargs...) -> Invite
Create an Invite
to a DiscordChannel
. More details here.
Ekztazy.create_dm
— Methodcreate_dm(c::Client; kwargs...) -> DiscordChannel
Create a DM DiscordChannel
. More details here.
Ekztazy.create_followup_message
— Methodcreate_followup_message(c::Client, int_id::Snowflake, int_token::String; kwargs...) -> Message
Creates a followup message for an interaction.
Ekztazy.create_guild
— MethodEkztazy.create_guild_ban
— MethodEkztazy.create_guild_channel
— Methodcreate_guild_channel(c::Client, guild::Integer; kwargs...) -> DiscordChannel
Create a DiscordChannel
in a Guild
. More details here.
Ekztazy.create_guild_emoji
— MethodEkztazy.create_guild_integration
— Methodcreate_guild_integration(c::Client, guild::Integer; kwargs...)
Create/attach an Integration
to a Guild
. More details here.
Ekztazy.create_guild_role
— MethodEkztazy.create_message
— Methodcreate_message(c::Client, channel::Integer; kwargs...) -> Message
Send a Message
to a DiscordChannel
. More details here.
Ekztazy.create_reaction
— MethodEkztazy.create_webhook
— Methodcreate_webhook(c::Client, channel::Integer; kwargs...) -> Webhook
Create a Webhook
in a DiscordChannel
. More details here.
Ekztazy.delete
— Functiondelete(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 Reaction
s from a Message
(note: this is the only update/delete method which takes a type parameter):
delete(c, Reaction, message)
Ekztazy.delete_all_reactions
— Methoddelete_all_reactions(c::Client, channel::Integer, message::Integer)
Delete all reactions from a Message
.
Ekztazy.delete_channel
— Methoddelete_channel(c::Client, channel::Integer) -> DiscordChannel
Delete a DiscordChannel
.
Ekztazy.delete_channel_permission
— Methoddelete_channel_permission(c::Client, channel::Integer, overwrite::Integer)
Delete an Overwrite
from a DiscordChannel
.
Ekztazy.delete_guild
— Methoddelete_guild(c::Client, guild::Integer)
Delete a Guild
.
Ekztazy.delete_guild_emoji
— MethodEkztazy.delete_guild_integration
— Methoddelete_guild_integration(c::Client, guild::Integer, integration::Integer)
Delete an Integration
from a Guild
.
Ekztazy.delete_guild_role
— MethodEkztazy.delete_invite
— MethodEkztazy.delete_message
— Methoddelete_message(c::Client, channel::Integer, message::Integer)
Delete a Message
.
Ekztazy.delete_own_reaction
— MethodEkztazy.delete_pinned_channel_message
— Methoddelete_pinned_channel_message(c::Client, channel::Integer, message::Integer)
Unpin a Message
from a DiscordChannel
.
Ekztazy.delete_user_reaction
— MethodEkztazy.delete_webhook
— Methoddelete_webhook(c::Client, webhook::Integer)
Delete a Webhook
.
Ekztazy.delete_webhook_with_token
— Methoddelete_webhook_with_token(c::Client, webhook::Integer, token::AbstractString)
Delete a Webhook
with a token.
Ekztazy.disable_cache!
— Methoddisable_cache!(c::Client)
disable_cache!(f::Function, c::Client)
Disable the cache. do
syntax is also accepted.
Ekztazy.edit_channel_permissions
— Methodedit_channel_permissions(
c::Client,
channel::Integer,
overwrite::Integer;
kwargs...,
)
Edit permissions for a DiscordChannel
. More details here.
Ekztazy.edit_interaction
— Methodedit_interaction(c::Client, int_id::Snowflake, int_token::String; kwargs...)
Edit a followup message for an interaction.
Ekztazy.edit_message
— MethodEkztazy.enable_cache!
— Methodenable_cache!(c::Client)
enable_cache!(f::Function c::Client)
Enable the cache. do
syntax is also accepted.
Ekztazy.execute_github_compatible_webhook
— MethodEkztazy.execute_slack_compatible_webhook
— MethodEkztazy.execute_webhook
— MethodEkztazy.extops
— MethodReturn an empty Dict
if the list of options used is missing.
Ekztazy.extops
— Methodextops(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.fetchval
— Methodfetchval(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_ranges
— Methodfilter_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_application_commands
— Methodget_application_commands(c::Client, guild::Snowflake) -> Vector{ApplicationCommand}
Gets all guild ApplicationCommand
s for the logged in client.
Ekztazy.get_application_commands
— Methodget_application_commands(c::Client) -> Vector{ApplicationCommand}
Gets all global ApplicationCommand
s for the logged in client.
Ekztazy.get_channel
— Methodget_channel(c::Client, channel::Integer) -> DiscordChannel
Get a DiscordChannel
.
Ekztazy.get_channel_invites
— Methodget_channel_invites(c::Client, channel::Integer) -> Vector{Invite}
Get the Invite
s for a DiscordChannel
.
Ekztazy.get_channel_message
— Methodget_channel_message(c::Client, channel::Integer, message::Integer) -> Message
Get a Message
from a DiscordChannel
.
Ekztazy.get_channel_messages
— Methodget_channel_messages(c::Client, channel::Integer; kwargs...) -> Vector{Message}
Get a list of Message
s from a DiscordChannel
. More details here.
Ekztazy.get_channel_webhooks
— Methodget_channel_webhooks(c::Client, channel::Integer) -> Vector{Webhook}
Get a list of Webhook
s in a DiscordChannel
.
Ekztazy.get_current_user
— MethodEkztazy.get_current_user_guilds
— MethodEkztazy.get_guild
— Methodget_guild(c::Client, guild::Integer) -> Guild
Get a Guild
.
Ekztazy.get_guild_audit_log
— MethodEkztazy.get_guild_ban
— MethodEkztazy.get_guild_bans
— MethodEkztazy.get_guild_channels
— Methodget_guild_channels(c::Client, guild::Integer) -> Vector{DiscordChannel}
Get the DiscordChannel
s in a Guild
.
Ekztazy.get_guild_embed
— Methodget_guild_embed(c::Client, guild::Integer) -> GuildEmbed
Get a Guild
's GuildEmbed
.
Ekztazy.get_guild_emoji
— MethodEkztazy.get_guild_integrations
— Methodget_guild_integrations(c::Client, guild::Integer) -> Vector{Integration}
Get a list of Integration
s for a Guild
.
Ekztazy.get_guild_invites
— MethodEkztazy.get_guild_member
— MethodEkztazy.get_guild_prune_count
— MethodEkztazy.get_guild_roles
— MethodEkztazy.get_guild_voice_regions
— Methodget_guild_voice_regions(c::Client, guild::Integer) -> Vector{VoiceRegion}
Get a list of VoiceRegion
s for the Guild
.
Ekztazy.get_guild_webhooks
— MethodEkztazy.get_guild_widget_image
— MethodEkztazy.get_invite
— MethodEkztazy.get_pinned_messages
— Methodget_pinned_messages(c::Client, channel::Integer) -> Vector{Message}
Get the pinned Message
s in a DiscordChannel
.
Ekztazy.get_reactions
— MethodEkztazy.get_user
— Methodget_user(c::Client, user::Integer) -> User
Get a User
.
Ekztazy.get_vanity_url
— Methodget_vanity_url(c::Client, guild::Integer) -> Invite
Get a Guild
's vanity URL, if it supports that feature.
Ekztazy.get_webhook
— Methodget_webhook(c::Client, webhook::Integer) -> Webhook
Get a Webhook
.
Ekztazy.get_webhook_with_token
— Methodget_webhook_with_token(c::Client, webhook::Integer, token::AbstractString) -> Webhook
Get a Webhook
with a token.
Ekztazy.handle
— MethodCalls handle with a list of all found handlers.
Ekztazy.handle
— Methodhandle(
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_permission
— Methodhas_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_ping
— Methodheartbeat_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.isme
— Methodisme(c::Client, ctx::Context) -> Bool
Returns whether the context is a Message Context sent by the bot user.
Ekztazy.leave_guild
— Methodleave_guild(c::Client, guild::Integer)
Leave a Guild
.
Ekztazy.list_guild_emojis
— MethodEkztazy.list_guild_members
— MethodEkztazy.list_voice_regions
— Methodlist_voice_regions(c::Client) -> Vector{VoiceRegion}
Get a list of the VoiceRegion
s that can be used when creating Guild
s.
Ekztazy.me
— Methodme(c::Client) -> Nullable{User}
Get the Client
's bot user.
Ekztazy.mention
— Methodmention(
o::DiscordObject
)
Generates the plaintext mention for a User
, a Member
, a DiscordChannel
, a Role
, or a Context
Ekztazy.method_args
— Methodmethod_args(m::Method) -> Vector{Tuple{Symbol, Type}}
Ekztazy.modify_channel
— Methodmodify_channel(c::Client, channel::Integer; kwargs...) -> DiscordChannel
Modify a DiscordChannel
. More details here.
Ekztazy.modify_current_user
— MethodEkztazy.modify_current_user_nick
— MethodEkztazy.modify_guild
— MethodEkztazy.modify_guild_channel_positions
— Methodmodify_guild_channel_positions(c::Client, guild::Integer, positions...)
Modify the positions of DiscordChannel
s in a Guild
. More details here.
Ekztazy.modify_guild_embed
— Methodmodify_guild_embed(c::Client, guild::Integer; kwargs...) -> GuildEmbed
Modify a Guild
's GuildEmbed
. More details here.
Ekztazy.modify_guild_emoji
— MethodEkztazy.modify_guild_integration
— Methodmodify_guild_integration(c::Client, guild::Integer, integration::Integer; kwargs...)
Modify an Integration
in a Guild
. More details here.
Ekztazy.modify_guild_member
— MethodEkztazy.modify_guild_role
— MethodEkztazy.modify_guild_role_positions
— MethodEkztazy.modify_webhook
— MethodEkztazy.modify_webhook_with_token
— MethodEkztazy.obtain
— Methodobtain(c::Client, ::Type{T}, args...; kwargs...) -> T
Equivalent to retrieve, but blocks and returns the object of type T
Ekztazy.on_channel_create!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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!
— Methodon_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.opt
— Methodopt(ctx::Context)
Helper function that is equivalent to calling extops(ctx.interaction.data.options)
Ekztazy.opt
— MethodDeprecated, use Option
instead
Ekztazy.permissions_in
— Methodpermissions_in(m::Member, g::Guild, ch::DiscordChannel) -> Int64
Compute a Member
's Permission
s in a DiscordChannel
.
Ekztazy.plaintext
— Methodplaintext(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, DiscordChannel
s Role
are also replaced. However, only channels and roles stored in state are replaced; no API requests are made.
Ekztazy.remove_guild_ban
— MethodEkztazy.remove_guild_member
— MethodEkztazy.remove_guild_member_role
— MethodEkztazy.reply
— Methodreply(
c::Client
context;
kwargs...
)
Replies to a Context
, an Interaction
or a Message
.
Ekztazy.request_guild_members
— Methodrequest_guild_members(
c::Client,
guilds::Union{Integer, Vector{<:Integer};
query::AbstractString="",
limit::Int=0,
) -> Bool
Request offline guild members of one or more Guild
s. on_guild_members_chunk!
events are sent by the gateway in response. More details here.
Ekztazy.respond_to_interaction
— Methodrespond_to_interaction(c::Client, int_id::Snowflake, int_token::String; kwargs...) -> Message
Respond to an interaction with code 4.
Ekztazy.retrieve
— FunctionEkztazy.runhandler
— MethodRuns a handler with given context
Ekztazy.select!
— Methodselect!(
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_game
— Methodset_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_message
— Methodsplit_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.start
— Methodstart(c::Client)
Creates a handler to generate ApplicationCommand
s.
Creates handlers for GuildCreate events.
Calls open
then wait
on the Client
.
Ekztazy.sync_guild_integration
— Methodsync_guild_integration(c::Client, guild::Integer, integration::Integer)
Sync an Integration
in a Guild
.
Ekztazy.trigger_typing_indicator
— Methodtrigger_typing_indicator(c::Client, channel::Integer)
Trigger the typing indicator in a DiscordChannel
.
Ekztazy.update
— FunctionEkztazy.update_ack_interaction
— Methodupdate_ack_interaction(c::Client, int_id::Snowflake, int_token::String; kwargs...) -> Message
Respond to an interaction with code 6.
Ekztazy.update_message_int
— Methodupdate_message_int(c::Client, int_id::Snowflake, int_token::String; kwargs...)
Respond to an interaction with code 7.
Ekztazy.update_status
— Methodupdate_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_state
— Methodupdate_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.upload_file
— Methodupload_file(c::Client, ch::DiscordChannel, path::AbstractString; kwargs...) -> Message
Send a Message
with a file Attachment
. Any keywords are passed on to create_message
.
Ekztazy.@deferred_fetch
— Macro@deferred_fetch [functions...] block
Identical to @fetch
, but Future
s are not fetch
ed 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.@deferred_fetchval
— Macro@deferred_fetchval [functions...] block
Identical to @deferred_fetch
, but Future
s have fetchval
called on them instead of fetch
.
Ekztazy.@fetch
— Macro@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
Ekztazy.@fetchval
— Macro