@abyss-project/runtime 3.11.0 → 3.12.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/.prettierrc +5 -5
- package/README.md +88 -88
- package/dist/discord/discord.types.d.ts +34 -2
- package/dist/discord/discord.types.js +9 -1
- package/dist/discord/discord.types.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/surface.test.ts +7 -0
- package/src/discord/__tests__/discord-event-input.test.ts +18 -0
- package/src/discord/discord.types.ts +43 -1
package/.prettierrc
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{
|
|
2
|
-
"singleQuote": true,
|
|
3
|
-
"trailingComma": "all",
|
|
4
|
-
"printWidth": 100
|
|
5
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"singleQuote": true,
|
|
3
|
+
"trailingComma": "all",
|
|
4
|
+
"printWidth": 100
|
|
5
|
+
}
|
package/README.md
CHANGED
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
# @abyss-project/runtime
|
|
2
|
-
|
|
3
|
-
Abyss automation core: definitions, interpreter, execution protocol `abyss-runtime.v2` and
|
|
4
|
-
execution cost.
|
|
5
|
-
|
|
6
|
-
The package root (`@abyss-project/runtime`) is browser-compatible. Node-only code (the
|
|
7
|
-
`CodeRunnerSession` WebSocket client) lives under `@abyss-project/runtime/server`.
|
|
8
|
-
`@abyss-project/runtime/engine` exports `ENGINE_SOURCE`, the interpreter bundled into one
|
|
9
|
-
self-contained script for the code runner's isolate.
|
|
10
|
-
|
|
11
|
-
## Host globals
|
|
12
|
-
|
|
13
|
-
`ExecuteMessage.globals` gives the client code read-only globals: each top-level key becomes a
|
|
14
|
-
frozen global. Two keys are conventional: `secrets` (`{{ secrets.NAME }}` / `secrets.NAME`, masked
|
|
15
|
-
by the host) and `config` (`Record<string, string>`, the non-secret per-environment variables:
|
|
16
|
-
`{{ config.NAME }}` / `config.NAME`, not masked). A name the host did not send is `undefined`.
|
|
17
|
-
The host sends the names `collectGlobalReferences(definition, 'config')` finds.
|
|
18
|
-
|
|
19
|
-
## Discord helpers
|
|
20
|
-
|
|
21
|
-
A host that grants the `DiscordCapability` names (`discord.reply`, `discord.update`,
|
|
22
|
-
`discord.showModal`, `discord.followUp`, `discord.sendMessage`, `discord.editMessage`,
|
|
23
|
-
`discord.deleteMessage`, `discord.addRole`, `discord.removeRole`, `discord.sendDirectMessage`,
|
|
24
|
-
`discord.getMember`, `discord.getGuildRoles`, `discord.getChannel`, `discord.getGuild`) lets the
|
|
25
|
-
client code call `abyss.discord.<name>(...)`. Every helper always exists; one whose capability the
|
|
26
|
-
function does not declare rejects with an error naming the action to declare:
|
|
27
|
-
|
|
28
|
-
- `reply(message)`, `update(message)`, `followUp(message)`, `showModal({ customId, title, fields })`
|
|
29
|
-
- `sendMessage(channelId, message)`, `editMessage(channelId, messageId, message)`,
|
|
30
|
-
`deleteMessage(channelId, messageId)`, `sendDirectMessage(userId, message)`
|
|
31
|
-
- `addRole(guildId, userId, roleId)`, `removeRole(guildId, userId, roleId)`
|
|
32
|
-
- reads: `getMember(guildId, userId)` (a `DiscordMember`, or `null` when the user is not in the
|
|
33
|
-
server), `getGuildRoles(guildId)` (`DiscordRole[]`), `getChannel(channelId)` (`DiscordChannel`),
|
|
34
|
-
`getGuild(guildId)` (`DiscordGuild`). The shapes are Discord's in camelCase; permissions are
|
|
35
|
-
decimal strings, since they exceed 2^53.
|
|
36
|
-
|
|
37
|
-
`reply`, `update`, `showModal` and `followUp` need an interaction: in an execution no interaction
|
|
38
|
-
started (a task, a delayed run) the host rejects them with `NO_INTERACTION`.
|
|
39
|
-
|
|
40
|
-
`message` is a `DiscordMessage` (`{ content?, embeds?, components?, ephemeral?, allowedMentions? }`).
|
|
41
|
-
By default a message pings the users it mentions and nobody else: `@everyone`, `@here` and roles
|
|
42
|
-
stay plain text. `allowedMentions` (`DiscordAllowedMentions`: `parse` of `DiscordMentionType`
|
|
43
|
-
values, `users`, `roles`, `repliedUser`) replaces that default. The `args` of
|
|
44
|
-
each host `call` are the types `Discord*Args` (a `DiscordMessage` itself for `reply`, `update`,
|
|
45
|
-
`followUp`). A host failing a call with the message `<DiscordErrorCode>: <detail>` (or the bare
|
|
46
|
-
code) makes the helper throw an `Error` named `DiscordError` with `code` and `message` set; any
|
|
47
|
-
other failure is thrown unchanged. `DiscordInteractionInput` types the `input` of a function
|
|
48
|
-
triggered by a Discord interaction; `DiscordEventInput` (`kind: 'DISCORD_EVENT'`, `event`, `guildId`, `receivedAt`, `firedAt`, `attempt`, `data`) types the `input` of one triggered by a Gateway event (`DiscordEventType`), and `isDiscordEventInput` tells it from the other inputs.
|
|
49
|
-
|
|
50
|
-
## Schedule helpers
|
|
51
|
-
|
|
52
|
-
A host that grants the `ScheduleCapability` names (`schedule.after`, `schedule.at`,
|
|
53
|
-
`schedule.cancel`) lets the client code schedule a delayed run of a named task. Every helper always
|
|
54
|
-
exists; one whose capability the function does not declare rejects with an error naming the action
|
|
55
|
-
to declare:
|
|
56
|
-
|
|
57
|
-
- `after(seconds, taskName, payload?, { key? })` and `at(isoDate, taskName, payload?, { key? })`
|
|
58
|
-
(`isoDate` an ISO 8601 string, or a `Date`) resolve to a `ScheduleResult` (`{ id, deduplicated }`).
|
|
59
|
-
While a run with the same `key` is pending, scheduling again returns its `id` with
|
|
60
|
-
`deduplicated: true`.
|
|
61
|
-
- `cancel(idOrKey)` resolves to a `ScheduleCancelResult` (`{ cancelled }`).
|
|
62
|
-
|
|
63
|
-
The `args` of each host `call` are `ScheduleAfterArgs`, `ScheduleAtArgs` and `ScheduleCancelArgs`
|
|
64
|
-
(`payload` and `key` left out when not given). A host failing a call with the message
|
|
65
|
-
`<ScheduleErrorCode>: <detail>` (or the bare code) makes the helper throw an `Error` named
|
|
66
|
-
`ScheduleError` with `code` and `message` set; any other failure is thrown unchanged.
|
|
67
|
-
`ScheduledRunInput` (`{ kind, task: { id, name }, scheduledFor, firedAt, attempt, payload? }`, `kind`
|
|
68
|
-
a `ScheduledRunKind`: `SCHEDULE` for a cron tick, `DELAYED` for a delayed run) types the `input` of a
|
|
69
|
-
function started by a task.
|
|
70
|
-
|
|
71
|
-
## Installation
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
npm install @abyss-project/runtime
|
|
75
|
-
# or
|
|
76
|
-
pnpm add @abyss-project/runtime
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
## Liens
|
|
80
|
-
|
|
81
|
-
- **Documentation** : [https://docs.abyss-project.fr](https://docs.abyss-project.fr)
|
|
82
|
-
- **NPM** : [@abyss-project/runtime](https://www.npmjs.com/package/@abyss-project/runtime)
|
|
83
|
-
- **Application Abyss** : [app.abyss-project.fr](https://app.abyss-project.fr)
|
|
84
|
-
- **Statut des services** : [status.abyss-project.fr](https://status.abyss-project.fr)
|
|
85
|
-
|
|
86
|
-
## Support
|
|
87
|
-
|
|
88
|
-
Pour toute demande, ouvrir un ticket depuis [l'application Abyss](https://app.abyss-project.fr/dashboard/account/tickets/create).
|
|
1
|
+
# @abyss-project/runtime
|
|
2
|
+
|
|
3
|
+
Abyss automation core: definitions, interpreter, execution protocol `abyss-runtime.v2` and
|
|
4
|
+
execution cost.
|
|
5
|
+
|
|
6
|
+
The package root (`@abyss-project/runtime`) is browser-compatible. Node-only code (the
|
|
7
|
+
`CodeRunnerSession` WebSocket client) lives under `@abyss-project/runtime/server`.
|
|
8
|
+
`@abyss-project/runtime/engine` exports `ENGINE_SOURCE`, the interpreter bundled into one
|
|
9
|
+
self-contained script for the code runner's isolate.
|
|
10
|
+
|
|
11
|
+
## Host globals
|
|
12
|
+
|
|
13
|
+
`ExecuteMessage.globals` gives the client code read-only globals: each top-level key becomes a
|
|
14
|
+
frozen global. Two keys are conventional: `secrets` (`{{ secrets.NAME }}` / `secrets.NAME`, masked
|
|
15
|
+
by the host) and `config` (`Record<string, string>`, the non-secret per-environment variables:
|
|
16
|
+
`{{ config.NAME }}` / `config.NAME`, not masked). A name the host did not send is `undefined`.
|
|
17
|
+
The host sends the names `collectGlobalReferences(definition, 'config')` finds.
|
|
18
|
+
|
|
19
|
+
## Discord helpers
|
|
20
|
+
|
|
21
|
+
A host that grants the `DiscordCapability` names (`discord.reply`, `discord.update`,
|
|
22
|
+
`discord.showModal`, `discord.followUp`, `discord.sendMessage`, `discord.editMessage`,
|
|
23
|
+
`discord.deleteMessage`, `discord.addRole`, `discord.removeRole`, `discord.sendDirectMessage`,
|
|
24
|
+
`discord.getMember`, `discord.getGuildRoles`, `discord.getChannel`, `discord.getGuild`) lets the
|
|
25
|
+
client code call `abyss.discord.<name>(...)`. Every helper always exists; one whose capability the
|
|
26
|
+
function does not declare rejects with an error naming the action to declare:
|
|
27
|
+
|
|
28
|
+
- `reply(message)`, `update(message)`, `followUp(message)`, `showModal({ customId, title, fields })`
|
|
29
|
+
- `sendMessage(channelId, message)`, `editMessage(channelId, messageId, message)`,
|
|
30
|
+
`deleteMessage(channelId, messageId)`, `sendDirectMessage(userId, message)`
|
|
31
|
+
- `addRole(guildId, userId, roleId)`, `removeRole(guildId, userId, roleId)`
|
|
32
|
+
- reads: `getMember(guildId, userId)` (a `DiscordMember`, or `null` when the user is not in the
|
|
33
|
+
server), `getGuildRoles(guildId)` (`DiscordRole[]`), `getChannel(channelId)` (`DiscordChannel`),
|
|
34
|
+
`getGuild(guildId)` (`DiscordGuild`). The shapes are Discord's in camelCase; permissions are
|
|
35
|
+
decimal strings, since they exceed 2^53.
|
|
36
|
+
|
|
37
|
+
`reply`, `update`, `showModal` and `followUp` need an interaction: in an execution no interaction
|
|
38
|
+
started (a task, a delayed run) the host rejects them with `NO_INTERACTION`.
|
|
39
|
+
|
|
40
|
+
`message` is a `DiscordMessage` (`{ content?, embeds?, components?, ephemeral?, allowedMentions? }`).
|
|
41
|
+
By default a message pings the users it mentions and nobody else: `@everyone`, `@here` and roles
|
|
42
|
+
stay plain text. `allowedMentions` (`DiscordAllowedMentions`: `parse` of `DiscordMentionType`
|
|
43
|
+
values, `users`, `roles`, `repliedUser`) replaces that default. The `args` of
|
|
44
|
+
each host `call` are the types `Discord*Args` (a `DiscordMessage` itself for `reply`, `update`,
|
|
45
|
+
`followUp`). A host failing a call with the message `<DiscordErrorCode>: <detail>` (or the bare
|
|
46
|
+
code) makes the helper throw an `Error` named `DiscordError` with `code` and `message` set; any
|
|
47
|
+
other failure is thrown unchanged. `DiscordInteractionInput` types the `input` of a function
|
|
48
|
+
triggered by a Discord interaction; `DiscordEventInput` (`kind: 'DISCORD_EVENT'`, `event`, `guildId`, `receivedAt`, `firedAt`, `attempt`, `data`) types the `input` of one triggered by a Gateway event (`DiscordEventType`), and `isDiscordEventInput` tells it from the other inputs.
|
|
49
|
+
|
|
50
|
+
## Schedule helpers
|
|
51
|
+
|
|
52
|
+
A host that grants the `ScheduleCapability` names (`schedule.after`, `schedule.at`,
|
|
53
|
+
`schedule.cancel`) lets the client code schedule a delayed run of a named task. Every helper always
|
|
54
|
+
exists; one whose capability the function does not declare rejects with an error naming the action
|
|
55
|
+
to declare:
|
|
56
|
+
|
|
57
|
+
- `after(seconds, taskName, payload?, { key? })` and `at(isoDate, taskName, payload?, { key? })`
|
|
58
|
+
(`isoDate` an ISO 8601 string, or a `Date`) resolve to a `ScheduleResult` (`{ id, deduplicated }`).
|
|
59
|
+
While a run with the same `key` is pending, scheduling again returns its `id` with
|
|
60
|
+
`deduplicated: true`.
|
|
61
|
+
- `cancel(idOrKey)` resolves to a `ScheduleCancelResult` (`{ cancelled }`).
|
|
62
|
+
|
|
63
|
+
The `args` of each host `call` are `ScheduleAfterArgs`, `ScheduleAtArgs` and `ScheduleCancelArgs`
|
|
64
|
+
(`payload` and `key` left out when not given). A host failing a call with the message
|
|
65
|
+
`<ScheduleErrorCode>: <detail>` (or the bare code) makes the helper throw an `Error` named
|
|
66
|
+
`ScheduleError` with `code` and `message` set; any other failure is thrown unchanged.
|
|
67
|
+
`ScheduledRunInput` (`{ kind, task: { id, name }, scheduledFor, firedAt, attempt, payload? }`, `kind`
|
|
68
|
+
a `ScheduledRunKind`: `SCHEDULE` for a cron tick, `DELAYED` for a delayed run) types the `input` of a
|
|
69
|
+
function started by a task.
|
|
70
|
+
|
|
71
|
+
## Installation
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm install @abyss-project/runtime
|
|
75
|
+
# or
|
|
76
|
+
pnpm add @abyss-project/runtime
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Liens
|
|
80
|
+
|
|
81
|
+
- **Documentation** : [https://docs.abyss-project.fr](https://docs.abyss-project.fr)
|
|
82
|
+
- **NPM** : [@abyss-project/runtime](https://www.npmjs.com/package/@abyss-project/runtime)
|
|
83
|
+
- **Application Abyss** : [app.abyss-project.fr](https://app.abyss-project.fr)
|
|
84
|
+
- **Statut des services** : [status.abyss-project.fr](https://status.abyss-project.fr)
|
|
85
|
+
|
|
86
|
+
## Support
|
|
87
|
+
|
|
88
|
+
Pour toute demande, ouvrir un ticket depuis [l'application Abyss](https://app.abyss-project.fr/dashboard/account/tickets/create).
|
|
@@ -327,6 +327,11 @@ export declare enum DiscordInteractionKind {
|
|
|
327
327
|
COMPONENT = "COMPONENT",
|
|
328
328
|
MODAL = "MODAL"
|
|
329
329
|
}
|
|
330
|
+
export declare enum DiscordCommandType {
|
|
331
|
+
CHAT_INPUT = "CHAT_INPUT",
|
|
332
|
+
USER = "USER",
|
|
333
|
+
MESSAGE = "MESSAGE"
|
|
334
|
+
}
|
|
330
335
|
export declare enum DiscordInteractionType {
|
|
331
336
|
PING = 1,
|
|
332
337
|
APPLICATION_COMMAND = 2,
|
|
@@ -363,11 +368,29 @@ export interface DiscordResolved {
|
|
|
363
368
|
roles?: Record<string, DiscordRole>;
|
|
364
369
|
channels?: Record<string, DiscordChannel>;
|
|
365
370
|
attachments?: Record<string, DiscordAttachment>;
|
|
371
|
+
messages?: Record<string, DiscordResolvedMessage>;
|
|
372
|
+
}
|
|
373
|
+
export interface DiscordResolvedMessage {
|
|
374
|
+
id: string;
|
|
375
|
+
channelId: string;
|
|
376
|
+
author: {
|
|
377
|
+
id: string;
|
|
378
|
+
username: string;
|
|
379
|
+
globalName: string | null;
|
|
380
|
+
bot: boolean;
|
|
381
|
+
};
|
|
382
|
+
content: string;
|
|
383
|
+
attachments: DiscordAttachment[];
|
|
384
|
+
createdAt: string;
|
|
366
385
|
}
|
|
367
386
|
export interface DiscordInteractionInput {
|
|
368
387
|
kind: DiscordInteractionKind;
|
|
369
388
|
command?: {
|
|
370
389
|
name: string;
|
|
390
|
+
type: DiscordCommandType;
|
|
391
|
+
subcommandGroup?: string;
|
|
392
|
+
subcommand?: string;
|
|
393
|
+
targetId?: string;
|
|
371
394
|
options: Record<string, string | number | boolean>;
|
|
372
395
|
resolved?: DiscordResolved;
|
|
373
396
|
focused?: {
|
|
@@ -407,7 +430,9 @@ export declare enum DiscordEventType {
|
|
|
407
430
|
GUILD_MEMBER_ADD = "GUILD_MEMBER_ADD",
|
|
408
431
|
GUILD_MEMBER_REMOVE = "GUILD_MEMBER_REMOVE",
|
|
409
432
|
MESSAGE_CREATE = "MESSAGE_CREATE",
|
|
410
|
-
MESSAGE_REACTION_ADD = "MESSAGE_REACTION_ADD"
|
|
433
|
+
MESSAGE_REACTION_ADD = "MESSAGE_REACTION_ADD",
|
|
434
|
+
MESSAGE_POLL_VOTE_ADD = "MESSAGE_POLL_VOTE_ADD",
|
|
435
|
+
MESSAGE_POLL_VOTE_REMOVE = "MESSAGE_POLL_VOTE_REMOVE"
|
|
411
436
|
}
|
|
412
437
|
export interface DiscordMemberAddData {
|
|
413
438
|
user: {
|
|
@@ -463,6 +488,12 @@ export interface DiscordReactionAddData {
|
|
|
463
488
|
animated: boolean;
|
|
464
489
|
};
|
|
465
490
|
}
|
|
491
|
+
export interface DiscordPollVoteData {
|
|
492
|
+
userId: string;
|
|
493
|
+
channelId: string;
|
|
494
|
+
messageId: string;
|
|
495
|
+
answerId: number;
|
|
496
|
+
}
|
|
466
497
|
export declare const DISCORD_EVENT_INPUT_KIND = "DISCORD_EVENT";
|
|
467
498
|
export interface DiscordEventInput {
|
|
468
499
|
kind: typeof DISCORD_EVENT_INPUT_KIND;
|
|
@@ -478,6 +509,7 @@ export interface DiscordEventInput {
|
|
|
478
509
|
receivedAt: string;
|
|
479
510
|
firedAt: string;
|
|
480
511
|
attempt: number;
|
|
481
|
-
|
|
512
|
+
replayOf?: string;
|
|
513
|
+
data: DiscordMemberAddData | DiscordMemberRemoveData | DiscordMessageCreateData | DiscordReactionAddData | DiscordPollVoteData;
|
|
482
514
|
}
|
|
483
515
|
export declare const isDiscordEventInput: (value: unknown) => value is DiscordEventInput;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isDiscordEventInput = exports.DISCORD_EVENT_INPUT_KIND = exports.DiscordEventType = exports.EPHEMERAL_FLAG = exports.DiscordCallbackType = exports.DiscordInteractionType = exports.DiscordInteractionKind = exports.DiscordPermissionTargetType = exports.DiscordChannelType = exports.DiscordModalFieldStyle = exports.DiscordMentionType = exports.DiscordErrorCode = exports.DISCORD_CAPABILITY_LIMITS = exports.REFLEX_ATTACHMENT_DEFAULT_MAX_BYTES = exports.REFLEX_ATTACHMENT_MAX_BYTES_BOUND = exports.DISCORD_MESSAGE_MAX_FILES_BYTES = exports.DISCORD_MESSAGE_MAX_FILES = exports.DISCORD_AUTOCOMPLETE_MAX_CHOICES = exports.DiscordCapability = void 0;
|
|
3
|
+
exports.isDiscordEventInput = exports.DISCORD_EVENT_INPUT_KIND = exports.DiscordEventType = exports.EPHEMERAL_FLAG = exports.DiscordCallbackType = exports.DiscordInteractionType = exports.DiscordCommandType = exports.DiscordInteractionKind = exports.DiscordPermissionTargetType = exports.DiscordChannelType = exports.DiscordModalFieldStyle = exports.DiscordMentionType = exports.DiscordErrorCode = exports.DISCORD_CAPABILITY_LIMITS = exports.REFLEX_ATTACHMENT_DEFAULT_MAX_BYTES = exports.REFLEX_ATTACHMENT_MAX_BYTES_BOUND = exports.DISCORD_MESSAGE_MAX_FILES_BYTES = exports.DISCORD_MESSAGE_MAX_FILES = exports.DISCORD_AUTOCOMPLETE_MAX_CHOICES = exports.DiscordCapability = void 0;
|
|
4
4
|
var DiscordCapability;
|
|
5
5
|
(function (DiscordCapability) {
|
|
6
6
|
DiscordCapability["REPLY"] = "discord.reply";
|
|
@@ -101,6 +101,12 @@ var DiscordInteractionKind;
|
|
|
101
101
|
DiscordInteractionKind["COMPONENT"] = "COMPONENT";
|
|
102
102
|
DiscordInteractionKind["MODAL"] = "MODAL";
|
|
103
103
|
})(DiscordInteractionKind || (exports.DiscordInteractionKind = DiscordInteractionKind = {}));
|
|
104
|
+
var DiscordCommandType;
|
|
105
|
+
(function (DiscordCommandType) {
|
|
106
|
+
DiscordCommandType["CHAT_INPUT"] = "CHAT_INPUT";
|
|
107
|
+
DiscordCommandType["USER"] = "USER";
|
|
108
|
+
DiscordCommandType["MESSAGE"] = "MESSAGE";
|
|
109
|
+
})(DiscordCommandType || (exports.DiscordCommandType = DiscordCommandType = {}));
|
|
104
110
|
var DiscordInteractionType;
|
|
105
111
|
(function (DiscordInteractionType) {
|
|
106
112
|
DiscordInteractionType[DiscordInteractionType["PING"] = 1] = "PING";
|
|
@@ -126,6 +132,8 @@ var DiscordEventType;
|
|
|
126
132
|
DiscordEventType["GUILD_MEMBER_REMOVE"] = "GUILD_MEMBER_REMOVE";
|
|
127
133
|
DiscordEventType["MESSAGE_CREATE"] = "MESSAGE_CREATE";
|
|
128
134
|
DiscordEventType["MESSAGE_REACTION_ADD"] = "MESSAGE_REACTION_ADD";
|
|
135
|
+
DiscordEventType["MESSAGE_POLL_VOTE_ADD"] = "MESSAGE_POLL_VOTE_ADD";
|
|
136
|
+
DiscordEventType["MESSAGE_POLL_VOTE_REMOVE"] = "MESSAGE_POLL_VOTE_REMOVE";
|
|
129
137
|
})(DiscordEventType || (exports.DiscordEventType = DiscordEventType = {}));
|
|
130
138
|
exports.DISCORD_EVENT_INPUT_KIND = 'DISCORD_EVENT';
|
|
131
139
|
const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discord.types.js","sourceRoot":"","sources":["../../src/discord/discord.types.ts"],"names":[],"mappings":";;;AAOA,IAAY,iBA+DX;AA/DD,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;IAEjD,qDAAgC,CAAA;IAEhC,8DAAyC,CAAA;IAEzC,uDAAkC,CAAA;IAElC,mDAA8B,CAAA;IAE9B,uDAAkC,CAAA;IAElC,qDAAgC,CAAA;IAEhC,yDAAoC,CAAA;IAEpC,6DAAwC,CAAA;IAExC,wEAAmD,CAAA;IAEnD,yDAAoC,CAAA;IAEpC,+DAA0C,CAAA;IAE1C,6DAAwC,CAAA;IAExC,6DAAwC,CAAA;IAExC,4EAAuD,CAAA;IAEvD,kFAA6D,CAAA;IAE7D,uDAAkC,CAAA;IAElC,uDAAkC,CAAA;IAElC,2DAAsC,CAAA;IAEtC,iDAA4B,CAAA;IAE5B,0DAAqC,CAAA;IAErC,+DAA0C,CAAA;AAC5C,CAAC,EA/DW,iBAAiB,iCAAjB,iBAAiB,QA+D5B;AAGY,QAAA,gCAAgC,GAAG,EAAE,CAAC;AAEtC,QAAA,yBAAyB,GAAG,EAAE,CAAC;AAE/B,QAAA,+BAA+B,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnD,QAAA,iCAAiC,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAEpD,QAAA,mCAAmC,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAMt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CAAC;QACvB,OAAO,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,QAAQ;QACpC,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ;QACtC,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;QACjC,OAAO,KAAK,CAAC,UAAU,KAAK,QAAQ;QACpC,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;QACjC,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;QACjC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CACrB,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,mBAAmB,uBAkB9B"}
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@ import * as fs from 'fs';
|
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
+
DiscordCommandType,
|
|
6
7
|
DiscordEventType,
|
|
7
8
|
MAX_ERROR_STACK_CHARS,
|
|
8
9
|
MAX_PROGRESS_OUTPUT_BYTES,
|
|
@@ -66,10 +67,16 @@ describe('public surface of the package root', () => {
|
|
|
66
67
|
'GUILD_MEMBER_REMOVE',
|
|
67
68
|
'MESSAGE_CREATE',
|
|
68
69
|
'MESSAGE_REACTION_ADD',
|
|
70
|
+
'MESSAGE_POLL_VOTE_ADD',
|
|
71
|
+
'MESSAGE_POLL_VOTE_REMOVE',
|
|
69
72
|
]);
|
|
70
73
|
expect(typeof isDiscordEventInput).toBe('function');
|
|
71
74
|
});
|
|
72
75
|
|
|
76
|
+
it('exports the application command types, slash command and the two context menus', () => {
|
|
77
|
+
expect(Object.values(DiscordCommandType)).toEqual(['CHAT_INPUT', 'USER', 'MESSAGE']);
|
|
78
|
+
});
|
|
79
|
+
|
|
73
80
|
it('exports the step output bounds of the execution protocol (64 KB whole, 4 KB preview)', () => {
|
|
74
81
|
expect(MAX_PROGRESS_OUTPUT_BYTES).toBe(65_536);
|
|
75
82
|
expect(MAX_PROGRESS_OUTPUT_CHARS).toBe(4_096);
|
|
@@ -30,6 +30,18 @@ const DATA_BY_TYPE: Record<DiscordEventType, DiscordEventInput['data']> = {
|
|
|
30
30
|
member: { roles: [] },
|
|
31
31
|
emoji: { id: null, name: '👍', animated: false },
|
|
32
32
|
},
|
|
33
|
+
[DiscordEventType.MESSAGE_POLL_VOTE_ADD]: {
|
|
34
|
+
userId: 'u1',
|
|
35
|
+
channelId: 'c1',
|
|
36
|
+
messageId: 'm1',
|
|
37
|
+
answerId: 2,
|
|
38
|
+
},
|
|
39
|
+
[DiscordEventType.MESSAGE_POLL_VOTE_REMOVE]: {
|
|
40
|
+
userId: 'u1',
|
|
41
|
+
channelId: 'c1',
|
|
42
|
+
messageId: 'm1',
|
|
43
|
+
answerId: 2,
|
|
44
|
+
},
|
|
33
45
|
};
|
|
34
46
|
|
|
35
47
|
const inputOf = (type: DiscordEventType): DiscordEventInput => ({
|
|
@@ -47,6 +59,12 @@ describe('isDiscordEventInput', () => {
|
|
|
47
59
|
expect(isDiscordEventInput(inputOf(type))).toBe(true);
|
|
48
60
|
});
|
|
49
61
|
|
|
62
|
+
it('is true for a replay, which names the live run it replays', () => {
|
|
63
|
+
expect(
|
|
64
|
+
isDiscordEventInput({ ...inputOf(DiscordEventType.MESSAGE_POLL_VOTE_ADD), replayOf: 'r1' }),
|
|
65
|
+
).toBe(true);
|
|
66
|
+
});
|
|
67
|
+
|
|
50
68
|
it('is false for an interaction input', () => {
|
|
51
69
|
expect(
|
|
52
70
|
isDiscordEventInput({
|
|
@@ -510,6 +510,13 @@ export enum DiscordInteractionKind {
|
|
|
510
510
|
MODAL = 'MODAL',
|
|
511
511
|
}
|
|
512
512
|
|
|
513
|
+
/** The type of an application command: a slash command, or a context menu on a member or a message. */
|
|
514
|
+
export enum DiscordCommandType {
|
|
515
|
+
CHAT_INPUT = 'CHAT_INPUT',
|
|
516
|
+
USER = 'USER',
|
|
517
|
+
MESSAGE = 'MESSAGE',
|
|
518
|
+
}
|
|
519
|
+
|
|
513
520
|
/** Discord's interaction types (`type` of the payload) a bot's edge serves. */
|
|
514
521
|
export enum DiscordInteractionType {
|
|
515
522
|
PING = 1,
|
|
@@ -564,6 +571,20 @@ export interface DiscordResolved {
|
|
|
564
571
|
/** Partial channels: what Discord gives in an interaction. */
|
|
565
572
|
channels?: Record<string, DiscordChannel>;
|
|
566
573
|
attachments?: Record<string, DiscordAttachment>;
|
|
574
|
+
/** The message a MESSAGE context menu was used on. */
|
|
575
|
+
messages?: Record<string, DiscordResolvedMessage>;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
/** A message as an interaction resolves it: the target of a MESSAGE context menu. */
|
|
579
|
+
export interface DiscordResolvedMessage {
|
|
580
|
+
id: string;
|
|
581
|
+
channelId: string;
|
|
582
|
+
author: { id: string; username: string; globalName: string | null; bot: boolean };
|
|
583
|
+
content: string;
|
|
584
|
+
/** The files of the message, with the ids `discord.readAttachment` takes. */
|
|
585
|
+
attachments: DiscordAttachment[];
|
|
586
|
+
/** ISO 8601. */
|
|
587
|
+
createdAt: string;
|
|
567
588
|
}
|
|
568
589
|
|
|
569
590
|
/**
|
|
@@ -574,7 +595,15 @@ export interface DiscordInteractionInput {
|
|
|
574
595
|
kind: DiscordInteractionKind;
|
|
575
596
|
/** Resolved option values, by option name; `resolved` details the ids they hold, when there are some. */
|
|
576
597
|
command?: {
|
|
598
|
+
/** The root command's name; the subcommand path is in `subcommandGroup` and `subcommand`. */
|
|
577
599
|
name: string;
|
|
600
|
+
type: DiscordCommandType;
|
|
601
|
+
/** The group of the subcommand that ran, when it belongs to one. */
|
|
602
|
+
subcommandGroup?: string;
|
|
603
|
+
/** The subcommand that ran, when the command has subcommands. */
|
|
604
|
+
subcommand?: string;
|
|
605
|
+
/** The member (USER) or message (MESSAGE) a context menu was used on; details in `resolved`. */
|
|
606
|
+
targetId?: string;
|
|
578
607
|
options: Record<string, string | number | boolean>;
|
|
579
608
|
resolved?: DiscordResolved;
|
|
580
609
|
/** The option being typed; present only for an AUTOCOMPLETE interaction. */
|
|
@@ -598,6 +627,8 @@ export enum DiscordEventType {
|
|
|
598
627
|
GUILD_MEMBER_REMOVE = 'GUILD_MEMBER_REMOVE',
|
|
599
628
|
MESSAGE_CREATE = 'MESSAGE_CREATE',
|
|
600
629
|
MESSAGE_REACTION_ADD = 'MESSAGE_REACTION_ADD',
|
|
630
|
+
MESSAGE_POLL_VOTE_ADD = 'MESSAGE_POLL_VOTE_ADD',
|
|
631
|
+
MESSAGE_POLL_VOTE_REMOVE = 'MESSAGE_POLL_VOTE_REMOVE',
|
|
601
632
|
}
|
|
602
633
|
|
|
603
634
|
/** `data` of a `GUILD_MEMBER_ADD` event. */
|
|
@@ -649,6 +680,14 @@ export interface DiscordReactionAddData {
|
|
|
649
680
|
emoji: { id: string | null; name: string | null; animated: boolean };
|
|
650
681
|
}
|
|
651
682
|
|
|
683
|
+
/** `data` of a `MESSAGE_POLL_VOTE_ADD` or `MESSAGE_POLL_VOTE_REMOVE` event: one event per answer. */
|
|
684
|
+
export interface DiscordPollVoteData {
|
|
685
|
+
userId: string;
|
|
686
|
+
channelId: string;
|
|
687
|
+
messageId: string;
|
|
688
|
+
answerId: number;
|
|
689
|
+
}
|
|
690
|
+
|
|
652
691
|
/** The `kind` of a `DiscordEventInput`. */
|
|
653
692
|
export const DISCORD_EVENT_INPUT_KIND = 'DISCORD_EVENT';
|
|
654
693
|
|
|
@@ -661,11 +700,14 @@ export interface DiscordEventInput {
|
|
|
661
700
|
receivedAt: string;
|
|
662
701
|
firedAt: string;
|
|
663
702
|
attempt: number;
|
|
703
|
+
/** The live run this execution replays, when it is a replay (never set on a received event). */
|
|
704
|
+
replayOf?: string;
|
|
664
705
|
data:
|
|
665
706
|
| DiscordMemberAddData
|
|
666
707
|
| DiscordMemberRemoveData
|
|
667
708
|
| DiscordMessageCreateData
|
|
668
|
-
| DiscordReactionAddData
|
|
709
|
+
| DiscordReactionAddData
|
|
710
|
+
| DiscordPollVoteData;
|
|
669
711
|
}
|
|
670
712
|
|
|
671
713
|
const isRecord = (value: unknown): value is Record<string, unknown> =>
|