wingbot 3.68.9 → 3.68.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/Responder.js +9 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wingbot",
3
- "version": "3.68.9",
3
+ "version": "3.68.10",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
package/src/Responder.js CHANGED
@@ -705,6 +705,7 @@ class Responder {
705
705
  * @param {QuickReply} reply
706
706
  * @param {boolean} [atStart]
707
707
  * @param {boolean} [toLastMessage]
708
+ * @param {boolean} [ifNotExists]
708
709
  * @returns {this}
709
710
  * @example
710
711
  *
@@ -716,12 +717,18 @@ class Responder {
716
717
  * }); // will be merged and sent with previously added quick replies
717
718
  * });
718
719
  */
719
- quickReply (reply, atStart = false, toLastMessage = true) {
720
+ quickReply (reply, atStart = false, toLastMessage = true, ifNotExists = false) {
720
721
  const useCa = this.currentAction();
721
722
 
723
+ const action = this.toAbsoluteAction(reply.action);
724
+
725
+ if (ifNotExists && !this._quickReplyCollector.some((q) => q.action === action)) {
726
+ return this;
727
+ }
728
+
722
729
  this._quickReplyCollector.push({
723
730
  ...reply,
724
- action: this.toAbsoluteAction(reply.action),
731
+ action,
725
732
  useCa,
726
733
  ...(atStart && { _prepend: true }),
727
734
  ...(toLastMessage && { _justToExisting: true })