@minesa-org/mini-interaction 0.3.2 → 0.3.4

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.
@@ -1,6 +1,6 @@
1
1
  export declare enum InteractionFlags {
2
2
  Ephemeral = 64,
3
- IsComponentsV2 = 4096,
3
+ IsComponentsV2 = 32768,
4
4
  SuppressEmbeds = 4
5
5
  }
6
6
  /** @deprecated Use InteractionFlags instead. */
@@ -1,7 +1,7 @@
1
1
  export var InteractionFlags;
2
2
  (function (InteractionFlags) {
3
3
  InteractionFlags[InteractionFlags["Ephemeral"] = 64] = "Ephemeral";
4
- InteractionFlags[InteractionFlags["IsComponentsV2"] = 4096] = "IsComponentsV2";
4
+ InteractionFlags[InteractionFlags["IsComponentsV2"] = 32768] = "IsComponentsV2";
5
5
  InteractionFlags[InteractionFlags["SuppressEmbeds"] = 4] = "SuppressEmbeds";
6
6
  })(InteractionFlags || (InteractionFlags = {}));
7
7
  /** @deprecated Use InteractionFlags instead. */
@@ -325,10 +325,12 @@ export function createCommandInteraction(interaction, helpers) {
325
325
  typeof data.toJSON === "function"
326
326
  ? data.toJSON()
327
327
  : data;
328
- return captureResponse({
328
+ const response = captureResponse({
329
329
  type: InteractionResponseType.Modal,
330
330
  data: resolvedData,
331
331
  });
332
+ this.onAck?.(response);
333
+ return response;
332
334
  },
333
335
  async withTimeoutProtection(operation, deferOptions) {
334
336
  const startTime = Date.now();
@@ -84,10 +84,12 @@ function createContextMenuInteractionHelpers(interaction, helpers) {
84
84
  };
85
85
  const showModal = (data) => {
86
86
  const modalData = typeof data === "object" && "toJSON" in data ? data.toJSON() : data;
87
- return captureResponse({
87
+ const response = captureResponse({
88
88
  type: InteractionResponseType.Modal,
89
89
  data: modalData,
90
90
  });
91
+ helpers?.onAck?.(response);
92
+ return response;
91
93
  };
92
94
  const getResponse = () => capturedResponse;
93
95
  return {
@@ -103,10 +103,12 @@ export function createMessageComponentInteraction(interaction, helpers) {
103
103
  typeof data.toJSON === "function"
104
104
  ? data.toJSON()
105
105
  : data;
106
- return captureResponse({
106
+ const response = captureResponse({
107
107
  type: InteractionResponseType.Modal,
108
108
  data: resolvedData,
109
109
  });
110
+ helpers?.onAck?.(response);
111
+ return response;
110
112
  };
111
113
  const editReply = async (data) => {
112
114
  if (helpers?.canRespond && !helpers.canRespond(interaction.id)) {
@@ -1,6 +1,5 @@
1
1
  import { resolveJSONEncodable } from "../builders/shared.js";
2
2
  import { ComponentType, } from "discord-api-types/v10";
3
- import { InteractionFlags } from "../types/InteractionFlags.js";
4
3
  const COMPONENTS_V2_TYPES = new Set([
5
4
  ComponentType.Container,
6
5
  ComponentType.Section,
@@ -59,7 +58,7 @@ export function normaliseInteractionMessageData(data) {
59
58
  if (responseData.components && Array.isArray(responseData.components)) {
60
59
  if (containsComponentsV2(responseData.components)) {
61
60
  const currentFlags = responseData.flags ?? 0;
62
- responseData.flags = (currentFlags | InteractionFlags.IsComponentsV2);
61
+ responseData.flags = (currentFlags | (0x1 << 15));
63
62
  }
64
63
  }
65
64
  return responseData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minesa-org/mini-interaction",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Mini interaction, connecting your app with Discord via HTTP-interaction (Vercel support).",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",