Skip to content

Commit

Permalink
add: addAutoOption for auto key options
Browse files Browse the repository at this point in the history
  • Loading branch information
benchambule committed Aug 22, 2024
1 parent bea0c1f commit f6e7c19
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,25 @@ Message.prototype.body = "";
Message.prototype.footer = "Powered by Lottus";


Message.prototype.addAutoOption = function addAutoOption(label, next, params){
if(!this.form){
this.form = {options: new Map()};
}

if(!this.form.options){
this.form.options = new Map();
}

let key = this.form.options.size + 1;

if(!label){
throw new Error("Argument label cannot be null nor empty");
}

this.form.options.set(key.toString(), {label, next, params});
}


Message.prototype.addOption = function addOption(key, label, next, params){
if(!this.form){
this.form = {options: new Map()};
Expand Down

0 comments on commit f6e7c19

Please sign in to comment.