@minesa-org/mini-interaction 0.3.6 → 0.3.7

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.
@@ -77,19 +77,30 @@ export function createModalSubmitInteraction(interaction, helpers) {
77
77
  }
78
78
  return undefined;
79
79
  };
80
+ /**
81
+ * Helper method to get the value(s) of a select menu component by its custom ID.
82
+ * Handles the nested structure of modal components (Action Rows -> Components).
83
+ */
80
84
  const getSelectMenuValues = (customId) => {
85
+ // 1. Access this.interaction.data.components (Array of Action Rows)
81
86
  for (const actionRow of interaction.data.components) {
87
+ // 2. Iterate through these Action Rows
82
88
  if ("components" in actionRow && Array.isArray(actionRow.components)) {
89
+ // 3. Inside each row, look for a component
83
90
  for (const rawComponent of actionRow.components) {
91
+ // Cast to any to handle potential type definitions that might not fully support Select Menus in Modals yet
84
92
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
85
93
  const component = rawComponent;
94
+ // 4. Match customId and check for 'values' property (specific to Select Menus)
86
95
  if (component.custom_id === customId &&
87
96
  Array.isArray(component.values)) {
97
+ // 5. Return its values property
88
98
  return component.values;
89
99
  }
90
100
  }
91
101
  }
92
102
  }
103
+ // 6. If not found, return undefined
93
104
  return undefined;
94
105
  };
95
106
  const getComponentValue = (customId) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minesa-org/mini-interaction",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
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",