-
Notifications
You must be signed in to change notification settings - Fork 3
/
response.clj
33 lines (26 loc) · 856 Bytes
/
response.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
(ns slash.response
"Definitions and utilities for interaction responses.
Read https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object")
(def pong
"The PONG response (type 1)"
{:type 1})
(defn channel-message
"Respond to an interaction with a message - `data` is the message object (type 4)."
[data]
{:type 4
:data data})
(def deferred-channel-message
"Defer a message response (type 5)"
{:type 5})
(def deferred-update-message
"Defer a message update (only for component interactions - type 6)"
{:type 6})
(defn update-message
"Update the message - `data` is the message update (only for component interactions - type 7)"
[data]
{:type 7
:data data})
(defn ephemeral
"Takes an interaction response and makes it ephemeral."
[response]
(assoc-in response [:data :flags] 64))