Skip to content

Commit

Permalink
Update interactive.ts
Browse files Browse the repository at this point in the history
From the OOP POV, this is correct
  • Loading branch information
Secreto31126 committed Feb 29, 2024
1 parent f09a48a commit dd81b63
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/messages/interactive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,10 @@ export class ActionProduct implements InteractiveAction {
*
* @group Interactive
*/
export class ActionProductList implements InteractiveAction {
export class ActionProductList
extends ClientLimitedMessageComponent<ProductSection, 10>
implements InteractiveAction
{
/**
* The id of the catalog from where to get the products
*/
Expand All @@ -636,13 +639,9 @@ export class ActionProductList implements InteractiveAction {
* @throws If more than 1 product section is provided and at least one section is missing a title
*/
constructor(catalog_id: string, ...sections: AtLeastOne<ProductSection>) {
if (sections.length > 1) {
if (sections.length > 10) {
throw new Error(
"Catalog must have between 1 and 10 product sections"
);
}
super("ActionProductList", "sections", sections, 10);

if (sections.length > 1) {
for (const obj of sections) {
if (!obj.title) {
throw new Error(
Expand Down

0 comments on commit dd81b63

Please sign in to comment.