2
0

♻️ (api) Auto start bot if starting with input

Closes #877, closes #884
This commit is contained in:
Baptiste Arnaud
2023-10-04 16:47:58 +02:00
parent 2bc9dfb503
commit 9e6a1f7dc0
11 changed files with 180 additions and 39 deletions

View File

@@ -28,6 +28,7 @@ import { validateRatingReply } from './blocks/inputs/rating/validateRatingReply'
import { parsePictureChoicesReply } from './blocks/inputs/pictureChoice/parsePictureChoicesReply'
import { parseVariables } from './variables/parseVariables'
import { updateVariablesInSession } from './variables/updateVariablesInSession'
import { startBotFlow } from './startBotFlow'
import { TRPCError } from '@trpc/server'
export const continueBotFlow =
@@ -36,6 +37,9 @@ export const continueBotFlow =
reply?: string
): Promise<ChatReply & { newSessionState: SessionState }> => {
let newSessionState = { ...state }
if (!newSessionState.currentBlock) return startBotFlow(state)
const group = state.typebotsQueue[0].typebot.groups.find(
(group) => group.id === state.currentBlock?.groupId
)