Skip to content

Commit

Permalink
fix: parameters copying to processors
Browse files Browse the repository at this point in the history
  • Loading branch information
benchambule committed Aug 25, 2024
1 parent 4b3e423 commit a7d4e6f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ async function form_processor(req, res){
}

if(option.parameters){
req.parameters = option.parameters;
req.parameters = {...req.parameters, ...option.parameters};
}

return await redirect(next, req);
Expand All @@ -620,7 +620,7 @@ async function form_processor(req, res){
let parameter = {}
parameter[name] = value;

req = {parameters: parameter};
req.parameters = {...req.parameters, ...parameter};

let next = input?.next;

Expand Down Expand Up @@ -657,7 +657,7 @@ function format_message(message, parameters){
result += message.error + "\n";
}

if(message.form.options){
if(message.form && message.form.options){
for(const option of message.form.options){
result += option[0] + " - " + option[1].label + "\n";
}
Expand All @@ -667,5 +667,11 @@ function format_message(message, parameters){
result += message.footer + "\n";
}

if(parameters){
for(const key of Object.keys(parameters)){
result = result.replace("{{"+key+"}}", parameters[key]);
}
}

return result;
}

0 comments on commit a7d4e6f

Please sign in to comment.