flingit 0.0.18 → 0.0.20
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/dist/cli/commands/plugin.d.ts +3 -10
- package/dist/cli/commands/plugin.d.ts.map +1 -1
- package/dist/cli/commands/plugin.js +103 -209
- package/dist/cli/commands/plugin.js.map +1 -1
- package/dist/cli/commands/push.d.ts +5 -0
- package/dist/cli/commands/push.d.ts.map +1 -1
- package/dist/cli/commands/push.js +21 -33
- package/dist/cli/commands/push.js.map +1 -1
- package/dist/cli/deploy/bundler.d.ts +14 -10
- package/dist/cli/deploy/bundler.d.ts.map +1 -1
- package/dist/cli/deploy/bundler.js +44 -70
- package/dist/cli/deploy/bundler.js.map +1 -1
- package/dist/cli/utils/config.d.ts +12 -4
- package/dist/cli/utils/config.d.ts.map +1 -1
- package/dist/cli/utils/config.js +49 -6
- package/dist/cli/utils/config.js.map +1 -1
- package/dist/runtime/discord.d.ts +18 -59
- package/dist/runtime/discord.d.ts.map +1 -1
- package/dist/runtime/discord.js +20 -60
- package/dist/runtime/discord.js.map +1 -1
- package/dist/runtime/slack.d.ts +83 -0
- package/dist/runtime/slack.d.ts.map +1 -0
- package/dist/runtime/slack.js +87 -0
- package/dist/runtime/slack.js.map +1 -0
- package/dist/shared/discord-types.d.ts +0 -24
- package/dist/shared/discord-types.d.ts.map +1 -1
- package/dist/shared/plugin-metadata.d.ts +28 -0
- package/dist/shared/plugin-metadata.d.ts.map +1 -0
- package/dist/shared/plugin-metadata.js +65 -0
- package/dist/shared/plugin-metadata.js.map +1 -0
- package/dist/shared/slack-types.d.ts +61 -0
- package/dist/shared/slack-types.d.ts.map +1 -0
- package/dist/shared/slack-types.js +8 -0
- package/dist/shared/slack-types.js.map +1 -0
- package/dist/worker-runtime/discord.d.ts +75 -27
- package/dist/worker-runtime/discord.d.ts.map +1 -1
- package/dist/worker-runtime/discord.js +156 -108
- package/dist/worker-runtime/discord.js.map +1 -1
- package/dist/worker-runtime/index.d.ts +1 -1
- package/dist/worker-runtime/index.d.ts.map +1 -1
- package/dist/worker-runtime/index.js +0 -4
- package/dist/worker-runtime/index.js.map +1 -1
- package/dist/worker-runtime/plugin-common.d.ts +27 -0
- package/dist/worker-runtime/plugin-common.d.ts.map +1 -0
- package/dist/worker-runtime/plugin-common.js +91 -0
- package/dist/worker-runtime/plugin-common.js.map +1 -0
- package/dist/worker-runtime/slack.d.ts +67 -0
- package/dist/worker-runtime/slack.d.ts.map +1 -0
- package/dist/worker-runtime/slack.js +135 -0
- package/dist/worker-runtime/slack.js.map +1 -0
- package/package.json +10 -2
- package/templates/default/skills/fling/.hash +1 -1
- package/templates/default/skills/fling/DISCORD.md +69 -126
- package/templates/default/skills/fling/SKILL.md +13 -0
- package/templates/default/skills/fling/SLACK.md +214 -0
|
@@ -7,79 +7,38 @@
|
|
|
7
7
|
* Note: Discord features require the Discord plugin to be installed.
|
|
8
8
|
* Run `fling plugin install discord` to set up.
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import type { DiscordSlashCommand, DiscordInteraction, SendMessageOptions, EditMessageOptions, InteractionReplyOptions, DiscordMessage } from "../shared/discord-types.js";
|
|
10
|
+
export type { DiscordInteraction, DiscordEmbed, SendMessageOptions, EditMessageOptions, InteractionReplyOptions, DiscordMessage, } from "../shared/discord-types.js";
|
|
11
|
+
import type { DiscordInteraction, SendMessageOptions, EditMessageOptions, InteractionReplyOptions, DiscordMessage } from "../shared/discord-types.js";
|
|
13
12
|
/**
|
|
14
13
|
* Discord integration helper.
|
|
15
14
|
*
|
|
16
|
-
* Provides methods for sending messages, handling
|
|
17
|
-
* and
|
|
15
|
+
* Provides methods for sending messages, handling slash commands,
|
|
16
|
+
* and reacting to Discord interactions.
|
|
18
17
|
*
|
|
19
18
|
* @example
|
|
20
19
|
* ```typescript
|
|
21
|
-
* import { app } from "flingit";
|
|
22
20
|
* import { discord } from "flingit/plugin/discord";
|
|
23
21
|
*
|
|
24
|
-
* // Define slash commands (synced on deploy)
|
|
25
|
-
* export const commands = discord.defineCommands([
|
|
26
|
-
* { name: "deploy", description: "Deploy the current branch" },
|
|
27
|
-
* { name: "status", description: "Show deployment status" }
|
|
28
|
-
* ]);
|
|
29
|
-
*
|
|
30
22
|
* // Handle slash commands
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* if (interaction.data?.name === "deploy") {
|
|
35
|
-
* await discord.replyToInteraction(interaction, {
|
|
36
|
-
* content: "Starting deployment..."
|
|
37
|
-
* });
|
|
38
|
-
* }
|
|
23
|
+
* discord.onCommand("ping", "Check if the bot is alive", async (interaction) => {
|
|
24
|
+
* discord.reply(interaction, { content: "Pong!" });
|
|
39
25
|
* });
|
|
40
26
|
* ```
|
|
41
27
|
*/
|
|
42
28
|
export declare const discord: {
|
|
43
29
|
/**
|
|
44
|
-
*
|
|
45
|
-
* These are registered with Discord when you run `fling push`.
|
|
46
|
-
*
|
|
47
|
-
* @param commands - Array of command definitions
|
|
48
|
-
* @returns The same array (for export)
|
|
30
|
+
* Register a handler for a specific slash command (no-op in local runtime).
|
|
49
31
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* export const commands = discord.defineCommands([
|
|
53
|
-
* { name: "ping", description: "Check bot latency" },
|
|
54
|
-
* {
|
|
55
|
-
* name: "deploy",
|
|
56
|
-
* description: "Deploy a branch",
|
|
57
|
-
* options: [
|
|
58
|
-
* { name: "branch", type: "string", description: "Branch name", required: true }
|
|
59
|
-
* ]
|
|
60
|
-
* }
|
|
61
|
-
* ]);
|
|
62
|
-
* ```
|
|
32
|
+
* The description is used to register the command with Discord's API
|
|
33
|
+
* during `fling push`. The handler only runs in deployed workers.
|
|
63
34
|
*/
|
|
64
|
-
|
|
35
|
+
onCommand(_commandName: string, _description: string, _handler: (...args: unknown[]) => unknown): void;
|
|
65
36
|
/**
|
|
66
|
-
*
|
|
67
|
-
* Discord requires interaction verification within 3 seconds.
|
|
68
|
-
*
|
|
69
|
-
* @param c - Hono context from the request
|
|
70
|
-
* @returns Parsed interaction
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* ```typescript
|
|
74
|
-
* app.post("/discord", async (c) => {
|
|
75
|
-
* const interaction = await discord.verifyInteraction(c);
|
|
76
|
-
* // Handle interaction...
|
|
77
|
-
* });
|
|
78
|
-
* ```
|
|
37
|
+
* Register a fallback handler for interactions (no-op in local runtime).
|
|
79
38
|
*/
|
|
80
|
-
|
|
39
|
+
onEvent(_handler: (...args: unknown[]) => unknown): void;
|
|
81
40
|
/**
|
|
82
|
-
* Reply to a Discord interaction.
|
|
41
|
+
* Reply to a Discord interaction (slash command).
|
|
83
42
|
* Must be called within 3 seconds of receiving the interaction.
|
|
84
43
|
*
|
|
85
44
|
* @param interaction - The interaction to reply to
|
|
@@ -87,13 +46,13 @@ export declare const discord: {
|
|
|
87
46
|
*
|
|
88
47
|
* @example
|
|
89
48
|
* ```typescript
|
|
90
|
-
*
|
|
49
|
+
* discord.reply(interaction, {
|
|
91
50
|
* content: "Command received!",
|
|
92
51
|
* ephemeral: true // Only visible to command user
|
|
93
52
|
* });
|
|
94
53
|
* ```
|
|
95
54
|
*/
|
|
96
|
-
|
|
55
|
+
reply(_interaction: DiscordInteraction, _options: InteractionReplyOptions): void;
|
|
97
56
|
/**
|
|
98
57
|
* Send a message to a Discord channel.
|
|
99
58
|
* The channel must be in a server claimed by your project.
|
|
@@ -156,16 +115,16 @@ export declare const discord: {
|
|
|
156
115
|
* @example
|
|
157
116
|
* ```typescript
|
|
158
117
|
* // Initial reply
|
|
159
|
-
*
|
|
118
|
+
* discord.reply(interaction, { content: "Processing..." });
|
|
160
119
|
*
|
|
161
120
|
* // Do some work...
|
|
162
121
|
*
|
|
163
122
|
* // Send followup
|
|
164
|
-
* await discord.
|
|
123
|
+
* await discord.followup(interaction, {
|
|
165
124
|
* content: "Done! Here are the results..."
|
|
166
125
|
* });
|
|
167
126
|
* ```
|
|
168
127
|
*/
|
|
169
|
-
|
|
128
|
+
followup(_interaction: DiscordInteraction, _options: InteractionReplyOptions): Promise<DiscordMessage>;
|
|
170
129
|
};
|
|
171
130
|
//# sourceMappingURL=discord.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discord.d.ts","sourceRoot":"","sources":["../../src/runtime/discord.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"discord.d.ts","sourceRoot":"","sources":["../../src/runtime/discord.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,GACf,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACf,MAAM,4BAA4B,CAAC;AAgBpC;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,OAAO;IAClB;;;;;OAKG;4BACqB,MAAM,gBAAgB,MAAM,YAAY,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,GAAG,IAAI;IAItG;;OAEG;sBACe,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,GAAG,IAAI;IAIxD;;;;;;;;;;;;;;OAcG;wBAEa,kBAAkB,YACtB,uBAAuB,GAChC,IAAI;IAIP;;;;;;;;;;;;;;;;;;;OAmBG;0BACyB,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC;IAIxE;;;;;;;;;;;;;;OAcG;4BAEW,MAAM,cACN,MAAM,YACR,kBAAkB,GAC3B,OAAO,CAAC,cAAc,CAAC;IAI1B;;;;;;;;;;;;OAYG;4BAEW,MAAM,cACN,MAAM,UACV,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;IAIhB;;;;;;;;;;;;;;;;;;;;OAoBG;2BAEa,kBAAkB,YACtB,uBAAuB,GAChC,OAAO,CAAC,cAAc,CAAC;CAG3B,CAAC"}
|
package/dist/runtime/discord.js
CHANGED
|
@@ -20,77 +20,37 @@ function localRuntimeWarning(method) {
|
|
|
20
20
|
/**
|
|
21
21
|
* Discord integration helper.
|
|
22
22
|
*
|
|
23
|
-
* Provides methods for sending messages, handling
|
|
24
|
-
* and
|
|
23
|
+
* Provides methods for sending messages, handling slash commands,
|
|
24
|
+
* and reacting to Discord interactions.
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
27
|
* ```typescript
|
|
28
|
-
* import { app } from "flingit";
|
|
29
28
|
* import { discord } from "flingit/plugin/discord";
|
|
30
29
|
*
|
|
31
|
-
* // Define slash commands (synced on deploy)
|
|
32
|
-
* export const commands = discord.defineCommands([
|
|
33
|
-
* { name: "deploy", description: "Deploy the current branch" },
|
|
34
|
-
* { name: "status", description: "Show deployment status" }
|
|
35
|
-
* ]);
|
|
36
|
-
*
|
|
37
30
|
* // Handle slash commands
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* if (interaction.data?.name === "deploy") {
|
|
42
|
-
* await discord.replyToInteraction(interaction, {
|
|
43
|
-
* content: "Starting deployment..."
|
|
44
|
-
* });
|
|
45
|
-
* }
|
|
31
|
+
* discord.onCommand("ping", "Check if the bot is alive", async (interaction) => {
|
|
32
|
+
* discord.reply(interaction, { content: "Pong!" });
|
|
46
33
|
* });
|
|
47
34
|
* ```
|
|
48
35
|
*/
|
|
49
36
|
export const discord = {
|
|
50
37
|
/**
|
|
51
|
-
*
|
|
52
|
-
* These are registered with Discord when you run `fling push`.
|
|
53
|
-
*
|
|
54
|
-
* @param commands - Array of command definitions
|
|
55
|
-
* @returns The same array (for export)
|
|
38
|
+
* Register a handler for a specific slash command (no-op in local runtime).
|
|
56
39
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* export const commands = discord.defineCommands([
|
|
60
|
-
* { name: "ping", description: "Check bot latency" },
|
|
61
|
-
* {
|
|
62
|
-
* name: "deploy",
|
|
63
|
-
* description: "Deploy a branch",
|
|
64
|
-
* options: [
|
|
65
|
-
* { name: "branch", type: "string", description: "Branch name", required: true }
|
|
66
|
-
* ]
|
|
67
|
-
* }
|
|
68
|
-
* ]);
|
|
69
|
-
* ```
|
|
40
|
+
* The description is used to register the command with Discord's API
|
|
41
|
+
* during `fling push`. The handler only runs in deployed workers.
|
|
70
42
|
*/
|
|
71
|
-
|
|
72
|
-
|
|
43
|
+
onCommand(_commandName, _description, _handler) {
|
|
44
|
+
// No-op in local runtime — command registration happens at bundle time
|
|
73
45
|
},
|
|
74
46
|
/**
|
|
75
|
-
*
|
|
76
|
-
* Discord requires interaction verification within 3 seconds.
|
|
77
|
-
*
|
|
78
|
-
* @param c - Hono context from the request
|
|
79
|
-
* @returns Parsed interaction
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* ```typescript
|
|
83
|
-
* app.post("/discord", async (c) => {
|
|
84
|
-
* const interaction = await discord.verifyInteraction(c);
|
|
85
|
-
* // Handle interaction...
|
|
86
|
-
* });
|
|
87
|
-
* ```
|
|
47
|
+
* Register a fallback handler for interactions (no-op in local runtime).
|
|
88
48
|
*/
|
|
89
|
-
|
|
90
|
-
|
|
49
|
+
onEvent(_handler) {
|
|
50
|
+
// No-op in local runtime
|
|
91
51
|
},
|
|
92
52
|
/**
|
|
93
|
-
* Reply to a Discord interaction.
|
|
53
|
+
* Reply to a Discord interaction (slash command).
|
|
94
54
|
* Must be called within 3 seconds of receiving the interaction.
|
|
95
55
|
*
|
|
96
56
|
* @param interaction - The interaction to reply to
|
|
@@ -98,14 +58,14 @@ export const discord = {
|
|
|
98
58
|
*
|
|
99
59
|
* @example
|
|
100
60
|
* ```typescript
|
|
101
|
-
*
|
|
61
|
+
* discord.reply(interaction, {
|
|
102
62
|
* content: "Command received!",
|
|
103
63
|
* ephemeral: true // Only visible to command user
|
|
104
64
|
* });
|
|
105
65
|
* ```
|
|
106
66
|
*/
|
|
107
|
-
|
|
108
|
-
localRuntimeWarning("
|
|
67
|
+
reply(_interaction, _options) {
|
|
68
|
+
localRuntimeWarning("reply");
|
|
109
69
|
},
|
|
110
70
|
/**
|
|
111
71
|
* Send a message to a Discord channel.
|
|
@@ -175,18 +135,18 @@ export const discord = {
|
|
|
175
135
|
* @example
|
|
176
136
|
* ```typescript
|
|
177
137
|
* // Initial reply
|
|
178
|
-
*
|
|
138
|
+
* discord.reply(interaction, { content: "Processing..." });
|
|
179
139
|
*
|
|
180
140
|
* // Do some work...
|
|
181
141
|
*
|
|
182
142
|
* // Send followup
|
|
183
|
-
* await discord.
|
|
143
|
+
* await discord.followup(interaction, {
|
|
184
144
|
* content: "Done! Here are the results..."
|
|
185
145
|
* });
|
|
186
146
|
* ```
|
|
187
147
|
*/
|
|
188
|
-
async
|
|
189
|
-
localRuntimeWarning("
|
|
148
|
+
async followup(_interaction, _options) {
|
|
149
|
+
localRuntimeWarning("followup");
|
|
190
150
|
},
|
|
191
151
|
};
|
|
192
152
|
//# sourceMappingURL=discord.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discord.js","sourceRoot":"","sources":["../../src/runtime/discord.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"discord.js","sourceRoot":"","sources":["../../src/runtime/discord.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAoBH,gFAAgF;AAChF,sCAAsC;AACtC,gFAAgF;AAEhF;;GAEG;AACH,SAAS,mBAAmB,CAAC,MAAc;IACzC,MAAM,IAAI,KAAK,CACb,WAAW,MAAM,4CAA4C;QAC3D,iEAAiE,CACpE,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB;;;;;OAKG;IACH,SAAS,CAAC,YAAoB,EAAE,YAAoB,EAAE,QAAyC;QAC7F,uEAAuE;IACzE,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,QAAyC;QAC/C,yBAAyB;IAC3B,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CACH,YAAgC,EAChC,QAAiC;QAEjC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,KAAK,CAAC,WAAW,CAAC,QAA4B;QAC5C,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,WAAW,CACf,UAAkB,EAClB,UAAkB,EAClB,QAA4B;QAE5B,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,WAAW,CACf,UAAkB,EAClB,UAAkB,EAClB,MAAc;QAEd,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,KAAK,CAAC,QAAQ,CACZ,YAAgC,EAChC,QAAiC;QAEjC,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slack integration for Fling applications (Local runtime)
|
|
3
|
+
*
|
|
4
|
+
* Provides helpers for building Slack chatops bots.
|
|
5
|
+
* This is the local development version - the worker version is in worker-runtime.
|
|
6
|
+
*
|
|
7
|
+
* Note: Slack features require the Slack plugin to be installed.
|
|
8
|
+
* Run `fling plugin install slack` to set up.
|
|
9
|
+
*/
|
|
10
|
+
export type { SlackEvent, SlackBlock, SlackMessage, SendMessageOptions, EditMessageOptions, } from "../shared/slack-types.js";
|
|
11
|
+
import type { SlackEvent, SlackMessage, SendMessageOptions, EditMessageOptions } from "../shared/slack-types.js";
|
|
12
|
+
/**
|
|
13
|
+
* An app mention event from Slack.
|
|
14
|
+
*/
|
|
15
|
+
export interface MentionEvent {
|
|
16
|
+
type: "app_mention";
|
|
17
|
+
channel: string;
|
|
18
|
+
user: string;
|
|
19
|
+
text: string;
|
|
20
|
+
ts: string;
|
|
21
|
+
thread_ts?: string;
|
|
22
|
+
team?: string;
|
|
23
|
+
}
|
|
24
|
+
type MentionHandler = (event: MentionEvent) => Promise<void> | void;
|
|
25
|
+
type GenericEventHandler = (event: SlackEvent) => Promise<void> | void;
|
|
26
|
+
/**
|
|
27
|
+
* Slack integration helper.
|
|
28
|
+
*
|
|
29
|
+
* Provides methods for sending messages, handling mentions,
|
|
30
|
+
* and reacting to Slack events.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* import { slack } from "flingit/plugin/slack";
|
|
35
|
+
*
|
|
36
|
+
* // Handle mentions
|
|
37
|
+
* slack.onMention(async (event) => {
|
|
38
|
+
* await slack.sendMessage({
|
|
39
|
+
* channelId: event.channel,
|
|
40
|
+
* text: `Hello <@${event.user}>!`,
|
|
41
|
+
* });
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare const slack: {
|
|
46
|
+
/**
|
|
47
|
+
* Register a handler for app mention events.
|
|
48
|
+
*
|
|
49
|
+
* @param handler - Function to call when the bot is mentioned
|
|
50
|
+
*/
|
|
51
|
+
onMention(_handler: MentionHandler): void;
|
|
52
|
+
/**
|
|
53
|
+
* Register a handler for all Slack events.
|
|
54
|
+
*
|
|
55
|
+
* @param handler - Function to call for each event
|
|
56
|
+
*/
|
|
57
|
+
onEvent(_handler: GenericEventHandler): void;
|
|
58
|
+
/**
|
|
59
|
+
* Send a message to a Slack channel.
|
|
60
|
+
*
|
|
61
|
+
* @param options - Message content and target channel
|
|
62
|
+
* @returns The sent message
|
|
63
|
+
*/
|
|
64
|
+
sendMessage(_options: SendMessageOptions): Promise<SlackMessage>;
|
|
65
|
+
/**
|
|
66
|
+
* Edit a previously sent message.
|
|
67
|
+
*
|
|
68
|
+
* @param channelId - The channel containing the message
|
|
69
|
+
* @param ts - The timestamp of the message to edit
|
|
70
|
+
* @param options - New message content
|
|
71
|
+
* @returns The edited message
|
|
72
|
+
*/
|
|
73
|
+
editMessage(_channelId: string, _ts: string, _options: EditMessageOptions): Promise<SlackMessage>;
|
|
74
|
+
/**
|
|
75
|
+
* Add a reaction to a message.
|
|
76
|
+
*
|
|
77
|
+
* @param channelId - The channel containing the message
|
|
78
|
+
* @param ts - The timestamp of the message to react to
|
|
79
|
+
* @param emoji - The emoji name (without colons)
|
|
80
|
+
*/
|
|
81
|
+
addReaction(_channelId: string, _ts: string, _emoji: string): Promise<void>;
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=slack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slack.d.ts","sourceRoot":"","sources":["../../src/runtime/slack.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,YAAY,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAElC;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAgBD,KAAK,cAAc,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AACpE,KAAK,mBAAmB,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAEvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,KAAK;IAChB;;;;OAIG;wBACiB,cAAc,GAAG,IAAI;IAIzC;;;;OAIG;sBACe,mBAAmB,GAAG,IAAI;IAI5C;;;;;OAKG;0BACyB,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC;IAItE;;;;;;;OAOG;4BAEW,MAAM,OACb,MAAM,YACD,kBAAkB,GAC3B,OAAO,CAAC,YAAY,CAAC;IAIxB;;;;;;OAMG;4BAEW,MAAM,OACb,MAAM,UACH,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;CAGjB,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slack integration for Fling applications (Local runtime)
|
|
3
|
+
*
|
|
4
|
+
* Provides helpers for building Slack chatops bots.
|
|
5
|
+
* This is the local development version - the worker version is in worker-runtime.
|
|
6
|
+
*
|
|
7
|
+
* Note: Slack features require the Slack plugin to be installed.
|
|
8
|
+
* Run `fling plugin install slack` to set up.
|
|
9
|
+
*/
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// Slack API (Local Runtime - Stubs)
|
|
12
|
+
// =============================================================================
|
|
13
|
+
/**
|
|
14
|
+
* Local runtime warning - Slack features only work in deployed workers.
|
|
15
|
+
*/
|
|
16
|
+
function localRuntimeWarning(method) {
|
|
17
|
+
throw new Error(`slack.${method}() is only available in deployed workers. ` +
|
|
18
|
+
"Use 'fling push' to deploy, then test your Slack integration.");
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Slack integration helper.
|
|
22
|
+
*
|
|
23
|
+
* Provides methods for sending messages, handling mentions,
|
|
24
|
+
* and reacting to Slack events.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* import { slack } from "flingit/plugin/slack";
|
|
29
|
+
*
|
|
30
|
+
* // Handle mentions
|
|
31
|
+
* slack.onMention(async (event) => {
|
|
32
|
+
* await slack.sendMessage({
|
|
33
|
+
* channelId: event.channel,
|
|
34
|
+
* text: `Hello <@${event.user}>!`,
|
|
35
|
+
* });
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export const slack = {
|
|
40
|
+
/**
|
|
41
|
+
* Register a handler for app mention events.
|
|
42
|
+
*
|
|
43
|
+
* @param handler - Function to call when the bot is mentioned
|
|
44
|
+
*/
|
|
45
|
+
onMention(_handler) {
|
|
46
|
+
localRuntimeWarning("onMention");
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* Register a handler for all Slack events.
|
|
50
|
+
*
|
|
51
|
+
* @param handler - Function to call for each event
|
|
52
|
+
*/
|
|
53
|
+
onEvent(_handler) {
|
|
54
|
+
localRuntimeWarning("onEvent");
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Send a message to a Slack channel.
|
|
58
|
+
*
|
|
59
|
+
* @param options - Message content and target channel
|
|
60
|
+
* @returns The sent message
|
|
61
|
+
*/
|
|
62
|
+
async sendMessage(_options) {
|
|
63
|
+
localRuntimeWarning("sendMessage");
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* Edit a previously sent message.
|
|
67
|
+
*
|
|
68
|
+
* @param channelId - The channel containing the message
|
|
69
|
+
* @param ts - The timestamp of the message to edit
|
|
70
|
+
* @param options - New message content
|
|
71
|
+
* @returns The edited message
|
|
72
|
+
*/
|
|
73
|
+
async editMessage(_channelId, _ts, _options) {
|
|
74
|
+
localRuntimeWarning("editMessage");
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* Add a reaction to a message.
|
|
78
|
+
*
|
|
79
|
+
* @param channelId - The channel containing the message
|
|
80
|
+
* @param ts - The timestamp of the message to react to
|
|
81
|
+
* @param emoji - The emoji name (without colons)
|
|
82
|
+
*/
|
|
83
|
+
async addReaction(_channelId, _ts, _emoji) {
|
|
84
|
+
localRuntimeWarning("addReaction");
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=slack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slack.js","sourceRoot":"","sources":["../../src/runtime/slack.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA+BH,gFAAgF;AAChF,oCAAoC;AACpC,gFAAgF;AAEhF;;GAEG;AACH,SAAS,mBAAmB,CAAC,MAAc;IACzC,MAAM,IAAI,KAAK,CACb,SAAS,MAAM,4CAA4C;QACzD,+DAA+D,CAClE,CAAC;AACJ,CAAC;AAKD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB;;;;OAIG;IACH,SAAS,CAAC,QAAwB;QAChC,mBAAmB,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,QAA6B;QACnC,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CAAC,QAA4B;QAC5C,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,WAAW,CACf,UAAkB,EAClB,GAAW,EACX,QAA4B;QAE5B,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,WAAW,CACf,UAAkB,EAClB,GAAW,EACX,MAAc;QAEd,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;CACF,CAAC"}
|
|
@@ -4,30 +4,6 @@
|
|
|
4
4
|
* These are the canonical definitions — runtime modules re-export them
|
|
5
5
|
* so user code can import from "flingit/plugin/discord".
|
|
6
6
|
*/
|
|
7
|
-
/**
|
|
8
|
-
* Discord slash command definition.
|
|
9
|
-
*/
|
|
10
|
-
export interface DiscordSlashCommand {
|
|
11
|
-
/** Command name (1-32 chars, lowercase alphanumeric + hyphens) */
|
|
12
|
-
name: string;
|
|
13
|
-
/** Command description (1-100 chars) */
|
|
14
|
-
description: string;
|
|
15
|
-
/** Command options/arguments */
|
|
16
|
-
options?: DiscordCommandOption[];
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Discord command option (argument).
|
|
20
|
-
*/
|
|
21
|
-
export interface DiscordCommandOption {
|
|
22
|
-
name: string;
|
|
23
|
-
description: string;
|
|
24
|
-
type: "string" | "integer" | "boolean" | "user" | "channel" | "role";
|
|
25
|
-
required?: boolean;
|
|
26
|
-
choices?: Array<{
|
|
27
|
-
name: string;
|
|
28
|
-
value: string | number;
|
|
29
|
-
}>;
|
|
30
|
-
}
|
|
31
7
|
/**
|
|
32
8
|
* Discord interaction from a slash command.
|
|
33
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discord-types.d.ts","sourceRoot":"","sources":["../../src/shared/discord-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"discord-types.d.ts","sourceRoot":"","sources":["../../src/shared/discord-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,qBAAqB;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,MAAM,CAAC,EAAE;QACP,IAAI,EAAE;YACJ,EAAE,EAAE,MAAM,CAAC;YACX,QAAQ,EAAE,MAAM,CAAC;YACjB,aAAa,EAAE,MAAM,CAAC;SACvB,CAAC;QACF,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,kCAAkC;IAClC,IAAI,CAAC,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,mBAAmB;IACnB,IAAI,CAAC,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,KAAK,CAAC;YACd,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;SAClC,CAAC,CAAC;KACJ,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3D,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACnE;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin metadata registry — the single source of truth for plugin identity,
|
|
3
|
+
* display strings, and technical wiring.
|
|
4
|
+
*
|
|
5
|
+
* Consumers (CLI, bundler, runtime) should read from this registry
|
|
6
|
+
* instead of hardcoding per-plugin conditionals.
|
|
7
|
+
*/
|
|
8
|
+
export interface PluginMeta {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
hasOAuth: boolean;
|
|
13
|
+
resourceType: string;
|
|
14
|
+
resourceTypePlural: string;
|
|
15
|
+
userLabel: string;
|
|
16
|
+
apis: string[];
|
|
17
|
+
removalNote: string[];
|
|
18
|
+
serviceBinding: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get metadata for a specific plugin by ID.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getPluginMeta(id: string): PluginMeta | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Get all supported plugin IDs.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getSupportedPluginIds(): string[];
|
|
28
|
+
//# sourceMappingURL=plugin-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-metadata.d.ts","sourceRoot":"","sources":["../../src/shared/plugin-metadata.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAElB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,EAAE,MAAM,EAAE,CAAC;IAEtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAgDD;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAEhE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAEhD"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin metadata registry — the single source of truth for plugin identity,
|
|
3
|
+
* display strings, and technical wiring.
|
|
4
|
+
*
|
|
5
|
+
* Consumers (CLI, bundler, runtime) should read from this registry
|
|
6
|
+
* instead of hardcoding per-plugin conditionals.
|
|
7
|
+
*/
|
|
8
|
+
const pluginMetadata = [
|
|
9
|
+
{
|
|
10
|
+
id: "discord",
|
|
11
|
+
name: "Discord",
|
|
12
|
+
description: "Discord chatops integration",
|
|
13
|
+
hasOAuth: true,
|
|
14
|
+
resourceType: "server",
|
|
15
|
+
resourceTypePlural: "Servers",
|
|
16
|
+
userLabel: "User",
|
|
17
|
+
apis: [
|
|
18
|
+
"discord.onCommand(name, description, handler)",
|
|
19
|
+
"discord.onEvent(handler)",
|
|
20
|
+
"discord.reply(interaction, content)",
|
|
21
|
+
"discord.followup(interaction, content)",
|
|
22
|
+
"discord.sendMessage(options)",
|
|
23
|
+
"discord.editMessage(channelId, messageId, options)",
|
|
24
|
+
"discord.addReaction(channelId, messageId, emoji)",
|
|
25
|
+
],
|
|
26
|
+
removalNote: [
|
|
27
|
+
"Note: Fling Bot will remain in your Discord servers.",
|
|
28
|
+
"You can kick it from Server Settings > Members if desired.",
|
|
29
|
+
],
|
|
30
|
+
serviceBinding: "DISCORD_PLUGIN",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "slack",
|
|
34
|
+
name: "Slack",
|
|
35
|
+
description: "Slack chatops integration",
|
|
36
|
+
hasOAuth: true,
|
|
37
|
+
resourceType: "workspace",
|
|
38
|
+
resourceTypePlural: "Workspaces",
|
|
39
|
+
userLabel: "Workspace",
|
|
40
|
+
apis: [
|
|
41
|
+
"slack.onMention()",
|
|
42
|
+
"slack.sendMessage()",
|
|
43
|
+
"slack.editMessage()",
|
|
44
|
+
"slack.addReaction()",
|
|
45
|
+
],
|
|
46
|
+
removalNote: [
|
|
47
|
+
"Note: The Fling app will remain in your Slack workspaces.",
|
|
48
|
+
"You can remove it from Apps section in Slack settings if desired.",
|
|
49
|
+
],
|
|
50
|
+
serviceBinding: "SLACK_PLUGIN",
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
/**
|
|
54
|
+
* Get metadata for a specific plugin by ID.
|
|
55
|
+
*/
|
|
56
|
+
export function getPluginMeta(id) {
|
|
57
|
+
return pluginMetadata.find((p) => p.id === id);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get all supported plugin IDs.
|
|
61
|
+
*/
|
|
62
|
+
export function getSupportedPluginIds() {
|
|
63
|
+
return pluginMetadata.map((p) => p.id);
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=plugin-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-metadata.js","sourceRoot":"","sources":["../../src/shared/plugin-metadata.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAiBH,MAAM,cAAc,GAAiB;IACnC;QACE,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,6BAA6B;QAC1C,QAAQ,EAAE,IAAI;QACd,YAAY,EAAE,QAAQ;QACtB,kBAAkB,EAAE,SAAS;QAC7B,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE;YACJ,+CAA+C;YAC/C,0BAA0B;YAC1B,qCAAqC;YACrC,wCAAwC;YACxC,8BAA8B;YAC9B,oDAAoD;YACpD,kDAAkD;SACnD;QACD,WAAW,EAAE;YACX,sDAAsD;YACtD,4DAA4D;SAC7D;QACD,cAAc,EAAE,gBAAgB;KACjC;IACD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,2BAA2B;QACxC,QAAQ,EAAE,IAAI;QACd,YAAY,EAAE,WAAW;QACzB,kBAAkB,EAAE,YAAY;QAChC,SAAS,EAAE,WAAW;QACtB,IAAI,EAAE;YACJ,mBAAmB;YACnB,qBAAqB;YACrB,qBAAqB;YACrB,qBAAqB;SACtB;QACD,WAAW,EAAE;YACX,2DAA2D;YAC3D,mEAAmE;SACpE;QACD,cAAc,EAAE,cAAc;KAC/B;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,EAAU;IACtC,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACjD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Slack types used by both the plugin worker and worker runtime.
|
|
3
|
+
*
|
|
4
|
+
* These are the canonical definitions — runtime modules re-export them
|
|
5
|
+
* so user code can import from "flingit/plugin/slack".
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Slack event payload forwarded to user workers.
|
|
9
|
+
*/
|
|
10
|
+
export interface SlackEvent {
|
|
11
|
+
/** Event type: "event_callback" | "app_mention" */
|
|
12
|
+
type: string;
|
|
13
|
+
/** Slack team (workspace) ID */
|
|
14
|
+
team_id?: string;
|
|
15
|
+
/** Channel where the event occurred */
|
|
16
|
+
channel_id?: string;
|
|
17
|
+
/** User who triggered the event */
|
|
18
|
+
user_id?: string;
|
|
19
|
+
/** For event_callback payloads */
|
|
20
|
+
event?: {
|
|
21
|
+
type: string;
|
|
22
|
+
text: string;
|
|
23
|
+
user: string;
|
|
24
|
+
channel: string;
|
|
25
|
+
ts: string;
|
|
26
|
+
thread_ts?: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Slack Block Kit block.
|
|
31
|
+
*/
|
|
32
|
+
export interface SlackBlock {
|
|
33
|
+
type: string;
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Slack message response.
|
|
38
|
+
*/
|
|
39
|
+
export interface SlackMessage {
|
|
40
|
+
channelId: string;
|
|
41
|
+
ts: string;
|
|
42
|
+
text: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Options for sending a message.
|
|
46
|
+
*/
|
|
47
|
+
export interface SendMessageOptions {
|
|
48
|
+
channelId: string;
|
|
49
|
+
text?: string;
|
|
50
|
+
blocks?: SlackBlock[];
|
|
51
|
+
/** Reply in thread */
|
|
52
|
+
threadTs?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Options for editing a message.
|
|
56
|
+
*/
|
|
57
|
+
export interface EditMessageOptions {
|
|
58
|
+
text?: string;
|
|
59
|
+
blocks?: SlackBlock[];
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=slack-types.d.ts.map
|