@ebenos/framework
Advanced tools
Comparing version 3.2.15 to 3.2.16
@@ -21,5 +21,6 @@ import { GenericAdapter, User } from '..'; | ||
stopTyping: () => Scenario<A, U>; | ||
notify: (...params: any[]) => Scenario<A, U>; | ||
} | ||
export interface Action { | ||
call: 'message' | 'wait' | 'typing_on' | 'typing_off' | 'mark_seen' | 'handover'; | ||
call: 'message' | 'wait' | 'typing_on' | 'typing_off' | 'mark_seen' | 'handover' | 'notify'; | ||
params: any[]; | ||
@@ -26,0 +27,0 @@ } |
import { ISerializable } from "./elements"; | ||
import { IBaseMessageOptions } from "../adapter"; | ||
export interface IBaseInteraction { | ||
type: 'message' | 'typing_on' | 'typing_off' | 'mark_seen'; | ||
type: 'message' | 'typing_on' | 'typing_off' | 'mark_seen' | 'notify'; | ||
options: IBaseMessageOptions; | ||
@@ -17,5 +17,10 @@ } | ||
} | ||
export declare type IInteraction<T> = IMessageInteraction<T> | ISenderActionInteraction; | ||
export interface INotifyInteraction extends IBaseInteraction { | ||
type: 'notify'; | ||
notifyData: string; | ||
} | ||
export declare type IInteraction<T> = IMessageInteraction<T> | ISenderActionInteraction | INotifyInteraction; | ||
export declare function isMessageInteraction<T>(interaction: IInteraction<T>): interaction is IMessageInteraction<T>; | ||
export declare function isSenderActionInteraction<T>(interaction: IInteraction<T>): interaction is ISenderActionInteraction; | ||
export declare function isNotifyInteraction<T>(interaction: IInteraction<T>): interaction is INotifyInteraction; | ||
//# sourceMappingURL=interactions.d.ts.map |
@@ -11,2 +11,6 @@ "use strict"; | ||
exports.isSenderActionInteraction = isSenderActionInteraction; | ||
function isNotifyInteraction(interaction) { | ||
return interaction.type === 'notify'; | ||
} | ||
exports.isNotifyInteraction = isNotifyInteraction; | ||
//# sourceMappingURL=interactions.js.map |
@@ -23,3 +23,4 @@ "use strict"; | ||
seen, | ||
stopTyping | ||
stopTyping, | ||
notify | ||
// handover | ||
@@ -30,2 +31,9 @@ }; | ||
exports.default = createScenario; | ||
function notify(...params) { | ||
this._actions.push({ | ||
call: 'notify', | ||
params: [...params] | ||
}); | ||
return this; | ||
} | ||
function handover(...params) { | ||
@@ -41,4 +49,4 @@ this._actions.push({ | ||
try { | ||
const messages = processScenario(this._actions); | ||
yield this.adapter.sender(messages, 'ORDERED'); | ||
const actions = processScenario(this._actions); | ||
yield this.adapter.sender(actions, 'ORDERED'); | ||
} | ||
@@ -141,2 +149,12 @@ catch (err) { | ||
continue; | ||
case 'notify': | ||
messages.push({ | ||
type: 'notify', | ||
notifyData: params[0], | ||
options: { | ||
delay: waiter | ||
} | ||
}); | ||
waiter = 0; | ||
continue; | ||
} | ||
@@ -143,0 +161,0 @@ } |
{ | ||
"name": "@ebenos/framework", | ||
"version": "3.2.15", | ||
"version": "3.2.16", | ||
"description": "A module-based NodeJS chatbot framework.", | ||
@@ -58,3 +58,3 @@ "main": "./build/index.js", | ||
], | ||
"gitHead": "5cdc70c3a953a6e4809c6158f5c7fd300e8e0d04" | ||
"gitHead": "a61c81c76333c9bf759a9a165d8209a256feff0f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
96135
1553