Skip to content

Commit

Permalink
feat: allow various component types to be passed
Browse files Browse the repository at this point in the history
  • Loading branch information
some1chan committed Aug 31, 2022
1 parent d18fa3c commit e1f29e4
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions packages/core/src/structures/BaseDiscordMenuFlowPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ export abstract class BaseDiscordMenuFlowPage extends BasePluginObject {
*/
getDebugContent(
id: string,
components?: Discord.MessageActionRowComponent[]
components?:
| Discord.MessageActionRowComponent[]
| Discord.MessageActionRow[]
| Discord.MessageActionRow
): string {
const isProduction = process.env.NODE_ENV == "production";
const rawEnvShowDebugContent =
Expand Down Expand Up @@ -172,7 +175,19 @@ export abstract class BaseDiscordMenuFlowPage extends BasePluginObject {
process.env.FRAMED_SHOW_COMPONENT_DEBUG_INTERACTION_CONTENT?.toLowerCase() ==
"true"
) {
for (const component of components) {
let parsableComponents: Discord.MessageActionRowComponent[] = [];

if (components instanceof Discord.MessageActionRow) {
parsableComponents.push(...components.components);
} else {
for (const component of components) {
component.type == "ACTION_ROW"
? parsableComponents.push(...component.components)
: parsableComponents.push(component);
}
}

for (const component of parsableComponents) {
if (component.customId == null) continue;
base += getIdRender(component.customId, `- ${component.type}`);
}
Expand Down

0 comments on commit e1f29e4

Please sign in to comment.