@ever-works/discord-connector-plugin 1.0.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 +42 -0
- package/dist/index.cjs +862 -0
- package/dist/index.d.cts +36 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +859 -0
- package/package.json +108 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { IConnectorPlugin, PluginCategory, ConnectorMetadata, JsonSchema, ChannelTargetConfig, ConnectorCallOptions, ChannelVerification, ChannelSendInput, ChannelSendResult } from '@ever-works/plugin';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Discord connector — a first-party BIDIRECTIONAL connector. This
|
|
5
|
+
* increment implements the OUTBOUND leg: it posts messages to a Discord
|
|
6
|
+
* channel with a bot token via `POST /channels/:id/messages` on the
|
|
7
|
+
* official `discord.js` `REST` client (distinct from `discord-channel`'s
|
|
8
|
+
* incoming-webhook `fetch` path — a connector is a superset of a channel).
|
|
9
|
+
*
|
|
10
|
+
* Inbound (Discord Interactions API: `verifyInbound` Ed25519 signature
|
|
11
|
+
* verification over `X-Signature-Ed25519` + `X-Signature-Timestamp`,
|
|
12
|
+
* `handleChallenge` for the `PING` handshake, `parseInbound` → route to an
|
|
13
|
+
* Agent, `reply` into the channel) is a follow-up (P2) — the `publicKey`
|
|
14
|
+
* setting is captured now so the connection is inbound-ready. Metadata
|
|
15
|
+
* therefore declares `direction: 'outbound'` with `inbound`/`reply`/
|
|
16
|
+
* `pairing` flags off until that runtime lands.
|
|
17
|
+
*
|
|
18
|
+
* See `docs/specs/features/connectors/spec.md` §7.5.1.
|
|
19
|
+
*/
|
|
20
|
+
declare class DiscordConnectorPlugin implements IConnectorPlugin {
|
|
21
|
+
readonly id = "discord-connector";
|
|
22
|
+
readonly name = "Discord Connector";
|
|
23
|
+
readonly version = "1.0.0";
|
|
24
|
+
readonly category: PluginCategory;
|
|
25
|
+
readonly capabilities: readonly ["connector", "connector-discord"];
|
|
26
|
+
readonly connector: ConnectorMetadata;
|
|
27
|
+
readonly settingsSchema: JsonSchema;
|
|
28
|
+
private readonly idempotencyCache;
|
|
29
|
+
onLoad(): Promise<void>;
|
|
30
|
+
onUnload(): Promise<void>;
|
|
31
|
+
verifyConnection(config: ChannelTargetConfig, _options: ConnectorCallOptions): Promise<ChannelVerification>;
|
|
32
|
+
send(payload: ChannelSendInput, options: ConnectorCallOptions): Promise<ChannelSendResult>;
|
|
33
|
+
}
|
|
34
|
+
declare const discordConnectorPlugin: DiscordConnectorPlugin;
|
|
35
|
+
|
|
36
|
+
export { DiscordConnectorPlugin, discordConnectorPlugin };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { IConnectorPlugin, PluginCategory, ConnectorMetadata, JsonSchema, ChannelTargetConfig, ConnectorCallOptions, ChannelVerification, ChannelSendInput, ChannelSendResult } from '@ever-works/plugin';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Discord connector — a first-party BIDIRECTIONAL connector. This
|
|
5
|
+
* increment implements the OUTBOUND leg: it posts messages to a Discord
|
|
6
|
+
* channel with a bot token via `POST /channels/:id/messages` on the
|
|
7
|
+
* official `discord.js` `REST` client (distinct from `discord-channel`'s
|
|
8
|
+
* incoming-webhook `fetch` path — a connector is a superset of a channel).
|
|
9
|
+
*
|
|
10
|
+
* Inbound (Discord Interactions API: `verifyInbound` Ed25519 signature
|
|
11
|
+
* verification over `X-Signature-Ed25519` + `X-Signature-Timestamp`,
|
|
12
|
+
* `handleChallenge` for the `PING` handshake, `parseInbound` → route to an
|
|
13
|
+
* Agent, `reply` into the channel) is a follow-up (P2) — the `publicKey`
|
|
14
|
+
* setting is captured now so the connection is inbound-ready. Metadata
|
|
15
|
+
* therefore declares `direction: 'outbound'` with `inbound`/`reply`/
|
|
16
|
+
* `pairing` flags off until that runtime lands.
|
|
17
|
+
*
|
|
18
|
+
* See `docs/specs/features/connectors/spec.md` §7.5.1.
|
|
19
|
+
*/
|
|
20
|
+
declare class DiscordConnectorPlugin implements IConnectorPlugin {
|
|
21
|
+
readonly id = "discord-connector";
|
|
22
|
+
readonly name = "Discord Connector";
|
|
23
|
+
readonly version = "1.0.0";
|
|
24
|
+
readonly category: PluginCategory;
|
|
25
|
+
readonly capabilities: readonly ["connector", "connector-discord"];
|
|
26
|
+
readonly connector: ConnectorMetadata;
|
|
27
|
+
readonly settingsSchema: JsonSchema;
|
|
28
|
+
private readonly idempotencyCache;
|
|
29
|
+
onLoad(): Promise<void>;
|
|
30
|
+
onUnload(): Promise<void>;
|
|
31
|
+
verifyConnection(config: ChannelTargetConfig, _options: ConnectorCallOptions): Promise<ChannelVerification>;
|
|
32
|
+
send(payload: ChannelSendInput, options: ConnectorCallOptions): Promise<ChannelSendResult>;
|
|
33
|
+
}
|
|
34
|
+
declare const discordConnectorPlugin: DiscordConnectorPlugin;
|
|
35
|
+
|
|
36
|
+
export { DiscordConnectorPlugin, discordConnectorPlugin };
|