From ea303caa1c3bafcf10a7451d13a497d62cd23738 Mon Sep 17 00:00:00 2001 From: rammohan-y <37395033+rammohan-y@users.noreply.github.com> Date: Tue, 8 Oct 2024 17:36:12 +0530 Subject: [PATCH] feat/924: made actions as optional when there is no noResponseTimeout (#925) --- lib/utils/action-hook-delay.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/utils/action-hook-delay.js b/lib/utils/action-hook-delay.js index de1cb358..839e38f1 100644 --- a/lib/utils/action-hook-delay.js +++ b/lib/utils/action-hook-delay.js @@ -24,10 +24,12 @@ class ActionHookDelayProcessor extends Emitter { this._active = false; const enabled = this.init(opts); - if (enabled && (!this.actions || !Array.isArray(this.actions) || this.actions.length === 0)) { + if (enabled && this.noResponseTimeout && + (!this.actions || !Array.isArray(this.actions) || this.actions.length === 0)) { throw new Error('ActionHookDelayProcessor: no actions specified'); } - else if (enabled && this.actions.some((a) => !a.verb || ![TaskName.Say, TaskName.Play].includes(a.verb))) { + else if (enabled && this.actions && + this.actions.some((a) => !a.verb || ![TaskName.Say, TaskName.Play].includes(a.verb))) { throw new Error(`ActionHookDelayProcessor: invalid actions specified: ${JSON.stringify(this.actions)}`); } }