Add bots files handling logic
This commit is contained in:
@@ -4,6 +4,7 @@ import ensureBotSession from "@/src/functions/backend/db/bot-sessions/ensure-bot
|
||||
import insertUserMessage from "@/src/functions/backend/db/bots/insert-user-message";
|
||||
import grabUserBotMessage from "@/src/functions/backend/db/bots/grab-user-bot-message";
|
||||
import grabAttachableMedia from "@/src/functions/backend/db/bots/grab-attachable-media";
|
||||
import storeChatAttachments from "@/src/functions/backend/db/bot-files/store-chat-attachments";
|
||||
import enqueueBotReply from "@/src/functions/backend/db/bots-queue/enqueue-bot-reply";
|
||||
import pushBotNotice from "@/src/bots-queue/push-bot-notice";
|
||||
import wakeBotsQueue from "@/src/bots-queue/wake-bots-queue";
|
||||
@@ -93,6 +94,17 @@ export const handler: BunextAPIRouteHandler<APIResponseObject> = async ({
|
||||
media,
|
||||
});
|
||||
|
||||
/**
|
||||
* The files join the conversation's folder, so a later run can
|
||||
* search what the user sent now.
|
||||
*/
|
||||
await storeChatAttachments({
|
||||
bot_id: bot.id,
|
||||
workspace_id: conversation.workspace_id,
|
||||
user_id: user.id,
|
||||
media,
|
||||
});
|
||||
|
||||
await enqueueBotReply({
|
||||
user_id: user.id,
|
||||
bot_id: bot.id,
|
||||
|
||||
Reference in New Issue
Block a user