@abyss-project/runtime 3.1.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -20,15 +20,19 @@ The host sends the names `collectGlobalReferences(definition, 'config')` finds.
20
20
 
21
21
  A host that grants the `DiscordCapability` names (`discord.reply`, `discord.update`,
22
22
  `discord.showModal`, `discord.followUp`, `discord.sendMessage`, `discord.editMessage`,
23
- `discord.deleteMessage`, `discord.addRole`, `discord.removeRole`, `discord.sendDirectMessage`) gives
24
- the client code `abyss.discord.<name>(...)`, one helper per granted capability:
23
+ `discord.deleteMessage`, `discord.addRole`, `discord.removeRole`, `discord.sendDirectMessage`) lets the
24
+ client code call `abyss.discord.<name>(...)`. Every helper always exists; one whose capability the
25
+ function does not declare rejects with an error naming the action to declare:
25
26
 
26
27
  - `reply(message)`, `update(message)`, `followUp(message)`, `showModal({ customId, title, fields })`
27
28
  - `sendMessage(channelId, message)`, `editMessage(channelId, messageId, message)`,
28
29
  `deleteMessage(channelId, messageId)`, `sendDirectMessage(userId, message)`
29
30
  - `addRole(guildId, userId, roleId)`, `removeRole(guildId, userId, roleId)`
30
31
 
31
- `message` is a `DiscordMessage` (`{ content?, embeds?, components?, ephemeral? }`). The `args` of
32
+ `message` is a `DiscordMessage` (`{ content?, embeds?, components?, ephemeral?, allowedMentions? }`).
33
+ By default a message pings the users it mentions and nobody else: `@everyone`, `@here` and roles
34
+ stay plain text. `allowedMentions` (`DiscordAllowedMentions`: `parse` of `DiscordMentionType`
35
+ values, `users`, `roles`, `repliedUser`) replaces that default. The `args` of
32
36
  each host `call` are the types `Discord*Args` (a `DiscordMessage` itself for `reply`, `update`,
33
37
  `followUp`). A host failing a call with the message `<DiscordErrorCode>: <detail>` (or the bare
34
38
  code) makes the helper throw an `Error` named `DiscordError` with `code` and `message` set; any
@@ -21,11 +21,23 @@ export declare enum DiscordErrorCode {
21
21
  export type DiscordJsonObject = {
22
22
  [key: string]: JSONValue;
23
23
  };
24
+ export declare enum DiscordMentionType {
25
+ USERS = "users",
26
+ ROLES = "roles",
27
+ EVERYONE = "everyone"
28
+ }
29
+ export interface DiscordAllowedMentions {
30
+ parse?: DiscordMentionType[];
31
+ users?: string[];
32
+ roles?: string[];
33
+ repliedUser?: boolean;
34
+ }
24
35
  export interface DiscordMessage {
25
36
  content?: string;
26
37
  embeds?: DiscordJsonObject[];
27
38
  components?: DiscordJsonObject[];
28
39
  ephemeral?: boolean;
40
+ allowedMentions?: DiscordAllowedMentions;
29
41
  }
30
42
  export declare enum DiscordModalFieldStyle {
31
43
  SHORT = "SHORT",
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EPHEMERAL_FLAG = exports.DiscordCallbackType = exports.DiscordInteractionType = exports.DiscordInteractionKind = exports.DiscordModalFieldStyle = exports.DiscordErrorCode = exports.DiscordCapability = void 0;
3
+ exports.EPHEMERAL_FLAG = exports.DiscordCallbackType = exports.DiscordInteractionType = exports.DiscordInteractionKind = exports.DiscordModalFieldStyle = exports.DiscordMentionType = exports.DiscordErrorCode = exports.DiscordCapability = void 0;
4
4
  var DiscordCapability;
5
5
  (function (DiscordCapability) {
6
6
  DiscordCapability["REPLY"] = "discord.reply";
@@ -22,6 +22,12 @@ var DiscordErrorCode;
22
22
  DiscordErrorCode["DISCORD_NOT_FOUND"] = "DISCORD_NOT_FOUND";
23
23
  DiscordErrorCode["DISCORD_RATE_LIMITED"] = "DISCORD_RATE_LIMITED";
24
24
  })(DiscordErrorCode || (exports.DiscordErrorCode = DiscordErrorCode = {}));
25
+ var DiscordMentionType;
26
+ (function (DiscordMentionType) {
27
+ DiscordMentionType["USERS"] = "users";
28
+ DiscordMentionType["ROLES"] = "roles";
29
+ DiscordMentionType["EVERYONE"] = "everyone";
30
+ })(DiscordMentionType || (exports.DiscordMentionType = DiscordMentionType = {}));
25
31
  var DiscordModalFieldStyle;
26
32
  (function (DiscordModalFieldStyle) {
27
33
  DiscordModalFieldStyle["SHORT"] = "SHORT";
@@ -1 +1 @@
1
- {"version":3,"file":"discord.types.js","sourceRoot":"","sources":["../../src/discord/discord.types.ts"],"names":[],"mappings":";;;AAOA,IAAY,iBAqBX;AArBD,WAAY,iBAAiB;IAE3B,4CAAuB,CAAA;IAEvB,8CAAyB,CAAA;IAEzB,qDAAgC,CAAA;IAEhC,mDAA8B,CAAA;IAE9B,yDAAoC,CAAA;IAEpC,yDAAoC,CAAA;IAEpC,6DAAwC,CAAA;IAExC,iDAA4B,CAAA;IAE5B,uDAAkC,CAAA;IAElC,sEAAiD,CAAA;AACnD,CAAC,EArBW,iBAAiB,iCAAjB,iBAAiB,QAqB5B;AAOD,IAAY,gBAWX;AAXD,WAAY,gBAAgB;IAE1B,qDAAiC,CAAA;IAEjC,mEAA+C,CAAA;IAE/C,2DAAuC,CAAA;IAEvC,2DAAuC,CAAA;IAEvC,iEAA6C,CAAA;AAC/C,CAAC,EAXW,gBAAgB,gCAAhB,gBAAgB,QAW3B;AAcD,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,iDAAuB,CAAA;AACzB,CAAC,EAHW,sBAAsB,sCAAtB,sBAAsB,QAGjC;AA+CD,IAAY,sBAIX;AAJD,WAAY,sBAAsB;IAChC,6CAAmB,CAAA;IACnB,iDAAuB,CAAA;IACvB,yCAAe,CAAA;AACjB,CAAC,EAJW,sBAAsB,sCAAtB,sBAAsB,QAIjC;AAGD,IAAY,sBAKX;AALD,WAAY,sBAAsB;IAChC,mEAAQ,CAAA;IACR,iGAAuB,CAAA;IACvB,6FAAqB,CAAA;IACrB,mFAAgB,CAAA;AAClB,CAAC,EALW,sBAAsB,sCAAtB,sBAAsB,QAKjC;AAGD,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,6DAAQ,CAAA;IACR,2GAA+B,CAAA;IAC/B,6HAAwC,CAAA;IACxC,mGAA2B,CAAA;IAC3B,iFAAkB,CAAA;IAClB,+DAAS,CAAA;AACX,CAAC,EAPW,mBAAmB,mCAAnB,mBAAmB,QAO9B;AAGY,QAAA,cAAc,GAAG,EAAE,CAAC"}
1
+ {"version":3,"file":"discord.types.js","sourceRoot":"","sources":["../../src/discord/discord.types.ts"],"names":[],"mappings":";;;AAOA,IAAY,iBAqBX;AArBD,WAAY,iBAAiB;IAE3B,4CAAuB,CAAA;IAEvB,8CAAyB,CAAA;IAEzB,qDAAgC,CAAA;IAEhC,mDAA8B,CAAA;IAE9B,yDAAoC,CAAA;IAEpC,yDAAoC,CAAA;IAEpC,6DAAwC,CAAA;IAExC,iDAA4B,CAAA;IAE5B,uDAAkC,CAAA;IAElC,sEAAiD,CAAA;AACnD,CAAC,EArBW,iBAAiB,iCAAjB,iBAAiB,QAqB5B;AAOD,IAAY,gBAWX;AAXD,WAAY,gBAAgB;IAE1B,qDAAiC,CAAA;IAEjC,mEAA+C,CAAA;IAE/C,2DAAuC,CAAA;IAEvC,2DAAuC,CAAA;IAEvC,iEAA6C,CAAA;AAC/C,CAAC,EAXW,gBAAgB,gCAAhB,gBAAgB,QAW3B;AASD,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,qCAAe,CAAA;IACf,qCAAe,CAAA;IACf,2CAAqB,CAAA;AACvB,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,QAI7B;AA2BD,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,iDAAuB,CAAA;AACzB,CAAC,EAHW,sBAAsB,sCAAtB,sBAAsB,QAGjC;AA+CD,IAAY,sBAIX;AAJD,WAAY,sBAAsB;IAChC,6CAAmB,CAAA;IACnB,iDAAuB,CAAA;IACvB,yCAAe,CAAA;AACjB,CAAC,EAJW,sBAAsB,sCAAtB,sBAAsB,QAIjC;AAGD,IAAY,sBAKX;AALD,WAAY,sBAAsB;IAChC,mEAAQ,CAAA;IACR,iGAAuB,CAAA;IACvB,6FAAqB,CAAA;IACrB,mFAAgB,CAAA;AAClB,CAAC,EALW,sBAAsB,sCAAtB,sBAAsB,QAKjC;AAGD,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,6DAAQ,CAAA;IACR,2GAA+B,CAAA;IAC/B,6HAAwC,CAAA;IACxC,mGAA2B,CAAA;IAC3B,iFAAkB,CAAA;IAClB,+DAAS,CAAA;AACX,CAAC,EAPW,mBAAmB,mCAAnB,mBAAmB,QAO9B;AAGY,QAAA,cAAc,GAAG,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abyss-project/runtime",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "Abyss automation core: definitions, interpreter, runner protocol",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,155 +1,181 @@
1
- import type { JSONValue } from '../runner-protocol/execution-protocol.types';
2
-
3
- /**
4
- * Host capabilities of a Discord bot Service. The host declares them in the execution's
5
- * capabilities; client code reaches them through `abyss.discord.<name>(...)`, each helper existing
6
- * only when its capability is granted. The argument shapes below are the `args` of the `call`.
7
- */
8
- export enum DiscordCapability {
9
- /** Answers the interaction. Arguments: a `DiscordMessage`. */
10
- REPLY = 'discord.reply',
11
- /** Edits the message a component interaction came from. Arguments: a `DiscordMessage`. */
12
- UPDATE = 'discord.update',
13
- /** Opens a modal, before the interaction is acknowledged. Arguments: `DiscordShowModalArgs`. */
14
- SHOW_MODAL = 'discord.showModal',
15
- /** Sends an additional message for the interaction. Arguments: a `DiscordMessage`. */
16
- FOLLOW_UP = 'discord.followUp',
17
- /** Posts a message in a channel as the bot. Arguments: `DiscordSendMessageArgs`. */
18
- SEND_MESSAGE = 'discord.sendMessage',
19
- /** Edits a message of the bot. Arguments: `DiscordEditMessageArgs`. */
20
- EDIT_MESSAGE = 'discord.editMessage',
21
- /** Deletes a message. Arguments: `DiscordDeleteMessageArgs`. */
22
- DELETE_MESSAGE = 'discord.deleteMessage',
23
- /** Gives a role to a member. Arguments: `DiscordRoleArgs`. */
24
- ADD_ROLE = 'discord.addRole',
25
- /** Takes a role from a member. Arguments: `DiscordRoleArgs`. */
26
- REMOVE_ROLE = 'discord.removeRole',
27
- /** Sends a direct message to a user. Arguments: `DiscordSendDirectMessageArgs`. */
28
- SEND_DIRECT_MESSAGE = 'discord.sendDirectMessage',
29
- }
30
-
31
- /**
32
- * Codes of the errors `abyss.discord.*` throws. The host fails the call with the message
33
- * `<code>: <detail>` (or the bare code); the helper rethrows an `Error` named `DiscordError`
34
- * whose `code` is the code and whose `message` is the detail.
35
- */
36
- export enum DiscordErrorCode {
37
- /** `showModal` after the interaction was acknowledged (more than 2.5 s after it arrived). */
38
- MODAL_TOO_LATE = 'MODAL_TOO_LATE',
39
- /** The bot's token is refused (circuit breaker open): no call was made to Discord. */
40
- DISCORD_TOKEN_INVALID = 'DISCORD_TOKEN_INVALID',
41
- /** Discord answered 403. */
42
- DISCORD_FORBIDDEN = 'DISCORD_FORBIDDEN',
43
- /** Discord answered 404. */
44
- DISCORD_NOT_FOUND = 'DISCORD_NOT_FOUND',
45
- /** Discord answered 429. */
46
- DISCORD_RATE_LIMITED = 'DISCORD_RATE_LIMITED',
47
- }
48
-
49
- /** Embed and component payloads are Discord's own JSON, relayed as is. */
50
- export type DiscordJsonObject = { [key: string]: JSONValue };
51
-
52
- export interface DiscordMessage {
53
- content?: string;
54
- embeds?: DiscordJsonObject[];
55
- components?: DiscordJsonObject[];
56
- /** Only the reply to an interaction can be ephemeral. */
57
- ephemeral?: boolean;
58
- }
59
-
60
- /** Text input style of a modal field. */
61
- export enum DiscordModalFieldStyle {
62
- SHORT = 'SHORT',
63
- PARAGRAPH = 'PARAGRAPH',
64
- }
65
-
66
- export interface DiscordModalField {
67
- customId: string;
68
- label: string;
69
- style?: DiscordModalFieldStyle;
70
- required?: boolean;
71
- placeholder?: string;
72
- value?: string;
73
- minLength?: number;
74
- maxLength?: number;
75
- }
76
-
77
- export interface DiscordShowModalArgs {
78
- customId: string;
79
- title: string;
80
- fields: DiscordModalField[];
81
- }
82
-
83
- export interface DiscordSendMessageArgs {
84
- channelId: string;
85
- message: DiscordMessage;
86
- }
87
-
88
- export interface DiscordEditMessageArgs {
89
- channelId: string;
90
- messageId: string;
91
- message: DiscordMessage;
92
- }
93
-
94
- export interface DiscordDeleteMessageArgs {
95
- channelId: string;
96
- messageId: string;
97
- }
98
-
99
- export interface DiscordRoleArgs {
100
- guildId: string;
101
- userId: string;
102
- roleId: string;
103
- }
104
-
105
- export interface DiscordSendDirectMessageArgs {
106
- userId: string;
107
- message: DiscordMessage;
108
- }
109
-
110
- /** The kind of interaction a function was started by. */
111
- export enum DiscordInteractionKind {
112
- COMMAND = 'COMMAND',
113
- COMPONENT = 'COMPONENT',
114
- MODAL = 'MODAL',
115
- }
116
-
117
- /** Discord's interaction types (`type` of the payload) a bot's edge serves. */
118
- export enum DiscordInteractionType {
119
- PING = 1,
120
- APPLICATION_COMMAND = 2,
121
- MESSAGE_COMPONENT = 3,
122
- MODAL_SUBMIT = 5,
123
- }
124
-
125
- /** Discord's interaction callback types the edge answers with. */
126
- export enum DiscordCallbackType {
127
- PONG = 1,
128
- CHANNEL_MESSAGE_WITH_SOURCE = 4,
129
- DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE = 5,
130
- DEFERRED_UPDATE_MESSAGE = 6,
131
- UPDATE_MESSAGE = 7,
132
- MODAL = 9,
133
- }
134
-
135
- /** Discord's message flag that makes a message visible to its recipient only. */
136
- export const EPHEMERAL_FLAG = 64;
137
-
138
- /**
139
- * The `input` of a function triggered by a Discord interaction. The interaction token never
140
- * appears here: it stays in the edge.
141
- */
142
- export interface DiscordInteractionInput {
143
- kind: DiscordInteractionKind;
144
- /** Resolved option values, by option name. */
145
- command?: { name: string; options: Record<string, string | number | boolean> };
146
- component?: { customId: string; values?: string[] };
147
- modal?: { customId: string; fields: Record<string, string> };
148
- user: { id: string; username: string; globalName: string | null };
149
- member?: { roles: string[]; permissions: string };
150
- guildId?: string;
151
- channelId?: string;
152
- locale: string;
153
- /** Discord's payload, without the interaction token. */
154
- interaction: { id: string; applicationId: string; type: number; data: JSONValue };
155
- }
1
+ import type { JSONValue } from '../runner-protocol/execution-protocol.types';
2
+
3
+ /**
4
+ * Host capabilities of a Discord bot Service. The host declares them in the execution's
5
+ * capabilities; client code reaches them through `abyss.discord.<name>(...)`; every helper exists,
6
+ * and one whose capability is not granted rejects with an error naming the action to declare. The argument shapes below are the `args` of the `call`.
7
+ */
8
+ export enum DiscordCapability {
9
+ /** Answers the interaction. Arguments: a `DiscordMessage`. */
10
+ REPLY = 'discord.reply',
11
+ /** Edits the message a component interaction came from. Arguments: a `DiscordMessage`. */
12
+ UPDATE = 'discord.update',
13
+ /** Opens a modal, before the interaction is acknowledged. Arguments: `DiscordShowModalArgs`. */
14
+ SHOW_MODAL = 'discord.showModal',
15
+ /** Sends an additional message for the interaction. Arguments: a `DiscordMessage`. */
16
+ FOLLOW_UP = 'discord.followUp',
17
+ /** Posts a message in a channel as the bot. Arguments: `DiscordSendMessageArgs`. */
18
+ SEND_MESSAGE = 'discord.sendMessage',
19
+ /** Edits a message of the bot. Arguments: `DiscordEditMessageArgs`. */
20
+ EDIT_MESSAGE = 'discord.editMessage',
21
+ /** Deletes a message. Arguments: `DiscordDeleteMessageArgs`. */
22
+ DELETE_MESSAGE = 'discord.deleteMessage',
23
+ /** Gives a role to a member. Arguments: `DiscordRoleArgs`. */
24
+ ADD_ROLE = 'discord.addRole',
25
+ /** Takes a role from a member. Arguments: `DiscordRoleArgs`. */
26
+ REMOVE_ROLE = 'discord.removeRole',
27
+ /** Sends a direct message to a user. Arguments: `DiscordSendDirectMessageArgs`. */
28
+ SEND_DIRECT_MESSAGE = 'discord.sendDirectMessage',
29
+ }
30
+
31
+ /**
32
+ * Codes of the errors `abyss.discord.*` throws. The host fails the call with the message
33
+ * `<code>: <detail>` (or the bare code); the helper rethrows an `Error` named `DiscordError`
34
+ * whose `code` is the code and whose `message` is the detail.
35
+ */
36
+ export enum DiscordErrorCode {
37
+ /** `showModal` after the interaction was acknowledged (more than 2.5 s after it arrived). */
38
+ MODAL_TOO_LATE = 'MODAL_TOO_LATE',
39
+ /** The bot's token is refused (circuit breaker open): no call was made to Discord. */
40
+ DISCORD_TOKEN_INVALID = 'DISCORD_TOKEN_INVALID',
41
+ /** Discord answered 403. */
42
+ DISCORD_FORBIDDEN = 'DISCORD_FORBIDDEN',
43
+ /** Discord answered 404. */
44
+ DISCORD_NOT_FOUND = 'DISCORD_NOT_FOUND',
45
+ /** Discord answered 429. */
46
+ DISCORD_RATE_LIMITED = 'DISCORD_RATE_LIMITED',
47
+ }
48
+
49
+ /** Embed and component payloads are Discord's own JSON, relayed as is. */
50
+ export type DiscordJsonObject = { [key: string]: JSONValue };
51
+
52
+ /**
53
+ * What a message may notify. `users` and `roles` let the mentions of every user or role ping;
54
+ * `everyone` lets `@everyone` and `@here` notify the whole server.
55
+ */
56
+ export enum DiscordMentionType {
57
+ USERS = 'users',
58
+ ROLES = 'roles',
59
+ EVERYONE = 'everyone',
60
+ }
61
+
62
+ /**
63
+ * Who a message may notify: Discord's `allowed_mentions` in camelCase. Without it a message pings
64
+ * the users it mentions and nobody else: `@everyone`, `@here` and roles stay plain text. An object
65
+ * replaces that default as a whole, so what it leaves out notifies nobody. `parse` allows every
66
+ * mention of a type; `users` and `roles` allow those ids only (at most 100 each). A type is given
67
+ * by `parse` or by its list, never both. `repliedUser` is Discord's reply ping.
68
+ */
69
+ export interface DiscordAllowedMentions {
70
+ parse?: DiscordMentionType[];
71
+ users?: string[];
72
+ roles?: string[];
73
+ repliedUser?: boolean;
74
+ }
75
+
76
+ export interface DiscordMessage {
77
+ content?: string;
78
+ embeds?: DiscordJsonObject[];
79
+ components?: DiscordJsonObject[];
80
+ /** Only the reply to an interaction can be ephemeral. */
81
+ ephemeral?: boolean;
82
+ /** Who the message may notify; by default the mentioned users only (see `DiscordAllowedMentions`). */
83
+ allowedMentions?: DiscordAllowedMentions;
84
+ }
85
+
86
+ /** Text input style of a modal field. */
87
+ export enum DiscordModalFieldStyle {
88
+ SHORT = 'SHORT',
89
+ PARAGRAPH = 'PARAGRAPH',
90
+ }
91
+
92
+ export interface DiscordModalField {
93
+ customId: string;
94
+ label: string;
95
+ style?: DiscordModalFieldStyle;
96
+ required?: boolean;
97
+ placeholder?: string;
98
+ value?: string;
99
+ minLength?: number;
100
+ maxLength?: number;
101
+ }
102
+
103
+ export interface DiscordShowModalArgs {
104
+ customId: string;
105
+ title: string;
106
+ fields: DiscordModalField[];
107
+ }
108
+
109
+ export interface DiscordSendMessageArgs {
110
+ channelId: string;
111
+ message: DiscordMessage;
112
+ }
113
+
114
+ export interface DiscordEditMessageArgs {
115
+ channelId: string;
116
+ messageId: string;
117
+ message: DiscordMessage;
118
+ }
119
+
120
+ export interface DiscordDeleteMessageArgs {
121
+ channelId: string;
122
+ messageId: string;
123
+ }
124
+
125
+ export interface DiscordRoleArgs {
126
+ guildId: string;
127
+ userId: string;
128
+ roleId: string;
129
+ }
130
+
131
+ export interface DiscordSendDirectMessageArgs {
132
+ userId: string;
133
+ message: DiscordMessage;
134
+ }
135
+
136
+ /** The kind of interaction a function was started by. */
137
+ export enum DiscordInteractionKind {
138
+ COMMAND = 'COMMAND',
139
+ COMPONENT = 'COMPONENT',
140
+ MODAL = 'MODAL',
141
+ }
142
+
143
+ /** Discord's interaction types (`type` of the payload) a bot's edge serves. */
144
+ export enum DiscordInteractionType {
145
+ PING = 1,
146
+ APPLICATION_COMMAND = 2,
147
+ MESSAGE_COMPONENT = 3,
148
+ MODAL_SUBMIT = 5,
149
+ }
150
+
151
+ /** Discord's interaction callback types the edge answers with. */
152
+ export enum DiscordCallbackType {
153
+ PONG = 1,
154
+ CHANNEL_MESSAGE_WITH_SOURCE = 4,
155
+ DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE = 5,
156
+ DEFERRED_UPDATE_MESSAGE = 6,
157
+ UPDATE_MESSAGE = 7,
158
+ MODAL = 9,
159
+ }
160
+
161
+ /** Discord's message flag that makes a message visible to its recipient only. */
162
+ export const EPHEMERAL_FLAG = 64;
163
+
164
+ /**
165
+ * The `input` of a function triggered by a Discord interaction. The interaction token never
166
+ * appears here: it stays in the edge.
167
+ */
168
+ export interface DiscordInteractionInput {
169
+ kind: DiscordInteractionKind;
170
+ /** Resolved option values, by option name. */
171
+ command?: { name: string; options: Record<string, string | number | boolean> };
172
+ component?: { customId: string; values?: string[] };
173
+ modal?: { customId: string; fields: Record<string, string> };
174
+ user: { id: string; username: string; globalName: string | null };
175
+ member?: { roles: string[]; permissions: string };
176
+ guildId?: string;
177
+ channelId?: string;
178
+ locale: string;
179
+ /** Discord's payload, without the interaction token. */
180
+ interaction: { id: string; applicationId: string; type: number; data: JSONValue };
181
+ }