slack.ts 0.0.6 → 0.0.8
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/scripts/add_api_methods.d.ts +2 -0
- package/dist/scripts/add_api_methods.d.ts.map +1 -0
- package/dist/scripts/add_api_methods.js +30 -0
- package/dist/{events/types → src/api/events}/events.d.ts +1 -1
- package/dist/src/api/events/events.d.ts.map +1 -0
- package/dist/{events/types → src/api/events}/index.d.ts +2 -19
- package/dist/src/api/events/index.d.ts.map +1 -0
- package/dist/{api → src/api}/index.d.ts +52 -7
- package/dist/src/api/index.d.ts.map +1 -0
- package/dist/src/api/index.js +14 -0
- package/dist/{api → src/api}/interactive/block_actions.d.ts +9 -4
- package/dist/src/api/interactive/block_actions.d.ts.map +1 -0
- package/dist/src/api/interactive/common.d.ts.map +1 -0
- package/dist/{api → src/api}/interactive/view_submission.d.ts +3 -2
- package/dist/src/api/interactive/view_submission.d.ts.map +1 -0
- package/dist/src/api/slash/index.d.ts +18 -0
- package/dist/src/api/slash/index.d.ts.map +1 -0
- package/dist/src/api/types/api.d.ts.map +1 -0
- package/dist/{api → src/api}/types/conversation.d.ts +7 -7
- package/dist/src/api/types/conversation.d.ts.map +1 -0
- package/dist/src/api/types/file.d.ts +52 -0
- package/dist/src/api/types/file.d.ts.map +1 -0
- package/dist/{api → src/api}/types/message.d.ts +29 -9
- package/dist/src/api/types/message.d.ts.map +1 -0
- package/dist/src/api/types/user.d.ts.map +1 -0
- package/dist/src/api/types/value.d.ts.map +1 -0
- package/dist/{api → src/api}/types/view.d.ts +4 -4
- package/dist/src/api/types/view.d.ts.map +1 -0
- package/dist/src/api/web/apps.d.ts +219 -0
- package/dist/src/api/web/apps.d.ts.map +1 -0
- package/dist/src/api/web/auth.d.ts +39 -0
- package/dist/src/api/web/auth.d.ts.map +1 -0
- package/dist/src/api/web/bots.d.ts +22 -0
- package/dist/src/api/web/bots.d.ts.map +1 -0
- package/dist/{api → src/api}/web/chat.d.ts +14 -0
- package/dist/src/api/web/chat.d.ts.map +1 -0
- package/dist/{api → src/api}/web/conversations.d.ts +30 -10
- package/dist/src/api/web/conversations.d.ts.map +1 -0
- package/dist/{api → src/api}/web/files.d.ts +4 -3
- package/dist/src/api/web/files.d.ts.map +1 -0
- package/dist/src/api/web/users.d.ts.map +1 -0
- package/dist/src/api/web/users.js +1 -0
- package/dist/src/api/web/views.d.ts.map +1 -0
- package/dist/src/api/web/views.js +1 -0
- package/dist/{builders → src}/blocks/actions.d.ts +4 -3
- package/dist/src/blocks/actions.d.ts.map +1 -0
- package/dist/{builders → src}/blocks/base.d.ts +3 -2
- package/dist/src/blocks/base.d.ts.map +1 -0
- package/dist/{builders → src}/blocks/base.js +1 -0
- package/dist/src/blocks/elements/base.d.ts +10 -0
- package/dist/src/blocks/elements/base.d.ts.map +1 -0
- package/dist/{builders → src}/blocks/elements/base.js +2 -2
- package/dist/{builders → src}/blocks/elements/button.d.ts +2 -2
- package/dist/src/blocks/elements/button.d.ts.map +1 -0
- package/dist/{builders → src}/blocks/elements/button.js +3 -3
- package/dist/{builders → src}/blocks/elements/index.d.ts +1 -0
- package/dist/src/blocks/elements/index.d.ts.map +1 -0
- package/dist/{builders → src}/blocks/elements/index.js +1 -0
- package/dist/src/blocks/elements/overflow.d.ts +30 -0
- package/dist/src/blocks/elements/overflow.d.ts.map +1 -0
- package/dist/src/blocks/elements/overflow.js +28 -0
- package/dist/src/blocks/elements/plain_text_input.d.ts +27 -0
- package/dist/src/blocks/elements/plain_text_input.d.ts.map +1 -0
- package/dist/src/blocks/elements/plain_text_input.js +58 -0
- package/dist/src/blocks/index.d.ts.map +1 -0
- package/dist/{builders → src}/blocks/input.d.ts +5 -5
- package/dist/src/blocks/input.d.ts.map +1 -0
- package/dist/{builders → src}/blocks/input.js +1 -1
- package/dist/src/blocks/objects/confirm.d.ts +34 -0
- package/dist/src/blocks/objects/confirm.d.ts.map +1 -0
- package/dist/src/blocks/objects/confirm.js +54 -0
- package/dist/{builders → src}/blocks/objects/index.d.ts +2 -0
- package/dist/src/blocks/objects/index.d.ts.map +1 -0
- package/dist/src/blocks/objects/index.js +3 -0
- package/dist/src/blocks/objects/option.d.ts +17 -0
- package/dist/src/blocks/objects/option.d.ts.map +1 -0
- package/dist/src/blocks/objects/option.js +21 -0
- package/dist/{builders → src}/blocks/objects/text.d.ts +3 -0
- package/dist/src/blocks/objects/text.d.ts.map +1 -0
- package/dist/{builders → src}/blocks/objects/text.js +5 -1
- package/dist/src/blocks/section.d.ts +42 -0
- package/dist/src/blocks/section.d.ts.map +1 -0
- package/dist/src/blocks/section.js +48 -0
- package/dist/src/blocks/utils/extract.d.ts +56 -0
- package/dist/src/blocks/utils/extract.d.ts.map +1 -0
- package/dist/src/blocks/utils/extract.js +1 -0
- package/dist/{client.d.ts → src/client.d.ts} +43 -7
- package/dist/src/client.d.ts.map +1 -0
- package/dist/{client.js → src/client.js} +16 -3
- package/dist/src/error.d.ts.map +1 -0
- package/dist/{index.d.ts → src/index.d.ts} +1 -1
- package/dist/src/index.d.ts.map +1 -0
- package/dist/{index.js → src/index.js} +1 -1
- package/dist/src/receivers/base.d.ts +23 -0
- package/dist/src/receivers/base.d.ts.map +1 -0
- package/dist/src/receivers/base.js +1 -0
- package/dist/{events → src}/receivers/dummy.d.ts +1 -1
- package/dist/src/receivers/dummy.d.ts.map +1 -0
- package/dist/{events → src}/receivers/socket.d.ts +2 -2
- package/dist/src/receivers/socket.d.ts.map +1 -0
- package/dist/{events → src}/receivers/socket.js +4 -0
- package/dist/{resources → src/resources}/action.d.ts +1 -1
- package/dist/src/resources/action.d.ts.map +1 -0
- package/dist/{resources → src/resources}/action.js +2 -2
- package/dist/{resources → src/resources}/channel.d.ts +6 -5
- package/dist/src/resources/channel.d.ts.map +1 -0
- package/dist/{resources → src/resources}/message.d.ts +20 -17
- package/dist/src/resources/message.d.ts.map +1 -0
- package/dist/{resources → src/resources}/message.js +6 -7
- package/dist/src/resources/modal.d.ts +22 -0
- package/dist/src/resources/modal.d.ts.map +1 -0
- package/dist/src/resources/slash.d.ts +15 -0
- package/dist/src/resources/slash.d.ts.map +1 -0
- package/dist/src/resources/slash.js +22 -0
- package/dist/src/resources/submission.d.ts +13 -0
- package/dist/src/resources/submission.d.ts.map +1 -0
- package/dist/{resources → src/resources}/submission.js +5 -2
- package/dist/src/resources/user.d.ts.map +1 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/messaging.d.ts +34 -0
- package/dist/src/utils/messaging.d.ts.map +1 -0
- package/dist/{utils → src/utils}/messaging.js +12 -2
- package/dist/{utils → src/utils}/paginate.d.ts +2 -2
- package/dist/src/utils/paginate.d.ts.map +1 -0
- package/dist/src/utils/respond.d.ts +24 -0
- package/dist/src/utils/respond.d.ts.map +1 -0
- package/dist/{utils → src/utils}/respond.js +1 -1
- package/dist/src/utils/typing.d.ts.map +1 -0
- package/dist/src/utils/typing.js +1 -0
- package/package.json +2 -2
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/index.js +0 -6
- package/dist/api/interactive/block_actions.d.ts.map +0 -1
- package/dist/api/interactive/common.d.ts.map +0 -1
- package/dist/api/interactive/view_submission.d.ts.map +0 -1
- package/dist/api/types/api.d.ts.map +0 -1
- package/dist/api/types/conversation.d.ts.map +0 -1
- package/dist/api/types/message.d.ts.map +0 -1
- package/dist/api/types/user.d.ts.map +0 -1
- package/dist/api/types/value.d.ts.map +0 -1
- package/dist/api/types/view.d.ts.map +0 -1
- package/dist/api/web/apps.d.ts +0 -6
- package/dist/api/web/apps.d.ts.map +0 -1
- package/dist/api/web/auth.d.ts +0 -13
- package/dist/api/web/auth.d.ts.map +0 -1
- package/dist/api/web/chat.d.ts.map +0 -1
- package/dist/api/web/conversations.d.ts.map +0 -1
- package/dist/api/web/files.d.ts.map +0 -1
- package/dist/api/web/users.d.ts.map +0 -1
- package/dist/api/web/views.d.ts.map +0 -1
- package/dist/builders/blocks/actions.d.ts.map +0 -1
- package/dist/builders/blocks/base.d.ts.map +0 -1
- package/dist/builders/blocks/elements/base.d.ts +0 -9
- package/dist/builders/blocks/elements/base.d.ts.map +0 -1
- package/dist/builders/blocks/elements/button.d.ts.map +0 -1
- package/dist/builders/blocks/elements/index.d.ts.map +0 -1
- package/dist/builders/blocks/elements/plain_text_input.d.ts +0 -12
- package/dist/builders/blocks/elements/plain_text_input.d.ts.map +0 -1
- package/dist/builders/blocks/elements/plain_text_input.js +0 -12
- package/dist/builders/blocks/index.d.ts.map +0 -1
- package/dist/builders/blocks/input.d.ts.map +0 -1
- package/dist/builders/blocks/objects/index.d.ts.map +0 -1
- package/dist/builders/blocks/objects/index.js +0 -1
- package/dist/builders/blocks/objects/text.d.ts.map +0 -1
- package/dist/builders/blocks/section.d.ts +0 -24
- package/dist/builders/blocks/section.d.ts.map +0 -1
- package/dist/builders/blocks/section.js +0 -22
- package/dist/builders/index.d.ts +0 -2
- package/dist/builders/index.d.ts.map +0 -1
- package/dist/builders/index.js +0 -1
- package/dist/client.d.ts.map +0 -1
- package/dist/error.d.ts.map +0 -1
- package/dist/events/receivers/dummy.d.ts.map +0 -1
- package/dist/events/receivers/socket.d.ts.map +0 -1
- package/dist/events/types/events.d.ts.map +0 -1
- package/dist/events/types/index.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/resources/action.d.ts.map +0 -1
- package/dist/resources/channel.d.ts.map +0 -1
- package/dist/resources/message.d.ts.map +0 -1
- package/dist/resources/modal.d.ts +0 -21
- package/dist/resources/modal.d.ts.map +0 -1
- package/dist/resources/submission.d.ts +0 -11
- package/dist/resources/submission.d.ts.map +0 -1
- package/dist/resources/user.d.ts.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/messaging.d.ts +0 -28
- package/dist/utils/messaging.d.ts.map +0 -1
- package/dist/utils/paginate.d.ts.map +0 -1
- package/dist/utils/respond.d.ts +0 -31
- package/dist/utils/respond.d.ts.map +0 -1
- package/dist/utils/typing.d.ts.map +0 -1
- /package/dist/{events/types → src/api/events}/events.js +0 -0
- /package/dist/{events/types → src/api/events}/index.js +0 -0
- /package/dist/{api → src/api}/interactive/block_actions.js +0 -0
- /package/dist/{api → src/api}/interactive/common.d.ts +0 -0
- /package/dist/{api → src/api}/interactive/common.js +0 -0
- /package/dist/{api → src/api}/interactive/view_submission.js +0 -0
- /package/dist/{api/types/api.js → src/api/slash/index.js} +0 -0
- /package/dist/{api → src/api}/types/api.d.ts +0 -0
- /package/dist/{api/types/conversation.js → src/api/types/api.js} +0 -0
- /package/dist/{api/types/message.js → src/api/types/conversation.js} +0 -0
- /package/dist/{api/types/user.js → src/api/types/file.js} +0 -0
- /package/dist/{api/types/value.js → src/api/types/message.js} +0 -0
- /package/dist/{api → src/api}/types/user.d.ts +0 -0
- /package/dist/{api/types/view.js → src/api/types/user.js} +0 -0
- /package/dist/{api → src/api}/types/value.d.ts +0 -0
- /package/dist/{api/web/apps.js → src/api/types/value.js} +0 -0
- /package/dist/{api/web/auth.js → src/api/types/view.js} +0 -0
- /package/dist/{api/web/chat.js → src/api/web/apps.js} +0 -0
- /package/dist/{api/web/conversations.js → src/api/web/auth.js} +0 -0
- /package/dist/{api/web/files.js → src/api/web/bots.js} +0 -0
- /package/dist/{api/web/users.js → src/api/web/chat.js} +0 -0
- /package/dist/{api/web/views.js → src/api/web/conversations.js} +0 -0
- /package/dist/{utils/typing.js → src/api/web/files.js} +0 -0
- /package/dist/{api → src/api}/web/users.d.ts +0 -0
- /package/dist/{api → src/api}/web/views.d.ts +0 -0
- /package/dist/{builders → src}/blocks/actions.js +0 -0
- /package/dist/{builders → src}/blocks/index.d.ts +0 -0
- /package/dist/{builders → src}/blocks/index.js +0 -0
- /package/dist/{error.d.ts → src/error.d.ts} +0 -0
- /package/dist/{error.js → src/error.js} +0 -0
- /package/dist/{events → src}/receivers/dummy.js +0 -0
- /package/dist/{resources → src/resources}/channel.js +0 -0
- /package/dist/{resources → src/resources}/modal.js +0 -0
- /package/dist/{resources → src/resources}/user.d.ts +0 -0
- /package/dist/{resources → src/resources}/user.js +0 -0
- /package/dist/{utils → src/utils}/index.d.ts +0 -0
- /package/dist/{utils → src/utils}/index.js +0 -0
- /package/dist/{utils → src/utils}/paginate.js +0 -0
- /package/dist/{utils → src/utils}/typing.d.ts +0 -0
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import EventEmitter from "events";
|
|
2
2
|
import { POST_METHODS, } from "./api/index.js";
|
|
3
3
|
import { SlackWebAPIError, SlackWebAPIPlatformError } from "./error.js";
|
|
4
|
-
import { DummyReceiver } from "./
|
|
5
|
-
import { SocketEventsReceiver } from "./
|
|
4
|
+
import { DummyReceiver } from "./receivers/dummy.js";
|
|
5
|
+
import { SocketEventsReceiver } from "./receivers/socket.js";
|
|
6
6
|
import { Action } from "./resources/action.js";
|
|
7
|
-
import { ChannelRef } from "./resources/channel.js";
|
|
7
|
+
import { Channel, ChannelRef } from "./resources/channel.js";
|
|
8
8
|
import { Message } from "./resources/message.js";
|
|
9
9
|
import { sleep } from "./utils/index.js";
|
|
10
|
+
import { SlashCommand } from "./resources/slash.js";
|
|
11
|
+
import { paginate } from "./utils/paginate.js";
|
|
10
12
|
export class App extends EventEmitter {
|
|
11
13
|
#token;
|
|
12
14
|
#receiver;
|
|
@@ -24,6 +26,7 @@ export class App extends EventEmitter {
|
|
|
24
26
|
this.#receiver.on("event", this.#onEvent.bind(this));
|
|
25
27
|
this.#receiver.on("block_actions", this.#onBlockActions.bind(this));
|
|
26
28
|
this.#receiver.on("view_submission", this.#onViewSubmission.bind(this));
|
|
29
|
+
this.#receiver.on("slash_command", this.#onSlashCommand.bind(this));
|
|
27
30
|
this.on("event:message", this.#onMessage.bind(this));
|
|
28
31
|
}
|
|
29
32
|
#onEvent(event) {
|
|
@@ -43,6 +46,11 @@ export class App extends EventEmitter {
|
|
|
43
46
|
this.emit("submit", event);
|
|
44
47
|
this.emit(`submit.${event.view.callback_id}`, event);
|
|
45
48
|
}
|
|
49
|
+
#onSlashCommand(event) {
|
|
50
|
+
const command = new SlashCommand(this, event);
|
|
51
|
+
this.emit("slash", command);
|
|
52
|
+
this.emit(`/${event.command.substring(1)}`, command);
|
|
53
|
+
}
|
|
46
54
|
async #onCallbackError(error) {
|
|
47
55
|
console.error("Error occurred executing callback");
|
|
48
56
|
console.error(error);
|
|
@@ -50,6 +58,8 @@ export class App extends EventEmitter {
|
|
|
50
58
|
#onMessage({ payload }) {
|
|
51
59
|
const message = new Message(this, payload.channel, payload.ts, payload);
|
|
52
60
|
this.emit("message", message);
|
|
61
|
+
this.emit(`message:${payload.subtype ?? "normal"}`, message);
|
|
62
|
+
this.emit(`message:${payload.subtype ?? "normal"}#${payload.channel}`, message);
|
|
53
63
|
this.emit(`message#${payload.channel}`, message);
|
|
54
64
|
}
|
|
55
65
|
/**
|
|
@@ -109,6 +119,9 @@ export class App extends EventEmitter {
|
|
|
109
119
|
channel(id) {
|
|
110
120
|
return new ChannelRef(this, id);
|
|
111
121
|
}
|
|
122
|
+
async *channels(...types) {
|
|
123
|
+
yield* paginate(this, "conversations.list", { types: types.join(",") }, (r) => r.channels.map((c) => new Channel(this, c.id, c)));
|
|
124
|
+
}
|
|
112
125
|
/**
|
|
113
126
|
* Makes a Slack Web API request.
|
|
114
127
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAW,SAAQ,KAAK;CAAG;AAExC,qBAAa,iBAAkB,SAAQ,KAAK;CAAG;AAE/C,qBAAa,gBAAiB,SAAQ,UAAU;IAEvC,GAAG,EAAE,MAAM;IACX,IAAI,CAAC,EAAE,OAAO;gBADd,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,OAAO,YAAA;CAItB;AAED,qBAAa,wBAAyB,SAAQ,gBAAgB;IAIrD,KAAK,EAAE,MAAM;gBAFpB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,OAAO,EACN,KAAK,EAAE,MAAM;CAIrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type EventEmitter from "events";
|
|
2
|
+
import type { AllEvents, EventWrapper } from "../api/events/index.js";
|
|
3
|
+
import type { BlockActions } from "../api/interactive/block_actions.js";
|
|
4
|
+
import type { ViewSubmission } from "../api/interactive/view_submission.js";
|
|
5
|
+
import type { SlashCommandPayload } from "../api/slash/index.js";
|
|
6
|
+
export interface EventsReceiver extends EventEmitter<ReceiverEventMap> {
|
|
7
|
+
start(): unknown;
|
|
8
|
+
}
|
|
9
|
+
export type ReceiverEventMap = {
|
|
10
|
+
event: [
|
|
11
|
+
EventWrapper<AllEvents>
|
|
12
|
+
];
|
|
13
|
+
block_actions: [
|
|
14
|
+
BlockActions
|
|
15
|
+
];
|
|
16
|
+
view_submission: [
|
|
17
|
+
ViewSubmission
|
|
18
|
+
];
|
|
19
|
+
slash_command: [
|
|
20
|
+
SlashCommandPayload
|
|
21
|
+
];
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/receivers/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAA;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAEvD,MAAM,WAAW,cAAe,SAAQ,YAAY,CAAC,gBAAgB,CAAC;IACrE,KAAK,IAAI,OAAO,CAAA;CAChB;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC9B,KAAK,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAA;IAChC,aAAa,EAAE,CAAC,YAAY,CAAC,CAAA;IAC7B,eAAe,EAAE,CAAC,cAAc,CAAC,CAAA;IACjC,aAAa,EAAE,CAAC,mBAAmB,CAAC,CAAA;CACpC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from "events";
|
|
2
|
-
import type { EventsReceiver, ReceiverEventMap } from "
|
|
2
|
+
import type { EventsReceiver, ReceiverEventMap } from "./base.js";
|
|
3
3
|
export declare class DummyReceiver extends EventEmitter<ReceiverEventMap> implements EventsReceiver {
|
|
4
4
|
constructor();
|
|
5
5
|
start(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dummy.d.ts","sourceRoot":"","sources":["../../../src/receivers/dummy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AAE9D,qBAAa,aAAc,SAAQ,YAAY,CAAC,gBAAgB,CAAE,YAAW,cAAc;;IAK1F,KAAK;CACL"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import EventEmitter from "events";
|
|
2
|
-
import type { App } from "
|
|
3
|
-
import type { EventsReceiver, ReceiverEventMap } from "
|
|
2
|
+
import type { App } from "../client.js";
|
|
3
|
+
import type { EventsReceiver, ReceiverEventMap } from "./base.js";
|
|
4
4
|
export interface SocketEventsReceiverOptions {
|
|
5
5
|
appToken: string;
|
|
6
6
|
client: App;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../../src/receivers/socket.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,QAAQ,CAAA;AAIjC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AAG9D,MAAM,WAAW,2BAA2B;IAC3C,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,GAAG,CAAA;CACX;AAED,qBAAa,oBAAqB,SAAQ,YAAY,CAAC,gBAAgB,CAAE,YAAW,cAAc;;IAE1F,MAAM,EAAE,GAAG,CAAA;gBAGN,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,2BAA2B;IAYvD,KAAK;YAIG,QAAQ;CA6CtB"}
|
|
@@ -40,6 +40,10 @@ export class SocketEventsReceiver extends EventEmitter {
|
|
|
40
40
|
this.#ws?.send(JSON.stringify({ envelope_id: data.envelope_id }));
|
|
41
41
|
this.emit(data.payload.type, data.payload);
|
|
42
42
|
}
|
|
43
|
+
else if (data.type === 'slash_commands') {
|
|
44
|
+
this.#ws?.send(JSON.stringify({ envelope_id: data.envelope_id }));
|
|
45
|
+
this.emit('slash_command', data.payload);
|
|
46
|
+
}
|
|
43
47
|
else if (data.type === 'hello') {
|
|
44
48
|
console.debug('[socket-mode] received server hello, app id', data.connection_info.app_id);
|
|
45
49
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BlockAction, BlockActions } from "../api/interactive/block_actions.js";
|
|
2
2
|
import type { App } from "../client.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Responder } from "../utils/respond.js";
|
|
4
4
|
export declare class Action<Type extends BlockAction = BlockAction> {
|
|
5
5
|
#private;
|
|
6
6
|
protected client: App;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/resources/action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACjF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE5C,qBAAa,MAAM,CAAC,IAAI,SAAS,WAAW,GAAG,WAAW;;IAKxD,SAAS,CAAC,MAAM,EAAE,GAAG;gBAAX,MAAM,EAAE,GAAG,EACrB,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,YAAY;IAOpB,IAAI,KAAK,iBAER;IAED,IAAI,GAAG,SAEN;IAED,IAAI,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,CAE7B;CACD;AAED,MAAM,MAAM,cAAc,CAAC,IAAI,SAAS,WAAW,GAAG,WAAW,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { makeProxy } from "../utils/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Responder } from "../utils/respond.js";
|
|
3
3
|
export class Action {
|
|
4
4
|
client;
|
|
5
5
|
#data;
|
|
@@ -17,6 +17,6 @@ export class Action {
|
|
|
17
17
|
return this.#data;
|
|
18
18
|
}
|
|
19
19
|
get respond() {
|
|
20
|
-
return new
|
|
20
|
+
return new Responder(this.client, this.#event.response_url, this.#event.trigger_id);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { KnownBlock } from "@slack/types";
|
|
1
2
|
import type { TimestampPaginationParams } from "../api/types/api.js";
|
|
2
3
|
import type { Conversation } from "../api/types/conversation.js";
|
|
3
4
|
import type { NormalMessage } from "../api/types/message.js";
|
|
@@ -38,7 +39,7 @@ declare class ChannelMixin {
|
|
|
38
39
|
* @param message The message payload to send, either a mrkdwn-formatted string or an object.
|
|
39
40
|
* @returns The sent message
|
|
40
41
|
*/
|
|
41
|
-
send(message: DistributiveOmit<SendMessageWithoutFiles
|
|
42
|
+
send<Blocks extends KnownBlock[] = KnownBlock[]>(message: DistributiveOmit<SendMessageWithoutFiles<Blocks>, "channel"> | string): Promise<MessageInstance<NormalMessage<Blocks>, Blocks>>;
|
|
42
43
|
/**
|
|
43
44
|
* Gets a message reference object. You can use this object to call API methods, or `await` it to
|
|
44
45
|
* fetch message details.
|
|
@@ -46,7 +47,7 @@ declare class ChannelMixin {
|
|
|
46
47
|
* @param ts The timestamp of the message
|
|
47
48
|
* @returns A message reference object
|
|
48
49
|
*/
|
|
49
|
-
message(ts: string): MessageRef<import("../api/types/message.js").AnyMessage>;
|
|
50
|
+
message(ts: string): MessageRef<import("../api/types/message.js").AnyMessage, KnownBlock[]>;
|
|
50
51
|
/**
|
|
51
52
|
* Fetches messages in the channel. Note that this method only fetches root messages (i.e.,
|
|
52
53
|
* messages not in a thread); to fetch thread replies, use the `replies` method on messages
|
|
@@ -61,11 +62,11 @@ export declare class ChannelRef extends ChannelMixin implements PromiseLike<Chan
|
|
|
61
62
|
#private;
|
|
62
63
|
then<TResult1 = ChannelInstance, TResult2 = never>(onfulfilled?: ((value: ChannelInstance) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): PromiseLike<TResult1 | TResult2>;
|
|
63
64
|
}
|
|
64
|
-
export declare class Channel extends ChannelMixin {
|
|
65
|
+
export declare class Channel<T extends Conversation = Conversation> extends ChannelMixin {
|
|
65
66
|
#private;
|
|
66
|
-
constructor(client: App, id: string, data:
|
|
67
|
+
constructor(client: App, id: string, data: T);
|
|
67
68
|
/** A reference to the creator of this channel. Only available for non-DM channels. */
|
|
68
|
-
get creator(): UserRef | undefined;
|
|
69
|
+
get creator(): undefined extends T["creator"] ? UserRef | undefined : UserRef;
|
|
69
70
|
}
|
|
70
71
|
export type ChannelInstance = Channel & DistributiveOmit<Conversation, "creator">;
|
|
71
72
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel.d.ts","s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,CAAC,EAAE,MAAM,CAAC,CAAC;IAiB1D;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM;IAIlB;;;;;;;OAOG;IACI,QAAQ,CAAC,MAAM,GAAE,mBAAwB;CAOhD;AAED,qBAAa,UAAW,SAAQ,YAAa,YAAW,WAAW,CAAC,eAAe,CAAC;;IACnF,IAAI,CAAC,QAAQ,GAAG,eAAe,EAAE,QAAQ,GAAG,KAAK,EAChD,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,eAAe,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EAC/F,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,GACjF,WAAW,CAAC,QAAQ,GAAG,QAAQ,CAAC;CAQnC;AAED,qBAAa,OAAO,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,CAAE,SAAQ,YAAY;;gBAGnE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAM5C,sFAAsF;IACtF,IAAI,OAAO,IAAI,SAAS,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAE5E;CACD;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,gBAAgB,CAAC,YAAY,EAAE,SAAS,CAAC,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { KnownBlock } from "@slack/types";
|
|
1
2
|
import type { BlockAction, BlockActionTypes } from "../api/interactive/block_actions.js";
|
|
2
3
|
import type { TimestampPaginationParams } from "../api/types/api.js";
|
|
3
4
|
import type { AnyMessage, NormalMessage } from "../api/types/message.js";
|
|
@@ -7,6 +8,7 @@ import type { DistributiveOmit } from "../utils/typing.js";
|
|
|
7
8
|
import type { ActionInstance } from "./action.js";
|
|
8
9
|
import { ChannelRef } from "./channel.js";
|
|
9
10
|
import { UserRef } from "./user.js";
|
|
11
|
+
import type { ActionsToPrefixedID, ExtractActions } from "../blocks/utils/extract.js";
|
|
10
12
|
interface FetchRepliesParams extends Omit<TimestampPaginationParams, "limit"> {
|
|
11
13
|
/**
|
|
12
14
|
* How many replies to fetch in each API call. This will not affect the number of returned
|
|
@@ -26,7 +28,7 @@ interface FetchRepliesParams extends Omit<TimestampPaginationParams, "limit"> {
|
|
|
26
28
|
*/
|
|
27
29
|
root?: boolean;
|
|
28
30
|
}
|
|
29
|
-
declare class MessageMixin {
|
|
31
|
+
declare class MessageMixin<Blocks extends KnownBlock[] = KnownBlock[]> {
|
|
30
32
|
#private;
|
|
31
33
|
protected client: App;
|
|
32
34
|
constructor(client: App, channel: string, ts: string);
|
|
@@ -40,7 +42,7 @@ declare class MessageMixin {
|
|
|
40
42
|
* Waits for an event about this message to occur before continuing. To configure the wait object,
|
|
41
43
|
* see its methods (for example, `message.wait.timeout(60000)`).
|
|
42
44
|
*/
|
|
43
|
-
get wait(): MessageWait
|
|
45
|
+
get wait(): MessageWait<Blocks>;
|
|
44
46
|
/**
|
|
45
47
|
* Sends a message as a reply to this messsage with files.
|
|
46
48
|
*
|
|
@@ -54,7 +56,7 @@ declare class MessageMixin {
|
|
|
54
56
|
* @param message The message payload to send, either a mrkdwn-formatted string or an object.
|
|
55
57
|
* @returns The sent message
|
|
56
58
|
*/
|
|
57
|
-
reply(message: DistributiveOmit<SendMessageWithoutFiles
|
|
59
|
+
reply<Blocks extends KnownBlock[] = KnownBlock[]>(message: DistributiveOmit<SendMessageWithoutFiles<Blocks>, "channel" | "thread_ts"> | string): Promise<MessageInstance<NormalMessage<Blocks>, Blocks>>;
|
|
58
60
|
/**
|
|
59
61
|
* Fetches replies in the thread of this message. Note that this method may return the root
|
|
60
62
|
* message by default; set `params.root` to `false` to skip it.
|
|
@@ -64,11 +66,11 @@ declare class MessageMixin {
|
|
|
64
66
|
*/
|
|
65
67
|
replies(params?: FetchRepliesParams): AsyncGenerator<MessageInstance, void, unknown>;
|
|
66
68
|
}
|
|
67
|
-
export declare class MessageRef<Subtype extends AnyMessage = AnyMessage> extends MessageMixin implements PromiseLike<Message<Subtype>> {
|
|
69
|
+
export declare class MessageRef<Subtype extends AnyMessage = AnyMessage, Blocks extends KnownBlock[] = KnownBlock[]> extends MessageMixin<Blocks> implements PromiseLike<Message<Subtype>> {
|
|
68
70
|
#private;
|
|
69
71
|
then<TResult1 = Message<Subtype>, TResult2 = never>(onfulfilled?: ((value: Message<Subtype>) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): PromiseLike<TResult1 | TResult2>;
|
|
70
72
|
}
|
|
71
|
-
export declare class Message<Subtype extends AnyMessage = AnyMessage> extends MessageMixin {
|
|
73
|
+
export declare class Message<Subtype extends AnyMessage = AnyMessage, Blocks extends KnownBlock[] = KnownBlock[]> extends MessageMixin<Blocks> {
|
|
72
74
|
#private;
|
|
73
75
|
constructor(client: App, channel: string, ts: string, data: Subtype);
|
|
74
76
|
/** @returns Whether this message is a normal message (subtype is undefined) */
|
|
@@ -80,15 +82,15 @@ export declare class Message<Subtype extends AnyMessage = AnyMessage> extends Me
|
|
|
80
82
|
* channel join messages), this may not be the user you expect. Read the Slack documentation to
|
|
81
83
|
* find out.
|
|
82
84
|
*/
|
|
83
|
-
get author(): UserRef;
|
|
85
|
+
get author(): undefined extends Subtype["user"] ? UserRef | undefined : UserRef;
|
|
84
86
|
protected get _threadTs(): string | undefined;
|
|
85
87
|
}
|
|
86
|
-
export type MessageInstance<Subtype extends AnyMessage = AnyMessage> = Message<Subtype> & Subtype;
|
|
87
|
-
declare class MessageWait {
|
|
88
|
+
export type MessageInstance<Subtype extends AnyMessage = AnyMessage, Blocks extends KnownBlock[] = KnownBlock[]> = Message<Subtype, Blocks> & Subtype;
|
|
89
|
+
declare class MessageWait<Blocks extends KnownBlock[] = KnownBlock[]> {
|
|
88
90
|
private message;
|
|
89
91
|
private client;
|
|
90
92
|
private _timeout;
|
|
91
|
-
constructor(message: MessageMixin
|
|
93
|
+
constructor(message: MessageMixin<Blocks>, client: App);
|
|
92
94
|
/**
|
|
93
95
|
* Sets the timeout of the wait. A `SlackTimeoutError` will be thrown if no matching event occurs
|
|
94
96
|
* after the timeout. Set this to `0` to disable timeouts; i.e., methods will wait forever. (This
|
|
@@ -114,21 +116,22 @@ declare class MessageWait {
|
|
|
114
116
|
* be ignored (useful for permission checks).
|
|
115
117
|
*
|
|
116
118
|
* An action is matched if its container is this message, its `action_id` is one of the parameters
|
|
117
|
-
* passed in, and it passes all the function
|
|
118
|
-
*
|
|
119
|
-
* NOTE: You must specify at least one non-function parameter, since the `action_id` of the action
|
|
120
|
-
* must match one of the arguments.
|
|
119
|
+
* passed in (or any `action_id` if no strings are passed in), and it passes all the function
|
|
120
|
+
* checks.
|
|
121
121
|
*
|
|
122
122
|
* @param specifiers An array of specifiers (see above for their format)
|
|
123
123
|
* @returns The action that occurred that matches the specifiers.
|
|
124
124
|
* @throws `SlackTimeoutError` if timed out before a matched event occurred
|
|
125
125
|
*/
|
|
126
|
-
action<ActionIDs extends (
|
|
126
|
+
action<ActionIDs extends (ActionsToPrefixedID<ExtractActions<Blocks>> | ActionPredicate)[]>(...specifiers: ActionIDs): Promise<DistributeAction<ExtractWaitActionType<ExtractString<ActionIDs[number]>, ExtractActions<Blocks>>>>;
|
|
127
127
|
}
|
|
128
128
|
type ActionPredicate = (action: ActionInstance) => boolean | Promise<boolean>;
|
|
129
|
-
type
|
|
130
|
-
type ExtractWaitActionType<Specifier extends string
|
|
131
|
-
|
|
129
|
+
type DistributeAction<T extends BlockAction> = T extends any ? ActionInstance<T> : never;
|
|
130
|
+
type ExtractWaitActionType<Specifier extends string, Action extends {
|
|
131
|
+
type: string;
|
|
132
|
+
action_id?: string;
|
|
133
|
+
}> = {
|
|
134
|
+
[K in Specifier]: BlockAction & Action & ExtractTypeAndActionID<Specifier>;
|
|
132
135
|
}[Specifier];
|
|
133
136
|
type ExtractTypeAndActionID<T extends string> = T extends `${infer Type extends BlockActionTypes}.${infer ActionID}` ? {
|
|
134
137
|
type: Type;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/resources/message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AACrF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAA;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACrE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAGpC,OAAO,EAGN,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,MAAM,oBAAoB,CAAA;AAE3B,OAAO,KAAK,EAAE,gBAAgB,EAAoB,MAAM,iBAAiB,CAAA;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAChC,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAElF,UAAU,kBAAmB,SAAQ,IAAI,CAAC,yBAAyB,EAAE,OAAO,CAAC;IAC5E;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;CACd;AAED,cAAM,YAAY,CAAC,MAAM,SAAS,UAAU,EAAE,GAAG,UAAU,EAAE;;IAK3D,SAAS,CA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AAC,CAAC,GAAG,eAAe,CAAC,EAAE,EAC/F,GAAG,UAAU,EAAE,SAAS;CA8DzB;AAED,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,cAAc,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;AAE7E,KAAK,gBAAgB,CAAC,CAAC,SAAS,WAAW,IAAI,CAAC,SAAS,GAAG,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,KAAK,CAAA;AAOxF,KAAK,qBAAqB,CACzB,SAAS,SAAS,MAAM,EACxB,MAAM,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,IAChD;KACF,CAAC,IAAI,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,sBAAsB,CAAC,SAAS,CAAC;CAC1E,CAAC,SAAS,CAAC,CAAA;AAEZ,KAAK,sBAAsB,CAAC,CAAC,SAAS,MAAM,IAC3C,CAAC,SAAS,GAAG,MAAM,IAAI,SAAS,gBAAgB,IAAI,MAAM,QAAQ,EAAE,GACjE;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,QAAQ,CAAA;CAAE,GACnC;IAAE,SAAS,EAAE,CAAC,CAAA;CAAE,CAAA;AAEpB,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,KAAK,CAAA"}
|
|
@@ -100,7 +100,7 @@ export class Message extends MessageMixin {
|
|
|
100
100
|
* find out.
|
|
101
101
|
*/
|
|
102
102
|
get author() {
|
|
103
|
-
return new UserRef(this.client, this.#data.user);
|
|
103
|
+
return this.#data.user ? new UserRef(this.client, this.#data.user) : undefined;
|
|
104
104
|
}
|
|
105
105
|
get _threadTs() {
|
|
106
106
|
return this.#data.thread_ts;
|
|
@@ -142,10 +142,8 @@ class MessageWait {
|
|
|
142
142
|
* be ignored (useful for permission checks).
|
|
143
143
|
*
|
|
144
144
|
* An action is matched if its container is this message, its `action_id` is one of the parameters
|
|
145
|
-
* passed in, and it passes all the function
|
|
146
|
-
*
|
|
147
|
-
* NOTE: You must specify at least one non-function parameter, since the `action_id` of the action
|
|
148
|
-
* must match one of the arguments.
|
|
145
|
+
* passed in (or any `action_id` if no strings are passed in), and it passes all the function
|
|
146
|
+
* checks.
|
|
149
147
|
*
|
|
150
148
|
* @param specifiers An array of specifiers (see above for their format)
|
|
151
149
|
* @returns The action that occurred that matches the specifiers.
|
|
@@ -190,8 +188,9 @@ class MessageWait {
|
|
|
190
188
|
}
|
|
191
189
|
}
|
|
192
190
|
if (!subscriptions.length) {
|
|
193
|
-
|
|
194
|
-
|
|
191
|
+
console.warn("[MessageWait.action] warning: no action_id is passed. it is recommended to pass a list of action_id's to reduce the number of events that needs to be processed.");
|
|
192
|
+
this.client.on("action", callback);
|
|
193
|
+
subscriptions.push("action");
|
|
195
194
|
}
|
|
196
195
|
const timer = this._timeout
|
|
197
196
|
? setTimeout(() => {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { KnownBlock } from "@slack/types";
|
|
2
|
+
import type { ModalView } from "../api/types/view.js";
|
|
3
|
+
import type { App } from "../client.js";
|
|
4
|
+
import { type SubmissionInstance } from "./submission.js";
|
|
5
|
+
export declare class Modal<Blocks extends KnownBlock[] = KnownBlock[]> {
|
|
6
|
+
#private;
|
|
7
|
+
protected client: App;
|
|
8
|
+
constructor(client: App, data: ModalView<Blocks>);
|
|
9
|
+
get raw(): ModalView<Blocks>;
|
|
10
|
+
get wait(): ModalWait<Blocks>;
|
|
11
|
+
}
|
|
12
|
+
export type ModalInstance<Blocks extends KnownBlock[] = KnownBlock[]> = Modal<Blocks> & ModalView<Blocks>;
|
|
13
|
+
declare class ModalWait<Blocks extends KnownBlock[] = KnownBlock[]> {
|
|
14
|
+
private client;
|
|
15
|
+
private modal;
|
|
16
|
+
private _timeout;
|
|
17
|
+
constructor(client: App, modal: ModalInstance<Blocks>);
|
|
18
|
+
timeout(timeout: number): this;
|
|
19
|
+
submit(): Promise<SubmissionInstance<Blocks>>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=modal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/resources/modal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAGpC,OAAO,EAAc,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAElE,qBAAa,KAAK,CAAC,MAAM,SAAS,UAAU,EAAE,GAAG,UAAU,EAAE;;IAI3D,SAAS,CAAC,MAAM,EAAE,GAAG;gBAAX,MAAM,EAAE,GAAG,EACrB,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC;IAMxB,IAAI,GAAG,sBAEN;IAED,IAAI,IAAI,sBAEP;CACD;AAED,MAAM,MAAM,aAAa,CAAC,MAAM,SAAS,UAAU,EAAE,GAAG,UAAU,EAAE,IAAI,KAAK,CAAC,MAAM,CAAC,GACpF,SAAS,CAAC,MAAM,CAAC,CAAA;AAElB,cAAM,SAAS,CAAC,MAAM,SAAS,UAAU,EAAE,GAAG,UAAU,EAAE;IAIxD,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,KAAK;IAJd,OAAO,CAAC,QAAQ,CAAgB;gBAGvB,MAAM,EAAE,GAAG,EACX,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC;IAGrC,OAAO,CAAC,OAAO,EAAE,MAAM;IAKjB,MAAM;CA0BZ"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SlashCommandPayload } from "../api/slash/index.js";
|
|
2
|
+
import type { App } from "../client.js";
|
|
3
|
+
import { Responder } from "../utils/respond.js";
|
|
4
|
+
import { ChannelRef } from "./channel.js";
|
|
5
|
+
import { UserRef } from "./user.js";
|
|
6
|
+
export declare class SlashCommand {
|
|
7
|
+
#private;
|
|
8
|
+
private client;
|
|
9
|
+
constructor(client: App, data: SlashCommandPayload);
|
|
10
|
+
get respond(): Responder<true>;
|
|
11
|
+
get user(): UserRef;
|
|
12
|
+
get channel(): ChannelRef;
|
|
13
|
+
}
|
|
14
|
+
export type SlashCommandInstance = SlashCommand & SlashCommandPayload;
|
|
15
|
+
//# sourceMappingURL=slash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slash.d.ts","sourceRoot":"","sources":["../../../src/resources/slash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AACvD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEhC,qBAAa,YAAY;;IAIvB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,GAAG,EACnB,IAAI,EAAE,mBAAmB;IAM1B,IAAI,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,CAE7B;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,IAAI,OAAO,IAAI,UAAU,CAExB;CACD;AAED,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAAG,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { makeProxy } from "../utils/index.js";
|
|
2
|
+
import { Responder } from "../utils/respond.js";
|
|
3
|
+
import { ChannelRef } from "./channel.js";
|
|
4
|
+
import { UserRef } from "./user.js";
|
|
5
|
+
export class SlashCommand {
|
|
6
|
+
client;
|
|
7
|
+
#data;
|
|
8
|
+
constructor(client, data) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
this.#data = data;
|
|
11
|
+
return makeProxy(this, () => this.#data);
|
|
12
|
+
}
|
|
13
|
+
get respond() {
|
|
14
|
+
return new Responder(this.client, this.#data.response_url, this.#data.trigger_id);
|
|
15
|
+
}
|
|
16
|
+
get user() {
|
|
17
|
+
return new UserRef(this.client, this.#data.user_id);
|
|
18
|
+
}
|
|
19
|
+
get channel() {
|
|
20
|
+
return new ChannelRef(this.client, this.#data.channel_id);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { KnownBlock } from "@slack/types";
|
|
2
|
+
import type { ViewSubmission } from "../api/interactive/view_submission.js";
|
|
3
|
+
import type { App } from "../client.js";
|
|
4
|
+
import { Responder } from "../utils/respond.js";
|
|
5
|
+
export declare class Submission<Blocks extends KnownBlock[] = KnownBlock[]> {
|
|
6
|
+
#private;
|
|
7
|
+
protected client: App;
|
|
8
|
+
constructor(client: App, data: ViewSubmission<Blocks>);
|
|
9
|
+
get respond(): Responder;
|
|
10
|
+
get values(): import("../blocks/utils/extract.js").ExtractValues<Blocks>;
|
|
11
|
+
}
|
|
12
|
+
export type SubmissionInstance<Blocks extends KnownBlock[] = KnownBlock[]> = Submission<Blocks> & ViewSubmission<Blocks>;
|
|
13
|
+
//# sourceMappingURL=submission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submission.d.ts","sourceRoot":"","sources":["../../../src/resources/submission.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AACxE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE5C,qBAAa,UAAU,CAAC,MAAM,SAAS,UAAU,EAAE,GAAG,UAAU,EAAE;;IAIhE,SAAS,CAAC,MAAM,EAAE,GAAG;gBAAX,MAAM,EAAE,GAAG,EACrB,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;IAM7B,IAAI,OAAO,IAAI,SAAS,CAEvB;IAED,IAAI,MAAM,4DAET;CACD;AAED,MAAM,MAAM,kBAAkB,CAAC,MAAM,SAAS,UAAU,EAAE,GAAG,UAAU,EAAE,IAAI,UAAU,CAAC,MAAM,CAAC,GAC9F,cAAc,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { makeProxy } from "../utils/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Responder } from "../utils/respond.js";
|
|
3
3
|
export class Submission {
|
|
4
4
|
client;
|
|
5
5
|
#data;
|
|
@@ -9,6 +9,9 @@ export class Submission {
|
|
|
9
9
|
return makeProxy(this, () => this.#data);
|
|
10
10
|
}
|
|
11
11
|
get respond() {
|
|
12
|
-
return new
|
|
12
|
+
return new Responder(this.client, this.#data.response_urls[0], this.#data.trigger_id);
|
|
13
|
+
}
|
|
14
|
+
get values() {
|
|
15
|
+
return this.#data.view.state.values;
|
|
13
16
|
}
|
|
14
17
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/resources/user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAEpC,OAAO,EAGN,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,EAAW,KAAK,eAAe,EAAE,MAAM,WAAW,CAAA;AAEzD,cAAM,SAAS;;IAIb,SAAS,CA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
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { KnownBlock } from "@slack/types";
|
|
2
|
+
import type { NormalMessage } from "../api/types/message.js";
|
|
3
|
+
import type { ChatPostEphemeralParams, ChatPostMessageParams } from "../api/web/chat.js";
|
|
4
|
+
import type { App } from "../client.js";
|
|
5
|
+
export type SendMessageFile = {
|
|
6
|
+
file: Buffer | ArrayBuffer;
|
|
7
|
+
filename: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
snippet_type?: string;
|
|
10
|
+
alt_txt?: string;
|
|
11
|
+
};
|
|
12
|
+
export interface SendMessageWithFiles<Blocks extends KnownBlock[] = KnownBlock[]> {
|
|
13
|
+
channel: string;
|
|
14
|
+
files: SendMessageFile[];
|
|
15
|
+
thread_ts?: string;
|
|
16
|
+
text?: string;
|
|
17
|
+
blocks?: Blocks;
|
|
18
|
+
token?: string;
|
|
19
|
+
}
|
|
20
|
+
export type SendMessageWithoutFiles<Blocks extends KnownBlock[] = KnownBlock[]> = {
|
|
21
|
+
files?: never;
|
|
22
|
+
blocks?: Blocks;
|
|
23
|
+
} & (({
|
|
24
|
+
ephemeral?: false;
|
|
25
|
+
} & ChatPostMessageParams) | ({
|
|
26
|
+
ephemeral: true;
|
|
27
|
+
} & ChatPostEphemeralParams));
|
|
28
|
+
export type SendMessageParams<Blocks extends KnownBlock[] = KnownBlock[]> = SendMessageWithFiles<Blocks> | SendMessageWithoutFiles<Blocks>;
|
|
29
|
+
export declare function sendMessage<Blocks extends KnownBlock[] = KnownBlock[]>(client: App, params: SendMessageParams<Blocks>): Promise<{
|
|
30
|
+
channel: string;
|
|
31
|
+
ts: string;
|
|
32
|
+
message: NormalMessage<Blocks>;
|
|
33
|
+
} | undefined>;
|
|
34
|
+
//# sourceMappingURL=messaging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messaging.d.ts","sourceRoot":"","sources":["../../../src/utils/messaging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE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AU,EAAE,GAAG,UAAU,EAAE,EAC3E,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC;;;aA0BH,aAAa,CAAC,MAAM,CAAC;eAGnD"}
|
|
@@ -13,9 +13,19 @@ export async function sendMessage(client, params) {
|
|
|
13
13
|
blocks: params.blocks,
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
+
else if (params.ephemeral) {
|
|
17
|
+
const { ephemeral: _, ...payload } = params;
|
|
18
|
+
const message = await client.request("chat.postEphemeral", payload);
|
|
19
|
+
console.log(message);
|
|
20
|
+
}
|
|
16
21
|
else {
|
|
17
|
-
const
|
|
18
|
-
|
|
22
|
+
const { ephemeral: _, ...payload } = params;
|
|
23
|
+
const message = await client.request("chat.postMessage", payload);
|
|
24
|
+
return {
|
|
25
|
+
channel: message.channel,
|
|
26
|
+
ts: message.ts,
|
|
27
|
+
message: message.message,
|
|
28
|
+
};
|
|
19
29
|
}
|
|
20
30
|
}
|
|
21
31
|
async function uploadHelper(client, file) {
|
|
@@ -4,7 +4,7 @@ import type { DistributiveOmit } from "./typing.js";
|
|
|
4
4
|
export declare function paginate<Method extends SlackPaginatingAPIMethod, T>(client: App, method: Method, params: DistributiveOmit<SlackAPIParams<Method>, "limit" | "cursor"> & {
|
|
5
5
|
limit?: number;
|
|
6
6
|
batch?: number;
|
|
7
|
-
}, converter: (response: SlackAPIResponse<Method
|
|
7
|
+
}, converter: (response: Extract<SlackAPIResponse<Method>, {
|
|
8
8
|
ok: true;
|
|
9
|
-
}) => Iterable<T> | AsyncIterable<T>): AsyncGenerator<Awaited<T>, void, unknown>;
|
|
9
|
+
}>) => Iterable<T> | AsyncIterable<T>): AsyncGenerator<Awaited<T>, void, unknown>;
|
|
10
10
|
//# sourceMappingURL=paginate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paginate.d.ts","sourceRoot":"","sources":["../../../src/utils/paginate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,QAAQ,CAAA;AACxF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEhD,wBAAuB,QAAQ,CAAC,MAAM,SAAS,wBAAwB,EAAE,CAAC,EACzE,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,gBAAgB,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC,GAAG;IACtE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACd,EACD,SAAS,EAAE,CACV,QAAQ,EAAE,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,CAAC,KACrD,QAAQ,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,6CAmBnC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { KnownBlock } from "@slack/types";
|
|
2
|
+
import type { App } from "../client.js";
|
|
3
|
+
import type { ViewsOpenParams } from "../api/web/views.js";
|
|
4
|
+
import { type ModalInstance } from "../resources/modal.js";
|
|
5
|
+
export declare class Responder<HasResponseURL extends boolean = true> {
|
|
6
|
+
private client;
|
|
7
|
+
private response_url;
|
|
8
|
+
private trigger_id;
|
|
9
|
+
constructor(client: App, response_url: string | undefined, trigger_id: string);
|
|
10
|
+
message(this: Responder<true>, message: string | MessageResponseParams): Promise<void>;
|
|
11
|
+
edit(this: Responder<true>, message: string | MessageResponseParams): Promise<void>;
|
|
12
|
+
delete(this: Responder<true>): Promise<void>;
|
|
13
|
+
modal<View extends ViewsOpenParams["view"]>(view: View): Promise<ModalInstance<View["blocks"]>>;
|
|
14
|
+
}
|
|
15
|
+
export type MessageResponseParams = {
|
|
16
|
+
ephemeral?: boolean;
|
|
17
|
+
text?: string;
|
|
18
|
+
blocks?: KnownBlock[];
|
|
19
|
+
} & ({
|
|
20
|
+
text: string;
|
|
21
|
+
} | {
|
|
22
|
+
blocks: KnownBlock[];
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=respond.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"respond.d.ts","sourceRoot":"","sources":["../../../src/utils/respond.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAS,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAG9D,qBAAa,SAAS,CAAC,cAAc,SAAS,OAAO,GAAG,IAAI;IAE1D,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,UAAU;gBAFV,MAAM,EAAE,GAAG,EACX,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,UAAU,EAAE,MAAM;IAGrB,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,qBAAqB;IAuBtE,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,qBAAqB;IAuBnE,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC;IAc5B,KAAK,CAAC,IAAI,SAAS,eAAe,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI;CAK5D;AAED,MAAM,MAAM,qBAAqB,GAAG;IACnC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,UAAU,EAAE,CAAA;CACrB,GAAG,CAAC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