Liking cljdoc? Tell your friends :D

discord-bot.core


add-guild-member-roleclj

(add-guild-member-role guild-id user-id role-id)

Assigns a role to a guild member. guild-id, user-id, and role-id are string snowflakes. Returns :ok on success.

Assigns a role to a guild member. guild-id, user-id, and role-id are string
snowflakes. Returns :ok on success.
raw docstring

bulk-delete-messagesclj

(bulk-delete-messages channel-id message-ids)

Deletes multiple messages from a channel. channel-id is a string snowflake. message-ids is a sequence of string snowflakes (2-100 messages, not older than 14 days). Returns :ok on success.

Deletes multiple messages from a channel. channel-id is a string snowflake.
message-ids is a sequence of string snowflakes (2-100 messages, not older
than 14 days). Returns :ok on success.
raw docstring

bulk-overwrite-global-commandsclj

(bulk-overwrite-global-commands app-id commands)

Replaces all global application commands with the provided list. app-id is a string snowflake. commands is a vector of command data maps. Returns a vector of the new command maps.

Replaces all global application commands with the provided list. app-id is
a string snowflake. commands is a vector of command data maps. Returns a
vector of the new command maps.
raw docstring

bulk-overwrite-guild-commandsclj

(bulk-overwrite-guild-commands app-id guild-id commands)

Replaces all application commands for a specific guild. app-id and guild-id are string snowflakes. commands is a vector of command data maps. Returns a vector of the new command maps.

Replaces all application commands for a specific guild. app-id and guild-id
are string snowflakes. commands is a vector of command data maps. Returns a
vector of the new command maps.
raw docstring

close-connectionclj

(close-connection)

Closes the WebSocket connection to Discord. Takes no arguments. May trigger auto-reconnect via the on-close handler unless intentionally-disconnected is set.

Closes the WebSocket connection to Discord. Takes no arguments. May trigger
auto-reconnect via the on-close handler unless intentionally-disconnected is set.
raw docstring

create-channelclj

(create-channel guild-id params)

Creates a new channel in a guild. guild-id is a string snowflake. params is a map with at minimum {:name "channel-name"} and optionally :type, :topic, :parent_id, etc. Returns the created channel map.

Creates a new channel in a guild. guild-id is a string snowflake. params
is a map with at minimum {:name "channel-name"} and optionally :type,
:topic, :parent_id, etc. Returns the created channel map.
raw docstring

create-followup-messageclj

(create-followup-message app-id interaction-token message-data)

Sends a followup message to an interaction. app-id is a string snowflake. interaction-token is a string. message-data is a map with :content and/or :embeds. Returns the created message map.

Sends a followup message to an interaction. app-id is a string snowflake.
interaction-token is a string. message-data is a map with :content and/or
:embeds. Returns the created message map.
raw docstring

create-guild-roleclj

(create-guild-role guild-id params)

Creates a new role in a guild. guild-id is a string snowflake. params is a map (e.g. {:name "Mod" :color 0x00FF00 :permissions "8"}). Returns the created role map.

Creates a new role in a guild. guild-id is a string snowflake. params is
a map (e.g. {:name "Mod" :color 0x00FF00 :permissions "8"}).
Returns the created role map.
raw docstring

create-reactionclj

(create-reaction channel-id message-id emoji)

Adds a reaction to a message as the bot user. channel-id and message-id are string snowflakes. emoji is a URL-encoded string (e.g. "%F0%9F%94%A5" or "custom_emoji:123456"). Returns :ok on success.

Adds a reaction to a message as the bot user. channel-id and message-id
are string snowflakes. emoji is a URL-encoded string (e.g. "%F0%9F%94%A5"
or "custom_emoji:123456"). Returns :ok on success.
raw docstring

delete-channelclj

(delete-channel channel-id)

Deletes a channel. channel-id is a string snowflake. Returns the deleted channel map.

Deletes a channel. channel-id is a string snowflake. Returns the
deleted channel map.
raw docstring

delete-global-commandclj

(delete-global-command app-id command-id)

Deletes a global application command. app-id and command-id are string snowflakes. Returns :ok on success.

Deletes a global application command. app-id and command-id are string
snowflakes. Returns :ok on success.
raw docstring

delete-guild-commandclj

(delete-guild-command app-id guild-id command-id)

Deletes a guild-specific application command. app-id, guild-id, and command-id are string snowflakes. Returns :ok on success.

Deletes a guild-specific application command. app-id, guild-id, and
command-id are string snowflakes. Returns :ok on success.
raw docstring

delete-guild-roleclj

(delete-guild-role guild-id role-id)

Deletes a role from a guild. guild-id and role-id are string snowflakes. Returns :ok on success.

Deletes a role from a guild. guild-id and role-id are string snowflakes.
Returns :ok on success.
raw docstring

delete-messageclj

(delete-message channel-id message-id)

Deletes a message from a channel. channel-id and message-id are string snowflakes. Returns :ok on success.

Deletes a message from a channel. channel-id and message-id are string
snowflakes. Returns :ok on success.
raw docstring

delete-original-responseclj

(delete-original-response app-id interaction-token)

Deletes the original interaction response. app-id is a string snowflake. interaction-token is a string. Returns :ok on success.

Deletes the original interaction response. app-id is a string snowflake.
interaction-token is a string. Returns :ok on success.
raw docstring

delete-own-reactionclj

(delete-own-reaction channel-id message-id emoji)

Removes the bot's own reaction from a message. channel-id and message-id are string snowflakes. emoji is a URL-encoded string. Returns :ok on success.

Removes the bot's own reaction from a message. channel-id and message-id
are string snowflakes. emoji is a URL-encoded string. Returns :ok on success.
raw docstring

delete-user-reactionclj

(delete-user-reaction channel-id message-id emoji user-id)

Removes another user's reaction from a message. channel-id, message-id, and user-id are string snowflakes. emoji is a URL-encoded string. Returns :ok on success.

Removes another user's reaction from a message. channel-id, message-id,
and user-id are string snowflakes. emoji is a URL-encoded string.
Returns :ok on success.
raw docstring

edit-messageclj

(edit-message channel-id message-id params)

Edits an existing message. channel-id and message-id are string snowflakes. params is a map of fields to update (e.g. {:content "edited"}). Returns the updated message map.

Edits an existing message. channel-id and message-id are string snowflakes.
params is a map of fields to update (e.g. {:content "edited"}).
Returns the updated message map.
raw docstring

edit-original-responseclj

(edit-original-response app-id interaction-token message-data)

Edits the original interaction response. app-id is a string snowflake. interaction-token is a string. message-data is a map of fields to update. Returns the updated message map.

Edits the original interaction response. app-id is a string snowflake.
interaction-token is a string. message-data is a map of fields to update.
Returns the updated message map.
raw docstring

get-channelclj

(get-channel channel-id)

Fetches a channel by ID. channel-id is a string snowflake. Returns a channel map with :id, :name, :type, :guild_id, etc.

Fetches a channel by ID. channel-id is a string snowflake.
Returns a channel map with :id, :name, :type, :guild_id, etc.
raw docstring

get-channel-messageclj

(get-channel-message channel-id message-id)

Fetches a single message from a channel. channel-id and message-id are string snowflakes. Returns a message map with :id, :content, :author, etc.

Fetches a single message from a channel. channel-id and message-id are
string snowflakes. Returns a message map with :id, :content, :author, etc.
raw docstring

get-channel-messagesclj

(get-channel-messages channel-id & [query-params])

Fetches messages from a channel. channel-id is a string snowflake. query-params is an optional map for pagination, e.g. {:limit 50 :before id}. Returns a vector of message maps.

Fetches messages from a channel. channel-id is a string snowflake.
query-params is an optional map for pagination, e.g. {:limit 50 :before id}.
Returns a vector of message maps.
raw docstring

get-channelsclj

(get-channels server-id)

Fetches all channels for a guild and groups them by type. server-id is a string snowflake. Returns a map: {:text [channel-maps ...] :voice [channel-maps ...] :parents [channel-maps ...]} where each channel map has :name, :id, and :type.

Fetches all channels for a guild and groups them by type.
server-id is a string snowflake. Returns a map:
  {:text    [channel-maps ...]
   :voice   [channel-maps ...]
   :parents [channel-maps ...]}
where each channel map has :name, :id, and :type.
raw docstring

get-guildclj

(get-guild guild-id)

Fetches a guild by ID. guild-id is a string snowflake. Returns a guild map with :id, :name, :icon, :owner_id, :roles, etc.

Fetches a guild by ID. guild-id is a string snowflake. Returns a guild map
with :id, :name, :icon, :owner_id, :roles, etc.
raw docstring

get-guild-memberclj

(get-guild-member guild-id user-id)

Fetches a guild member. guild-id and user-id are string snowflakes. Returns a member map with :user, :nick, :roles, :joined_at, etc.

Fetches a guild member. guild-id and user-id are string snowflakes.
Returns a member map with :user, :nick, :roles, :joined_at, etc.
raw docstring

get-guild-rolesclj

(get-guild-roles guild-id)

Lists all roles in a guild. guild-id is a string snowflake. Returns a vector of role maps with :id, :name, :color, :permissions, etc.

Lists all roles in a guild. guild-id is a string snowflake. Returns a
vector of role maps with :id, :name, :color, :permissions, etc.
raw docstring

get-presencesclj

(get-presences)

Returns the presences for the connected guild as a vector of presence maps, each containing :user, :status, :activities, etc. Returns nil if no guild data has been received yet.

Returns the presences for the connected guild as a vector of presence maps,
each containing :user, :status, :activities, etc. Returns nil if no guild
data has been received yet.
raw docstring

get-reactionsclj

(get-reactions channel-id message-id emoji & [query-params])

Fetches users who reacted with a given emoji on a message. channel-id and message-id are string snowflakes. emoji is a URL-encoded string. query-params is an optional map (e.g. {:limit 25 :after user-id}). Returns a vector of user maps.

Fetches users who reacted with a given emoji on a message. channel-id and
message-id are string snowflakes. emoji is a URL-encoded string.
query-params is an optional map (e.g. {:limit 25 :after user-id}).
Returns a vector of user maps.
raw docstring

get-user-by-idclj

(get-user-by-id user-id)

Looks up a guild member by their user ID. user-id is a string snowflake. Returns the member map (containing :user, :roles, :nick, etc.) or nil if not found.

Looks up a guild member by their user ID. user-id is a string snowflake.
Returns the member map (containing :user, :roles, :nick, etc.) or nil if
not found.
raw docstring

initclj

(init & [opts resume?])

Opens a WebSocket connection to Discord and begins handling gateway events. Both arguments are optional.

opts - a map of event callback functions, keyed by: :on-message-create, :on-presence-update, :on-typing-start, :on-channel-create, :on-channel-delete, :on-voice-state-update, :on-message-update, :on-message-reaction-add, :on-guild-member-update, :on-guild-member-remove, :on-guild-role-delete, :on-interaction-create Each callback receives the event data map as its sole argument. Also accepts :intents (integer bitfield for gateway intents).

resume? - boolean, when true resumes an existing session instead of sending a fresh Identify.

Returns the WebSocket connection object.

Opens a WebSocket connection to Discord and begins handling gateway events.
Both arguments are optional.

opts - a map of event callback functions, keyed by:
  :on-message-create, :on-presence-update, :on-typing-start,
  :on-channel-create, :on-channel-delete, :on-voice-state-update,
  :on-message-update, :on-message-reaction-add, :on-guild-member-update,
  :on-guild-member-remove, :on-guild-role-delete, :on-interaction-create
  Each callback receives the event data map as its sole argument.
  Also accepts :intents (integer bitfield for gateway intents).

resume? - boolean, when true resumes an existing session instead of
  sending a fresh Identify.

Returns the WebSocket connection object.
raw docstring

list-global-commandsclj

(list-global-commands app-id)

Lists all global application commands. app-id is a string snowflake. Returns a vector of command maps.

Lists all global application commands. app-id is a string snowflake.
Returns a vector of command maps.
raw docstring

list-guild-commandsclj

(list-guild-commands app-id guild-id)

Lists all application commands for a specific guild. app-id and guild-id are string snowflakes. Returns a vector of command maps.

Lists all application commands for a specific guild. app-id and guild-id
are string snowflakes. Returns a vector of command maps.
raw docstring

list-guild-membersclj

(list-guild-members guild-id & [query-params])

Lists members of a guild. guild-id is a string snowflake. query-params is an optional map (e.g. {:limit 100 :after user-id}). Returns a vector of member maps.

Lists members of a guild. guild-id is a string snowflake. query-params is
an optional map (e.g. {:limit 100 :after user-id}). Returns a vector of
member maps.
raw docstring

modify-channelclj

(modify-channel channel-id params)

Updates a channel's settings. channel-id is a string snowflake. params is a map of fields to change (e.g. {:name "new-name" :topic "new topic"}). Returns the updated channel map.

Updates a channel's settings. channel-id is a string snowflake. params is
a map of fields to change (e.g. {:name "new-name" :topic "new topic"}).
Returns the updated channel map.
raw docstring

modify-guildclj

(modify-guild guild-id params)

Updates a guild's settings. guild-id is a string snowflake. params is a map of fields to change (e.g. {:name "new name"}). Returns the updated guild map.

Updates a guild's settings. guild-id is a string snowflake. params is a map
of fields to change (e.g. {:name "new name"}). Returns the updated guild map.
raw docstring

modify-guild-memberclj

(modify-guild-member guild-id user-id params)

Updates a guild member's attributes. guild-id and user-id are string snowflakes. params is a map of fields to change (e.g. {:nick "new nick"}). Returns the updated member map.

Updates a guild member's attributes. guild-id and user-id are string
snowflakes. params is a map of fields to change (e.g. {:nick "new nick"}).
Returns the updated member map.
raw docstring

modify-guild-roleclj

(modify-guild-role guild-id role-id params)

Updates a role's attributes. guild-id and role-id are string snowflakes. params is a map of fields to change. Returns the updated role map.

Updates a role's attributes. guild-id and role-id are string snowflakes.
params is a map of fields to change. Returns the updated role map.
raw docstring

register-global-commandclj

(register-global-command app-id command-data)

Registers an application command globally (available in all guilds). app-id is a string snowflake. command-data is a map with :name, :description, and optionally :options (vector of option maps). Returns the created command map.

Registers an application command globally (available in all guilds).
app-id is a string snowflake. command-data is a map with :name, :description,
and optionally :options (vector of option maps). Returns the created command map.
raw docstring

register-guild-commandclj

(register-guild-command app-id guild-id command-data)

Registers an application command for a specific guild. app-id and guild-id are string snowflakes. command-data is a map with :name, :description, and optionally :options. Returns the created command map.

Registers an application command for a specific guild. app-id and guild-id
are string snowflakes. command-data is a map with :name, :description, and
optionally :options. Returns the created command map.
raw docstring

remove-guild-memberclj

(remove-guild-member guild-id user-id)

Kicks a member from a guild. guild-id and user-id are string snowflakes. Returns :ok on success.

Kicks a member from a guild. guild-id and user-id are string snowflakes.
Returns :ok on success.
raw docstring

remove-guild-member-roleclj

(remove-guild-member-role guild-id user-id role-id)

Removes a role from a guild member. guild-id, user-id, and role-id are string snowflakes. Returns :ok on success.

Removes a role from a guild member. guild-id, user-id, and role-id are
string snowflakes. Returns :ok on success.
raw docstring

respond-to-interactionclj

(respond-to-interaction interaction-id interaction-token callback-type & [data])

Sends a response to an interaction. interaction-id is a string snowflake. interaction-token is a string. callback-type is either a keyword (:channel-message-with-source, :deferred-channel-message-with-source, :update-message, :deferred-update-message, :autocomplete-result, :modal, :pong) or a raw integer. data is an optional map (e.g. {:content "hi"}). Returns the API response map.

Sends a response to an interaction. interaction-id is a string snowflake.
interaction-token is a string. callback-type is either a keyword
(:channel-message-with-source, :deferred-channel-message-with-source,
:update-message, :deferred-update-message, :autocomplete-result, :modal,
:pong) or a raw integer. data is an optional map (e.g. {:content "hi"}).
Returns the API response map.
raw docstring

send-channel-messageclj

(send-channel-message channel-id params)

Sends a message to a channel. channel-id is a string snowflake. params is a map with :content (string) and/or :embeds (vector of embed maps). Returns the created message map.

Sends a message to a channel. channel-id is a string snowflake. params is
a map with :content (string) and/or :embeds (vector of embed maps).
Returns the created message map.
raw docstring

server-stateclj

Atom holding the current guild state. Deref to get the guild map containing :members, :channels, :presences, etc.

Atom holding the current guild state. Deref to get the guild map
containing :members, :channels, :presences, etc.
raw docstring

started-new-game?clj

(started-new-game? current-game new-game)

Returns true if the game changed between two presence activity entries. current-game and new-game are maps with a :name key (or nil). Returns boolean.

Returns true if the game changed between two presence activity entries.
current-game and new-game are maps with a :name key (or nil). Returns boolean.
raw docstring

stopclj

(stop)

Gracefully disconnects from Discord without triggering auto-reconnect. Takes no arguments. Returns nil.

Gracefully disconnects from Discord without triggering auto-reconnect.
Takes no arguments. Returns nil.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close