export function rowFromActions()

in src/utils/discord.ts [68:84]


export function rowFromActions(
  actions: Action[],
  context: CustomIdContext
): ActionRowBuilder<ButtonBuilder> | null {
  if (actions.length == 0) {
    return null;
  }
  var row = new ActionRowBuilder<ButtonBuilder>();
  for (const action of actions) {
    const button = new ButtonBuilder()
      .setCustomId(action.customId(context))
      .setLabel(action.displayText)
      .setStyle(ButtonStyle.Secondary);
    row = row.addComponents(button);
  }
  return row;
}