2
0

Add audio clips option on text input block

Closes #157
This commit is contained in:
Baptiste Arnaud
2024-08-20 14:35:20 +02:00
parent 984c2bf387
commit 135251d3f7
55 changed files with 1535 additions and 366 deletions

View File

@@ -232,7 +232,11 @@ const getIncomingMessageContent = async ({
if (message.type === 'document') mediaId = message.document.id
if (!mediaId) return
const fileVisibility =
block?.type === InputBlockType.FILE
block?.type === InputBlockType.TEXT &&
block.options?.audioClip?.isEnabled &&
message.type === 'audio'
? block.options?.audioClip.visibility
: block?.type === InputBlockType.FILE
? block.options?.visibility
: block?.type === InputBlockType.TEXT
? block.options?.attachments?.visibility
@@ -259,6 +263,11 @@ const getIncomingMessageContent = async ({
})
fileUrl = url
}
if (message.type === 'audio')
return {
type: 'audio',
url: fileUrl,
}
if (block?.type === InputBlockType.FILE) {
if (text !== '') text += `, ${fileUrl}`
else text = fileUrl

View File

@@ -112,7 +112,7 @@ export const messageMatchStartCondition = (
startCondition: NonNullable<Settings['whatsApp']>['startCondition']
) => {
if (!startCondition) return true
if (!message?.text) return false
if (message?.type !== 'text' || !message.text) return false
return startCondition.logicalOperator === LogicalOperator.AND
? startCondition.comparisons.every((comparison) =>
matchComparison(