slack.ts 0.0.3 → 0.0.5

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.
Files changed (67) hide show
  1. package/README.md +14 -0
  2. package/dist/api/index.d.ts +19 -1
  3. package/dist/api/index.d.ts.map +1 -1
  4. package/dist/api/index.js +1 -0
  5. package/dist/api/interactive/block_actions.d.ts +61 -0
  6. package/dist/api/interactive/block_actions.d.ts.map +1 -0
  7. package/dist/api/interactive/block_actions.js +1 -0
  8. package/dist/api/interactive/common.d.ts +23 -0
  9. package/dist/api/interactive/common.d.ts.map +1 -0
  10. package/dist/api/interactive/common.js +1 -0
  11. package/dist/api/interactive/view_submission.d.ts +8 -0
  12. package/dist/api/interactive/view_submission.d.ts.map +1 -0
  13. package/dist/api/interactive/view_submission.js +1 -0
  14. package/dist/api/types/user.d.ts +54 -0
  15. package/dist/api/types/user.d.ts.map +1 -0
  16. package/dist/api/types/user.js +1 -0
  17. package/dist/api/types/value.d.ts +6 -0
  18. package/dist/api/types/value.d.ts.map +1 -0
  19. package/dist/api/types/value.js +1 -0
  20. package/dist/api/types/view.d.ts +26 -0
  21. package/dist/api/types/view.d.ts.map +1 -0
  22. package/dist/api/types/view.js +1 -0
  23. package/dist/api/web/conversations.d.ts +12 -0
  24. package/dist/api/web/conversations.d.ts.map +1 -1
  25. package/dist/api/web/users.d.ts +11 -0
  26. package/dist/api/web/users.d.ts.map +1 -0
  27. package/dist/api/web/users.js +1 -0
  28. package/dist/api/web/views.d.ts +17 -0
  29. package/dist/api/web/views.d.ts.map +1 -0
  30. package/dist/api/web/views.js +1 -0
  31. package/dist/client.d.ts +71 -14
  32. package/dist/client.d.ts.map +1 -1
  33. package/dist/client.js +72 -35
  34. package/dist/error.d.ts +2 -0
  35. package/dist/error.d.ts.map +1 -1
  36. package/dist/error.js +2 -0
  37. package/dist/events/receivers/socket.d.ts.map +1 -1
  38. package/dist/events/receivers/socket.js +11 -2
  39. package/dist/events/types/index.d.ts +8 -0
  40. package/dist/events/types/index.d.ts.map +1 -1
  41. package/dist/resources/action.d.ts +13 -0
  42. package/dist/resources/action.d.ts.map +1 -0
  43. package/dist/resources/action.js +22 -0
  44. package/dist/resources/channel.d.ts +27 -1
  45. package/dist/resources/channel.d.ts.map +1 -1
  46. package/dist/resources/channel.js +19 -0
  47. package/dist/resources/message.d.ts +95 -0
  48. package/dist/resources/message.d.ts.map +1 -1
  49. package/dist/resources/message.js +127 -1
  50. package/dist/resources/modal.d.ts +21 -0
  51. package/dist/resources/modal.d.ts.map +1 -0
  52. package/dist/resources/modal.js +54 -0
  53. package/dist/resources/submission.d.ts +11 -0
  54. package/dist/resources/submission.d.ts.map +1 -0
  55. package/dist/resources/submission.js +14 -0
  56. package/dist/resources/user.d.ts +38 -0
  57. package/dist/resources/user.d.ts.map +1 -0
  58. package/dist/resources/user.js +41 -0
  59. package/dist/utils/paginate.d.ts +10 -0
  60. package/dist/utils/paginate.d.ts.map +1 -0
  61. package/dist/utils/paginate.js +22 -0
  62. package/dist/utils/respond.d.ts +31 -0
  63. package/dist/utils/respond.d.ts.map +1 -0
  64. package/dist/utils/respond.js +71 -0
  65. package/dist/utils/typing.d.ts +3 -0
  66. package/dist/utils/typing.d.ts.map +1 -1
  67. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -1,16 +1,18 @@
1
- import { sleep } from "./utils/index.js";
2
- import { ChannelRef } from "./resources/channel.js";
3
- import { SlackWebAPIError, SlackWebAPIPlatformError } from "./error.js";
1
+ import EventEmitter from "events";
4
2
  import { POST_METHODS, } from "./api/index.js";
5
- import { SocketEventsReceiver } from "./events/receivers/socket.js";
3
+ import { SlackWebAPIError, SlackWebAPIPlatformError } from "./error.js";
6
4
  import { DummyReceiver } from "./events/receivers/dummy.js";
5
+ import { SocketEventsReceiver } from "./events/receivers/socket.js";
6
+ import { Action } from "./resources/action.js";
7
+ import { ChannelRef } from "./resources/channel.js";
7
8
  import { Message } from "./resources/message.js";
8
- export class App {
9
+ import { sleep } from "./utils/index.js";
10
+ export class App extends EventEmitter {
9
11
  #token;
10
12
  #receiver;
11
- messageCallbacks = [];
12
- eventCallbacks = {};
13
13
  constructor({ token, receiver = { type: "dummy" } } = {}) {
14
+ super({ captureRejections: true });
15
+ this.on("error", this.#onCallbackError.bind(this));
14
16
  this.#token = token;
15
17
  switch (receiver.type) {
16
18
  case "socket":
@@ -20,44 +22,75 @@ export class App {
20
22
  this.#receiver = new DummyReceiver();
21
23
  }
22
24
  this.#receiver.on("event", this.#onEvent.bind(this));
25
+ this.#receiver.on("block_actions", this.#onBlockActions.bind(this));
26
+ this.#receiver.on("view_submission", this.#onViewSubmission.bind(this));
27
+ this.on("event:message", this.#onMessage.bind(this));
23
28
  }
24
- async #onEvent(event) {
25
- const data = {
26
- client: this,
27
- event,
28
- };
29
- for (const callback of this.eventCallbacks[event.event.type] ?? []) {
30
- callback(data);
31
- }
32
- if (event.event.type === "message") {
33
- const data = {
34
- message: new Message(this, event.event.channel, event.event.ts, event.event),
35
- client: this,
36
- event: event,
37
- };
38
- for (const callback of this.messageCallbacks) {
39
- callback(data);
40
- }
29
+ #onEvent(event) {
30
+ this.emit("event", event);
31
+ this.emit(`event:${event.event.type}`, { payload: event.event, event: event });
32
+ }
33
+ #onBlockActions(event) {
34
+ this.emit("actions", event);
35
+ for (const action of event.actions) {
36
+ const obj = new Action(this, action, event);
37
+ this.emit(`action:${action.type}`, obj);
38
+ this.emit(`action.${action.action_id}`, obj);
39
+ this.emit(`action:${action.type}.${action.action_id}`, obj);
41
40
  }
42
41
  }
42
+ #onViewSubmission(event) {
43
+ this.emit("submit", event);
44
+ this.emit(`submit.${event.view.callback_id}`, event);
45
+ }
46
+ async #onCallbackError(error) {
47
+ console.error("Error occurred executing callback");
48
+ console.error(error);
49
+ }
50
+ #onMessage({ payload }) {
51
+ const message = new Message(this, payload.channel, payload.ts, payload);
52
+ this.emit("message", message);
53
+ this.emit(`message#${payload.channel}`, message);
54
+ }
43
55
  /**
44
56
  * Registers a callback for `message` events.
45
57
  *
58
+ * @deprecated Use `app.on('message', callback)` or `app.on('event:message', callback)`
46
59
  * @param callback Function to execute when a new message is received
47
60
  */
48
61
  message(callback) {
49
- this.messageCallbacks.push(callback);
62
+ this.on("event:message", async ({ event, payload }) => {
63
+ await callback({
64
+ event,
65
+ message: new Message(this, payload.channel, payload.ts, payload),
66
+ client: this,
67
+ });
68
+ });
50
69
  }
51
70
  /**
52
71
  * Registers a callback for a given type of event.
53
72
  *
73
+ * @deprecated Use `app.on('event:type', callback)` instead
54
74
  * @param type Type of event to register
55
75
  * @param callback Function to execute when the event is received
56
76
  */
57
77
  event(type, callback) {
58
- if (!this.eventCallbacks[type])
59
- this.eventCallbacks[type] = [];
60
- this.eventCallbacks[type].push(callback);
78
+ this.on(`event:${type}`, async ({ event }) => {
79
+ await callback({ event: event, client: this });
80
+ });
81
+ }
82
+ /**
83
+ * Registers a callback for a given type of block actions.
84
+ *
85
+ * @deprecated Use `app.on('action:type', ...)`, `app.on('action.action_id', ...)`, or
86
+ * `app.on('action:type.action_id', ...)` instead
87
+ * @param type Type of event to register
88
+ * @param callback Function to execute when the event is received
89
+ */
90
+ action(type, callback) {
91
+ this.on(`action:${type}`, async (action) => {
92
+ await callback(action);
93
+ });
61
94
  }
62
95
  /**
63
96
  * Starts the event receiver. If you don't use the events, interactions, and slash command APIs,
@@ -79,15 +112,15 @@ export class App {
79
112
  /**
80
113
  * Makes a Slack Web API request.
81
114
  *
82
- * @param endpoint The Slack Web API method to call
115
+ * @param method The Slack Web API method to call
83
116
  * @param params The parameters for the method
84
- * @param [method='GET'] The HTTP method for the request. Default is `'GET'`
85
117
  * @returns The response from the API call
86
118
  */
87
- async request(endpoint, params, method = POST_METHODS.includes(endpoint) ? "POST" : "GET") {
88
- const body = method !== "GET" ? JSON.stringify(params) : undefined;
89
- const url = new URL(`https://slack.com/api/${endpoint}`);
90
- if (method === "GET" && params) {
119
+ async request(method, params) {
120
+ const httpMethod = POST_METHODS.includes(method) ? "POST" : "GET";
121
+ const body = httpMethod !== "GET" ? JSON.stringify(params) : undefined;
122
+ const url = new URL(`https://slack.com/api/${method}`);
123
+ if (httpMethod === "GET" && params) {
91
124
  for (const [key, value] of Object.entries(params)) {
92
125
  if (value instanceof Array) {
93
126
  for (const item of value) {
@@ -106,7 +139,11 @@ export class App {
106
139
  if (params.token || this.#token) {
107
140
  headers.set("Authorization", `Bearer ${params.token || this.#token}`);
108
141
  }
109
- const res = await request(url.toString(), { method, body, headers });
142
+ const res = await request(url.toString(), {
143
+ method: httpMethod,
144
+ body,
145
+ headers,
146
+ });
110
147
  if (!res.ok) {
111
148
  throw new SlackWebAPIPlatformError(url.toString(), res, res.error);
112
149
  }
package/dist/error.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export declare class SlackError extends Error {
2
2
  }
3
+ export declare class SlackTimeoutError extends Error {
4
+ }
3
5
  export declare class SlackWebAPIError extends SlackError {
4
6
  url: string;
5
7
  data?: unknown | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAW,SAAQ,KAAK;CAAG;AAExC,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"}
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"}
package/dist/error.js CHANGED
@@ -1,5 +1,7 @@
1
1
  export class SlackError extends Error {
2
2
  }
3
+ export class SlackTimeoutError extends Error {
4
+ }
3
5
  export class SlackWebAPIError extends SlackError {
4
6
  url;
5
7
  data;
@@ -1 +1 @@
1
- {"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../../src/events/receivers/socket.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,QAAQ,CAAA;AAEjC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,EAAE,cAAc,EAAgB,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE9E,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;IAMvD,KAAK;YAIG,QAAQ;CAuCtB"}
1
+ {"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../../src/events/receivers/socket.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,QAAQ,CAAA;AAEjC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,EAAE,cAAc,EAAgB,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAG9E,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;CA0CtB"}
@@ -5,16 +5,21 @@ export class SocketEventsReceiver extends EventEmitter {
5
5
  client;
6
6
  #ws;
7
7
  constructor({ appToken, client }) {
8
- super();
8
+ super({ captureRejections: true });
9
+ this.on('error', this.#onEventError.bind(this));
9
10
  this.#appToken = appToken;
10
11
  this.client = client;
11
12
  }
13
+ #onEventError(error) {
14
+ console.error('[socket-mode] error occurred handling event');
15
+ console.error(error);
16
+ }
12
17
  async start() {
13
18
  await this._connect();
14
19
  }
15
20
  async _connect() {
16
21
  const { url } = await this.client.request('apps.connections.open', { token: this.#appToken });
17
- this.#ws = new WebSocket(url + '&debug_reconnects=true');
22
+ this.#ws = new WebSocket(url);
18
23
  this.#ws.addEventListener('open', this.#onOpen.bind(this));
19
24
  this.#ws.addEventListener('message', this.#onMessage.bind(this));
20
25
  this.#ws.addEventListener('close', this.#onClose.bind(this));
@@ -31,6 +36,10 @@ export class SocketEventsReceiver extends EventEmitter {
31
36
  this.#ws?.send(JSON.stringify({ envelope_id: data.envelope_id }));
32
37
  this.emit('event', data.payload);
33
38
  }
39
+ else if (data.type === 'interactive') {
40
+ this.#ws?.send(JSON.stringify({ envelope_id: data.envelope_id }));
41
+ this.emit(data.payload.type, data.payload);
42
+ }
34
43
  else if (data.type === 'hello') {
35
44
  console.debug('[socket-mode] received server hello, app id', data.connection_info.app_id);
36
45
  }
@@ -1,5 +1,7 @@
1
1
  import type EventEmitter from "events";
2
2
  import type { AppMentionEvent, MessageEvent } from "./events.js";
3
+ import type { BlockActions } from "../../api/interactive/block_actions.js";
4
+ import type { ViewSubmission } from "../../api/interactive/view_submission.js";
3
5
  export interface EventsReceiver extends EventEmitter<ReceiverEventMap> {
4
6
  start(): unknown;
5
7
  }
@@ -27,6 +29,12 @@ export type ReceiverEventMap = {
27
29
  event: [
28
30
  EventWrapper<AllEvents>
29
31
  ];
32
+ block_actions: [
33
+ BlockActions
34
+ ];
35
+ view_submission: [
36
+ ViewSubmission
37
+ ];
30
38
  };
31
39
  export type AllEvents = AppMentionEvent | MessageEvent;
32
40
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/events/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAA;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAE7D,MAAM,WAAW,cAAe,SAAQ,YAAY,CAAC,gBAAgB,CAAC;IACrE,KAAK,IAAI,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS;IAC5D,IAAI,EAAE,gBAAgB,CAAA;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,CAAC,CAAA;IACR,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,EAAE,OAAO,EAAE,CAAA;IACzB,qBAAqB,EAAE,OAAO,CAAA;IAC9B,eAAe,EAAE,MAAM,CAAA;IACvB,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAA;CACpC;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,CAAC,MAAM,CAAC,CAAA;AAE7C,MAAM,MAAM,aAAa,GAAG;KAC1B,CAAC,IAAI,aAAa,GAAG,SAAS,GAAG;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE;CAC7C,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC9B,KAAK,EAAE,CAAC,Y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EAAE,CAAC,YAAY,CAAC,CAAA;IAC7B,eAAe,EAAE,CAAC,cAAc,CAAC,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,YAAY,CAAA"}
@@ -0,0 +1,13 @@
1
+ import type { BlockAction, BlockActions } from "../api/interactive/block_actions.js";
2
+ import type { App } from "../client.js";
3
+ import { type Responder } from "../utils/respond.js";
4
+ export declare class Action<Type extends BlockAction = BlockAction> {
5
+ #private;
6
+ protected client: App;
7
+ constructor(client: App, action: Type, event: BlockActions);
8
+ get event(): BlockActions;
9
+ get raw(): Type;
10
+ get respond(): Responder<true>;
11
+ }
12
+ export type ActionInstance<Type extends BlockAction = BlockAction> = Action<Type> & Type;
13
+ //# sourceMappingURL=action.d.ts.map
@@ -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,EAAiB,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEhE,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"}
@@ -0,0 +1,22 @@
1
+ import { makeProxy } from "../utils/index.js";
2
+ import { ResponderImpl } from "../utils/respond.js";
3
+ export class Action {
4
+ client;
5
+ #data;
6
+ #event;
7
+ constructor(client, action, event) {
8
+ this.client = client;
9
+ this.#data = action;
10
+ this.#event = event;
11
+ return makeProxy(this, () => this.#data);
12
+ }
13
+ get event() {
14
+ return this.#event;
15
+ }
16
+ get raw() {
17
+ return this.#data;
18
+ }
19
+ get respond() {
20
+ return new ResponderImpl(this.client, this.#event.response_url, this.#event.trigger_id);
21
+ }
22
+ }
@@ -1,9 +1,24 @@
1
+ import type { TimestampPaginationParams } from "../api/types/api.js";
1
2
  import type { Conversation } from "../api/types/conversation.js";
2
3
  import type { NormalMessage } from "../api/types/message.js";
3
4
  import type { App } from "../client.js";
4
5
  import { type SendMessageWithFiles, type SendMessageWithoutFiles } from "../utils/messaging.js";
5
6
  import type { DistributiveOmit } from "../utils/typing.js";
6
7
  import { MessageRef, type MessageInstance } from "./message.js";
8
+ import { UserRef } from "./user.js";
9
+ interface FetchMessagesParams extends Omit<TimestampPaginationParams, "limit"> {
10
+ /**
11
+ * How many messages to fetch in each API call. This will not affect the number of returned
12
+ * messages.
13
+ */
14
+ batch?: number;
15
+ /**
16
+ * How many messages to return in total.
17
+ *
18
+ * @default Infinity
19
+ */
20
+ limit?: number;
21
+ }
7
22
  declare class ChannelMixin {
8
23
  #private;
9
24
  protected client: App;
@@ -32,6 +47,15 @@ declare class ChannelMixin {
32
47
  * @returns A message reference object
33
48
  */
34
49
  message(ts: string): MessageRef<import("../api/types/message.js").AnyMessage>;
50
+ /**
51
+ * Fetches messages in the channel. Note that this method only fetches root messages (i.e.,
52
+ * messages not in a thread); to fetch thread replies, use the `replies` method on messages
53
+ * instead.
54
+ *
55
+ * @param params Options for fetching messages
56
+ * @returns An async iterator of messages, from newest to oldest
57
+ */
58
+ messages(params?: FetchMessagesParams): AsyncGenerator<MessageInstance, void, unknown>;
35
59
  }
36
60
  export declare class ChannelRef extends ChannelMixin implements PromiseLike<ChannelInstance> {
37
61
  #private;
@@ -40,7 +64,9 @@ export declare class ChannelRef extends ChannelMixin implements PromiseLike<Chan
40
64
  export declare class Channel extends ChannelMixin {
41
65
  #private;
42
66
  constructor(client: App, id: string, data: Conversation);
67
+ /** A reference to the creator of this channel. Only available for non-DM channels. */
68
+ get creator(): UserRef | undefined;
43
69
  }
44
- export type ChannelInstance = Channel & Conversation;
70
+ export type ChannelInstance = Channel & DistributiveOmit<Conversation, "creator">;
45
71
  export {};
46
72
  //# sourceMappingURL=channel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../src/resources/channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,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,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,WAAW,CAAA;AAErE,cAAM,YAAY;;IAIhB,SAAS,CAAC,MAAM,EAAE,GAAG;gBAAX,MAAM,EAAE,GAAG,EACrB,EAAE,EAAE,MAAM;IAKX,wBAAwB;IACxB,IAAI,EAAE,WAEL;IAED;;;;;OAKG;IACG,IAAI,CAAC,OAAO,EAAE,gBAAgB,CAAC,oBAAoB,EAAE,SAAS,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAE1F;;;;;OAKG;IACG,IAAI,CACT,OAAO,EAAE,gBAAgB,CAAC,uBAAuB,EAAE,SAAS,CAAC,GAAG,MAAM,GACpE,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;IAiB1C;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM;CAGlB;AAED,qBAAa,UAAW,SAAQ,YAAa,YAAW,WAAW,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,YAAY,EAAE,SAAS,CAAC,CAAA"}
@@ -1,6 +1,8 @@
1
1
  import { makeProxy } from "../utils/index.js";
2
2
  import { sendMessage, } from "../utils/messaging.js";
3
+ import { paginate } from "../utils/paginate.js";
3
4
  import { Message, MessageRef } from "./message.js";
5
+ import { UserRef } from "./user.js";
4
6
  class ChannelMixin {
5
7
  client;
6
8
  #id;
@@ -31,6 +33,19 @@ class ChannelMixin {
31
33
  message(ts) {
32
34
  return new MessageRef(this.client, this.#id, ts);
33
35
  }
36
+ /**
37
+ * Fetches messages in the channel. Note that this method only fetches root messages (i.e.,
38
+ * messages not in a thread); to fetch thread replies, use the `replies` method on messages
39
+ * instead.
40
+ *
41
+ * @param params Options for fetching messages
42
+ * @returns An async iterator of messages, from newest to oldest
43
+ */
44
+ async *messages(params = {}) {
45
+ yield* paginate(this.client, "conversations.history", { channel: this.#id, ...params }, (r) => r.messages
46
+ .values()
47
+ .map((m) => new Message(this.client, this.#id, m.ts, m)));
48
+ }
34
49
  }
35
50
  export class ChannelRef extends ChannelMixin {
36
51
  then(onfulfilled, onrejected) {
@@ -48,4 +63,8 @@ export class Channel extends ChannelMixin {
48
63
  this.#data = data;
49
64
  return makeProxy(this, () => this.#data);
50
65
  }
66
+ /** A reference to the creator of this channel. Only available for non-DM channels. */
67
+ get creator() {
68
+ return this.#data.creator ? new UserRef(this.client, this.#data.creator) : undefined;
69
+ }
51
70
  }
@@ -1,8 +1,31 @@
1
+ import type { BlockAction, BlockActionTypes } from "../api/interactive/block_actions.js";
2
+ import type { TimestampPaginationParams } from "../api/types/api.js";
1
3
  import type { AnyMessage, NormalMessage } from "../api/types/message.js";
2
4
  import type { App } from "../client.js";
3
5
  import { type SendMessageWithFiles, type SendMessageWithoutFiles } from "../utils/messaging.js";
4
6
  import type { DistributiveOmit } from "../utils/typing.js";
7
+ import type { ActionInstance } from "./action.js";
5
8
  import { ChannelRef } from "./channel.js";
9
+ import { UserRef } from "./user.js";
10
+ interface FetchRepliesParams extends Omit<TimestampPaginationParams, "limit"> {
11
+ /**
12
+ * How many replies to fetch in each API call. This will not affect the number of returned
13
+ * messages.
14
+ */
15
+ batch?: number;
16
+ /**
17
+ * How many replies to return in total.
18
+ *
19
+ * @default Infinity
20
+ */
21
+ limit?: number;
22
+ /**
23
+ * Whether to include the root message in the results.
24
+ *
25
+ * @default true
26
+ */
27
+ root?: boolean;
28
+ }
6
29
  declare class MessageMixin {
7
30
  #private;
8
31
  protected client: App;
@@ -13,6 +36,11 @@ declare class MessageMixin {
13
36
  /** Timestamp of the message */
14
37
  get ts(): string;
15
38
  protected get _threadTs(): string | undefined;
39
+ /**
40
+ * Waits for an event about this message to occur before continuing. To configure the wait object,
41
+ * see its methods (for example, `message.wait.timeout(60000)`).
42
+ */
43
+ get wait(): MessageWait;
16
44
  /**
17
45
  * Sends a message as a reply to this messsage with files.
18
46
  *
@@ -27,6 +55,14 @@ declare class MessageMixin {
27
55
  * @returns The sent message
28
56
  */
29
57
  reply(message: DistributiveOmit<SendMessageWithoutFiles, "channel" | "thread_ts"> | string): Promise<MessageInstance<NormalMessage>>;
58
+ /**
59
+ * Fetches replies in the thread of this message. Note that this method may return the root
60
+ * message by default; set `params.root` to `false` to skip it.
61
+ *
62
+ * @param params Options for fetching replies
63
+ * @returns An async iterator of messages, from oldest to newest
64
+ */
65
+ replies(params?: FetchRepliesParams): AsyncGenerator<MessageInstance, void, unknown>;
30
66
  }
31
67
  export declare class MessageRef<Subtype extends AnyMessage = AnyMessage> extends MessageMixin implements PromiseLike<Message<Subtype>> {
32
68
  #private;
@@ -39,8 +75,67 @@ export declare class Message<Subtype extends AnyMessage = AnyMessage> extends Me
39
75
  isNormal(): this is MessageInstance<NormalMessage>;
40
76
  /** The raw data of this message */
41
77
  get raw(): Subtype;
78
+ /**
79
+ * A reference to the user that created the message. Note that for system messages (such as
80
+ * channel join messages), this may not be the user you expect. Read the Slack documentation to
81
+ * find out.
82
+ */
83
+ get author(): UserRef;
42
84
  protected get _threadTs(): string | undefined;
43
85
  }
44
86
  export type MessageInstance<Subtype extends AnyMessage = AnyMessage> = Message<Subtype> & Subtype;
87
+ declare class MessageWait {
88
+ private message;
89
+ private client;
90
+ private _timeout;
91
+ constructor(message: MessageMixin, client: App);
92
+ /**
93
+ * Sets the timeout of the wait. A `SlackTimeoutError` will be thrown if no matching event occurs
94
+ * after the timeout. Set this to `0` to disable timeouts; i.e., methods will wait forever. (This
95
+ * is dangerous because it creates potential memory leaks!)
96
+ *
97
+ * By default, timeout is set to 10 minutes.
98
+ *
99
+ * @param timeout Timeout in milliseconds
100
+ * @returns `this` for chaining
101
+ */
102
+ timeout(timeout: number): this;
103
+ /**
104
+ * Waits for a block action on this message happened (e.g., a button is pressed).
105
+ *
106
+ * The parameters can be any of any of the following:
107
+ *
108
+ * - An action ID; for example, `'place_order'`.
109
+ * - An event type and an action ID joined with a dot (`.`); for example, `'button.place_order'`.
110
+ * The benefit of using this instead of a plain action ID is, if all string parameters have an
111
+ * event type prefix, the return type of this function will be automatically narrowed to only
112
+ * the possible action types.
113
+ * - A function (`async` or not) that takes in an action and returns `false` if this action should
114
+ * be ignored (useful for permission checks).
115
+ *
116
+ * 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 checks.
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.
121
+ *
122
+ * @param specifiers An array of specifiers (see above for their format)
123
+ * @returns The action that occurred that matches the specifiers.
124
+ * @throws `SlackTimeoutError` if timed out before a matched event occurred
125
+ */
126
+ action<ActionIDs extends (string | ActionPredicate)[]>(...specifiers: ActionIDs): Promise<ExtractActionWaitReturnValue<ExtractString<ActionIDs[number]>>>;
127
+ }
128
+ type ActionPredicate = (action: ActionInstance) => boolean | Promise<boolean>;
129
+ type ExtractActionWaitReturnValue<ActionID extends string> = ActionInstance<ExtractWaitActionType<ActionID>>;
130
+ type ExtractWaitActionType<Specifier extends string> = {
131
+ [K in Specifier]: BlockAction & ExtractTypeAndActionID<Specifier>;
132
+ }[Specifier];
133
+ type ExtractTypeAndActionID<T extends string> = T extends `${infer Type extends BlockActionTypes}.${infer ActionID}` ? {
134
+ type: Type;
135
+ action_id: ActionID;
136
+ } : {
137
+ action_id: T;
138
+ };
139
+ type ExtractString<T> = T extends string ? T : never;
45
140
  export {};
46
141
  //# sourceMappingURL=message.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/resources/message.ts"],"names":[],"mappings":"AAAA,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;AAC3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAEtC,cAAM,YAAY;;IAKhB,SAAS,CAAC,MAAM,EAAE,GAAG;gBAAX,MAAM,EAAE,GAAG,EACrB,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,MAAM;IAMX,8CAA8C;IAC9C,IAAI,OAAO,eAEV;IAED,SAAS,KAAK,UAAU,WAEvB;IAED,+BAA+B;IAC/B,IAAI,EAAE,WAEL;IAED,SAAS,KAAK,SAAS,IAAI,MAAM,GAAG,SAAS,CAE5C;IAED;;;;;OAKG;IACG,KAAK,CACV,OAAO,EAAE,gBAAgB,CAAC,oBAAoB,EAAE,SAAS,GAAG,WAAW,CAAC,GACtE,OAAO,CAAC,SAAS,CAAC;IAErB;;;;;OAKG;IACG,KAAK,CACV,OAAO,EAAE,gBAAgB,CAAC,uBAAuB,EAAE,SAAS,GAAG,WAAW,CAAC,GAAG,MAAM,GAClF,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;CAoB1C;AAED,qBAAa,UAAU,CA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