@@ -12,8 +12,13 @@ export const createDialogflowMessage = async (rid: string, read: IRead, modify:
1212 const { messages = [ ] } = dialogflowMessage ;
1313
1414 for ( const message of messages ) {
15- const { text, options } = message as IDialogflowQuickReplies ;
15+ const { text, options, disableInput , disableInputMessage } = message as IDialogflowQuickReplies ;
1616 if ( text && options ) {
17+ const customFields = {
18+ disableInput : ! ! disableInput ,
19+ disableInputMessage : disableInputMessage || 'Please Wait' ,
20+ } ;
21+
1722 const elements : Array < IButtonElement > = options . map ( ( payload : IDialogflowQuickReplyOptions ) => ( {
1823 type : BlockElementType . BUTTON ,
1924 text : {
@@ -28,7 +33,7 @@ export const createDialogflowMessage = async (rid: string, read: IRead, modify:
2833 const actionsBlock : IActionsBlock = { type : BlockType . ACTIONS , elements } ;
2934
3035 await createMessage ( rid , read , modify , { text } ) ;
31- await createMessage ( rid , read , modify , { actionsBlock } ) ;
36+ await createMessage ( rid , read , modify , { actionsBlock, customFields : customFields . disableInput ? customFields : null } ) ;
3237 } else {
3338 // message is instanceof string
3439 if ( ( message as string ) . trim ( ) . length > 0 ) {
@@ -61,9 +66,14 @@ export const createMessage = async (rid: string, read: IRead, modify: IModify,
6166 return ;
6267 }
6368
64- const msg = modify . getCreator ( ) . startMessage ( ) . setRoom ( room ) . setSender ( sender ) ;
69+ const { text, actionsBlock, attachment, customFields } = message ;
70+ let data = { room, sender } ;
6571
66- const { text, actionsBlock, attachment } = message ;
72+ if ( customFields ) {
73+ data = Object . assign ( data , { customFields } ) ;
74+ }
75+
76+ const msg = modify . getCreator ( ) . startMessage ( data ) ;
6777
6878 if ( text ) {
6979 msg . setText ( text ) ;
0 commit comments