REST API
Response
Ekztazy.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.fetchval
— Functionfetchval(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.
CRUD API
On top of functions for accessing individual endpoints such as get_channel_messages
, Ekztazy.jl also offers a unified API with just four functions. Named after the CRUD model, they cover most of the Discord REST API and allow you to write concise, expressive code, and forget about the subtleties of endpoint naming. The argument ordering convention is roughly as follows:
- A
Client
, always. - For cases when we don't yet have the entity to be manipulated (usually
create
andretrieve
), the entity's type. If we do have the entity (update
anddelete
), the entity itself. - The remaining positional arguments supply whatever context is needed to specify the entity. For example, sending a message requires a
DiscordChannel
parameter. - Keyword arguments follow (usually for
create
andupdate
).
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.retrieve
— Functionretrieve(c::Client, ::Type{T}, args...; kwargs...) -> Future{Response{T}}
Retrieve, get, list, etc.
Examples
retrieve(c, User)
Getting a Guild
's DiscordChannel
s:
retrieve(c, DiscordChannel, guild)
Getting an Invite
to a Guild
by code:
retrieve(c, Invite, "abcdef")
Ekztazy.update
— Functionupdate(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.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.obtain
— Functionobtain(c::Client, ::Type{T}, args...; kwargs...) -> T
Equivalent to retrieve, but blocks and returns the object of type T
The full list of types available to be manipulated is:
AuditLog
ApplicationCommand
Ban
DiscordChannel
Emoji
GuildEmbed
Guild
Integration
Invite
Member
Message
Overwrite
Reaction
Role
User
VoiceRegion
Webhook
Endpoints
Functions which wrap REST API endpoints are named and sorted according to the Discord API documentation. When a function accepts keyword arguments, the docstring will include a link to the Discord documentation which indicates the expected keys and values. Remember that the return types annotated below are not the actual return types, but the types of Response
that the returned Future
s will yield.
Audit Log
Ekztazy.get_guild_audit_log
— Functionget_guild_audit_log(c::Client, guild::Integer; kwargs...) -> AuditLog
Channel
Ekztazy.get_channel
— Functionget_channel(c::Client, channel::Integer) -> DiscordChannel
Get a DiscordChannel
.
Ekztazy.modify_channel
— Functionmodify_channel(c::Client, channel::Integer; kwargs...) -> DiscordChannel
Modify a DiscordChannel
. More details here.
Ekztazy.delete_channel
— Functiondelete_channel(c::Client, channel::Integer) -> DiscordChannel
Delete a DiscordChannel
.
Ekztazy.get_channel_messages
— Functionget_channel_messages(c::Client, channel::Integer; kwargs...) -> Vector{Message}
Get a list of Message
s from a DiscordChannel
. More details here.
Ekztazy.get_channel_message
— Functionget_channel_message(c::Client, channel::Integer, message::Integer) -> Message
Get a Message
from a DiscordChannel
.
Ekztazy.create_message
— Functioncreate_message(c::Client, channel::Integer; kwargs...) -> Message
Send a Message
to a DiscordChannel
. More details here.
Ekztazy.create_reaction
— Functioncreate_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.delete_own_reaction
— Functiondelete_own_reaction(c::Client, channel::Integer, message::Integer, emoji::StringOrChar)
Ekztazy.delete_user_reaction
— Functiondelete_user_reaction(
c::Client,
channel::Integer,
message::Integer,
emoji::StringOrChar,
user::Integer,
)
Ekztazy.get_reactions
— Functionget_reactions(
c::Client,
channel::Integer,
message::Integer,
emoji::StringOrChar,
) -> Vector{User}
Ekztazy.delete_all_reactions
— Functiondelete_all_reactions(c::Client, channel::Integer, message::Integer)
Delete all reactions from a Message
.
Ekztazy.edit_message
— Functionedit_message(c::Client, channel::Integer, message::Integer; kwargs...) -> Message
Ekztazy.delete_message
— Functiondelete_message(c::Client, channel::Integer, message::Integer)
Delete a Message
.
Ekztazy.bulk_delete_messages
— Functionbulk_delete_messages(c::Client, channel::Integer; kwargs...)
Ekztazy.edit_channel_permissions
— Functionedit_channel_permissions(
c::Client,
channel::Integer,
overwrite::Integer;
kwargs...,
)
Edit permissions for a DiscordChannel
. More details here.
Ekztazy.get_channel_invites
— Functionget_channel_invites(c::Client, channel::Integer) -> Vector{Invite}
Get the Invite
s for a DiscordChannel
.
Ekztazy.create_channel_invite
— Functioncreate_channel_invite(c::Client, channel::Integer; kwargs...) -> Invite
Create an Invite
to a DiscordChannel
. More details here.
Ekztazy.delete_channel_permission
— Functiondelete_channel_permission(c::Client, channel::Integer, overwrite::Integer)
Delete an Overwrite
from a DiscordChannel
.
Ekztazy.trigger_typing_indicator
— Functiontrigger_typing_indicator(c::Client, channel::Integer)
Trigger the typing indicator in a DiscordChannel
.
Ekztazy.get_pinned_messages
— Functionget_pinned_messages(c::Client, channel::Integer) -> Vector{Message}
Get the pinned Message
s in a DiscordChannel
.
Ekztazy.add_pinned_channel_message
— Functionadd_pinned_channel_message(c::Client, channel::Integer, message::Integer)
Pin a Message
in a DiscordChannel
.
Ekztazy.delete_pinned_channel_message
— Functiondelete_pinned_channel_message(c::Client, channel::Integer, message::Integer)
Unpin a Message
from a DiscordChannel
.
Emoji
Ekztazy.list_guild_emojis
— FunctionEkztazy.get_guild_emoji
— FunctionEkztazy.create_guild_emoji
— Functioncreate_guild_emoji(c::Client, guild::Integer; kwargs...) -> Emoji
Ekztazy.modify_guild_emoji
— Functionmodify_guild_emoji(c::Client, guild::Integer, emoji::Integer; kwargs...) -> Emoji
Ekztazy.delete_guild_emoji
— FunctionGuild
Ekztazy.create_guild
— FunctionEkztazy.get_guild
— Functionget_guild(c::Client, guild::Integer) -> Guild
Get a Guild
.
Ekztazy.modify_guild
— FunctionEkztazy.delete_guild
— Functiondelete_guild(c::Client, guild::Integer)
Delete a Guild
.
Ekztazy.get_guild_channels
— Functionget_guild_channels(c::Client, guild::Integer) -> Vector{DiscordChannel}
Get the DiscordChannel
s in a Guild
.
Ekztazy.create_guild_channel
— Functioncreate_guild_channel(c::Client, guild::Integer; kwargs...) -> DiscordChannel
Create a DiscordChannel
in a Guild
. More details here.
Ekztazy.modify_guild_channel_positions
— Functionmodify_guild_channel_positions(c::Client, guild::Integer, positions...)
Modify the positions of DiscordChannel
s in a Guild
. More details here.
Ekztazy.get_guild_member
— FunctionEkztazy.list_guild_members
— Functionlist_guild_members(c::Client, guild::Integer; kwargs...) -> Vector{Member}
Ekztazy.add_guild_member
— FunctionEkztazy.modify_guild_member
— Functionmodify_guild__member(c::Client, guild::Integer, user::Integer; kwargs...)
Ekztazy.modify_current_user_nick
— Functionmodify_current_user_nick(c::Client, guild::Intger; kwargs...) -> String
Modify the Client
user's nickname in a Guild
. More details here.
Ekztazy.add_guild_member_role
— Functionadd_guild_member_role(c::Client, guild::Integer, user::Integer, role::Integer)
Ekztazy.remove_guild_member_role
— Functionremove_guild_member_role(c::Client, guild::Integer, user::Integer, role::Integer)
Ekztazy.remove_guild_member
— FunctionEkztazy.get_guild_bans
— FunctionEkztazy.get_guild_ban
— FunctionEkztazy.create_guild_ban
— Functioncreate_guild_ban(c::Client, guild::Integer, user::Integer; kwargs...)
Ekztazy.remove_guild_ban
— FunctionEkztazy.get_guild_roles
— FunctionEkztazy.create_guild_role
— Functioncreate_guild_role(c::Client, guild::Integer; kwargs) -> Role
Ekztazy.modify_guild_role_positions
— Functionmodify_guild_role_positions(c::Client, guild::Integer, positions...) -> Vector{Role}
Modify the positions of Role
s in a Guild
. More details here.
Ekztazy.modify_guild_role
— Functionmodify_guild_role(c::Client, guild::Integer, role::Integer; kwargs) -> Role
Ekztazy.delete_guild_role
— FunctionEkztazy.get_guild_prune_count
— Functionget_guild_prune_count(c::Client, guild::Integer; kwargs...) -> Dict
Get the number of Member
s that would be removed from a Guild
in a prune. More details here.
Ekztazy.begin_guild_prune
— Functionbegin_guild_prune(c::Client, guild::Integer; kwargs...) -> Dict
Ekztazy.get_guild_voice_regions
— Functionget_guild_voice_regions(c::Client, guild::Integer) -> Vector{VoiceRegion}
Get a list of VoiceRegion
s for the Guild
.
Ekztazy.get_guild_invites
— FunctionEkztazy.get_guild_integrations
— Functionget_guild_integrations(c::Client, guild::Integer) -> Vector{Integration}
Get a list of Integration
s for a Guild
.
Ekztazy.create_guild_integration
— Functioncreate_guild_integration(c::Client, guild::Integer; kwargs...)
Create/attach an Integration
to a Guild
. More details here.
Ekztazy.modify_guild_integration
— Functionmodify_guild_integration(c::Client, guild::Integer, integration::Integer; kwargs...)
Modify an Integration
in a Guild
. More details here.
Ekztazy.delete_guild_integration
— Functiondelete_guild_integration(c::Client, guild::Integer, integration::Integer)
Delete an Integration
from a Guild
.
Ekztazy.sync_guild_integration
— Functionsync_guild_integration(c::Client, guild::Integer, integration::Integer)
Sync an Integration
in a Guild
.
Ekztazy.get_guild_embed
— Functionget_guild_embed(c::Client, guild::Integer) -> GuildEmbed
Get a Guild
's GuildEmbed
.
Ekztazy.modify_guild_embed
— Functionmodify_guild_embed(c::Client, guild::Integer; kwargs...) -> GuildEmbed
Modify a Guild
's GuildEmbed
. More details here.
Ekztazy.get_vanity_url
— Functionget_vanity_url(c::Client, guild::Integer) -> Invite
Get a Guild
's vanity URL, if it supports that feature.
Ekztazy.get_guild_widget_image
— Functionget_guild_widget_image(c::Client, guild::Integer; kwargs...) -> Vector{UInt8}
Get a Guild
's widget image in PNG format. More details here.
Invite
Ekztazy.get_invite
— Functionget_invite(c::Client, invite::AbstractString; kwargs...} -> Invite
Ekztazy.delete_invite
— FunctionUser
Ekztazy.get_current_user
— FunctionEkztazy.get_user
— Functionget_user(c::Client, user::Integer) -> User
Get a User
.
Ekztazy.modify_current_user
— FunctionEkztazy.get_current_user_guilds
— Functionget_user_guilds(c::Client; kwargs...) -> Vector{Guild}
Get a list of Guild
s the Client
User
is a member of. More details here.
Ekztazy.leave_guild
— Functionleave_guild(c::Client, guild::Integer)
Leave a Guild
.
Ekztazy.create_dm
— Functioncreate_dm(c::Client; kwargs...) -> DiscordChannel
Create a DM DiscordChannel
. More details here.
Voice
Ekztazy.list_voice_regions
— Functionlist_voice_regions(c::Client) -> Vector{VoiceRegion}
Get a list of the VoiceRegion
s that can be used when creating Guild
s.
Webhook
Ekztazy.create_webhook
— Functioncreate_webhook(c::Client, channel::Integer; kwargs...) -> Webhook
Create a Webhook
in a DiscordChannel
. More details here.
Ekztazy.get_channel_webhooks
— Functionget_channel_webhooks(c::Client, channel::Integer) -> Vector{Webhook}
Get a list of Webhook
s in a DiscordChannel
.
Ekztazy.get_guild_webhooks
— FunctionEkztazy.get_webhook
— Functionget_webhook(c::Client, webhook::Integer) -> Webhook
Get a Webhook
.
Ekztazy.get_webhook_with_token
— Functionget_webhook_with_token(c::Client, webhook::Integer, token::AbstractString) -> Webhook
Get a Webhook
with a token.
Ekztazy.modify_webhook
— Functionmodify_webhook(c::Client, webhook::Integer; kwargs...) -> Webhook
Ekztazy.modify_webhook_with_token
— Functionmodify_webhook_with_token(
c::Client,
webhook::Integer,
token::AbstractString;
kwargs...,
) -> Webhook
Ekztazy.delete_webhook
— Functiondelete_webhook(c::Client, webhook::Integer)
Delete a Webhook
.
Ekztazy.delete_webhook_with_token
— Functiondelete_webhook_with_token(c::Client, webhook::Integer, token::AbstractString)
Delete a Webhook
with a token.
Ekztazy.execute_webhook
— Functionexecute_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.execute_slack_compatible_webhook
— Functionexecute_slack_compatible_webhook(
c::Client,
webhook::Integer,
token::AbstractString;
wait::Bool=true,
kwargs...,
)
Ekztazy.execute_github_compatible_webhook
— Functionexecute_github_compatible_webhook(
c::Client,
webhook::Integer,
token::AbstractString;
wait::Bool=true,
kwargs...,
)
Interaction
Ekztazy.create_application_command
— Functioncreate_application_command(c::Client; kwargs...) -> ApplicationCommand
Creates a global ApplicationCommand
.
create_application_command(c::Client, guild::Snowflake; kwargs...) -> ApplicationCommand
Creates a guild ApplicationCommand
.
Ekztazy.get_application_commands
— Functionget_application_commands(c::Client) -> Vector{ApplicationCommand}
Gets all global ApplicationCommand
s for the logged in client.
get_application_commands(c::Client, guild::Snowflake) -> Vector{ApplicationCommand}
Gets all guild ApplicationCommand
s for the logged in client.
Ekztazy.respond_to_interaction
— Functionrespond_to_interaction(c::Client, int_id::Snowflake, int_token::String; kwargs...) -> Message
Respond to an interaction with code 4.
Ekztazy.create_followup_message
— Functioncreate_followup_message(c::Client, int_id::Snowflake, int_token::String; kwargs...) -> Message
Creates a followup message for an interaction.
Ekztazy.ack_interaction
— Functionack_interaction(c::Client, int_id::Snowflake, int_token::String; kwargs...)
Respond to an interaction with code 5.
Ekztazy.update_ack_interaction
— Functionupdate_ack_interaction(c::Client, int_id::Snowflake, int_token::String; kwargs...) -> Message
Respond to an interaction with code 6.
Ekztazy.update_message_int
— Functionupdate_message_int(c::Client, int_id::Snowflake, int_token::String; kwargs...)
Respond to an interaction with code 7.
Missing docstring for create_followup_message
. Check Documenter's build log for details.
Ekztazy.edit_interaction
— Functionedit_interaction(c::Client, int_id::Snowflake, int_token::String; kwargs...)
Edit a followup message for an interaction.
Ekztazy.bulk_overwrite_application_commands
— Functionbulk_overwrite_application_commands(c::Client, guild::Snowflake, cmds::Vector{ApplicationCommand}) -> Vector{ApplicationCommand}
Overwrites global ApplicationCommand
s with the given cmds vector.
bulk_overwrite_application_commands(c::Client, guild::Snowflake, cmds::Vector{ApplicationCommand}) -> Vector{ApplicationCommand}
Overwrites guild ApplicationCommand
s with the given cmds vector.