@minesa-org/mini-interaction 0.3.1 → 0.3.2
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,7 +1,7 @@
|
|
|
1
1
|
import type { APIInteractionResponseCallbackData, MessageFlags } from "discord-api-types/v10";
|
|
2
2
|
import type { APIActionRowComponent, APIComponentInMessageActionRow, APIContainerComponent } from "discord-api-types/v10";
|
|
3
3
|
import type { JSONEncodable } from "../builders/shared.js";
|
|
4
|
-
import
|
|
4
|
+
import { InteractionFlags } from "../types/InteractionFlags.js";
|
|
5
5
|
/** Union of helper flag enums and raw Discord message flags. */
|
|
6
6
|
export type MessageFlagLike = MessageFlags | InteractionFlags;
|
|
7
7
|
/** Top-level components allowed in messages (ActionRows or Containers) */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { resolveJSONEncodable } from "../builders/shared.js";
|
|
2
2
|
import { ComponentType, } from "discord-api-types/v10";
|
|
3
|
+
import { InteractionFlags } from "../types/InteractionFlags.js";
|
|
3
4
|
const COMPONENTS_V2_TYPES = new Set([
|
|
4
5
|
ComponentType.Container,
|
|
5
6
|
ComponentType.Section,
|
|
@@ -8,6 +9,8 @@ const COMPONENTS_V2_TYPES = new Set([
|
|
|
8
9
|
ComponentType.File,
|
|
9
10
|
ComponentType.Separator,
|
|
10
11
|
ComponentType.Thumbnail,
|
|
12
|
+
18, // Label
|
|
13
|
+
19, // FileUpload
|
|
11
14
|
]);
|
|
12
15
|
/**
|
|
13
16
|
* Normalises helper flag enums into the raw Discord `MessageFlags` bitfield.
|
|
@@ -56,7 +59,7 @@ export function normaliseInteractionMessageData(data) {
|
|
|
56
59
|
if (responseData.components && Array.isArray(responseData.components)) {
|
|
57
60
|
if (containsComponentsV2(responseData.components)) {
|
|
58
61
|
const currentFlags = responseData.flags ?? 0;
|
|
59
|
-
responseData.flags = (currentFlags |
|
|
62
|
+
responseData.flags = (currentFlags | InteractionFlags.IsComponentsV2);
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
return responseData;
|
package/package.json
CHANGED