diff --git a/server/api/messages/[instanceId]/[chatId]/send.post.ts b/server/api/messages/[instanceId]/[chatId]/send.post.ts index 9e0cf99..999a710 100644 --- a/server/api/messages/[instanceId]/[chatId]/send.post.ts +++ b/server/api/messages/[instanceId]/[chatId]/send.post.ts @@ -183,16 +183,20 @@ async function handleMediaMessage( isPtt = item.data.toString() === 'true' } else if (item.name === 'asSticker' && item.data) { // Parse asSticker array (sent as JSON string) + const rawValue = item.data.toString() + console.log(`[Send] Received asSticker raw value: ${rawValue}`) try { - const parsed = JSON.parse(item.data.toString()) + const parsed = JSON.parse(rawValue) + console.log(`[Send] Parsed asSticker:`, parsed) if (Array.isArray(parsed)) { asSticker.push(...parsed) } } catch { // If not JSON, try comma-separated values - const values = item.data.toString().split(',') + const values = rawValue.split(',') asSticker.push(...values.map(v => v.trim() === 'true')) } + console.log(`[Send] Final asSticker array:`, asSticker) } else if ((item.name === 'files' || item.name === 'file') && item.data && item.type) { files.push({ name: item.filename || 'file', @@ -221,10 +225,12 @@ async function handleMediaMessage( const sentMessages = [] // Send each file + console.log(`[Send] Processing ${files.length} files, asSticker array:`, asSticker) for (let index = 0; index < files.length; index++) { const file = files[index] const sendAsSticker = asSticker[index] === true && canConvertToSticker(file.type) const mediaType = getMediaType(file.type) + console.log(`[Send] File ${index}: ${file.name}, type: ${file.type}, sendAsSticker: ${sendAsSticker}, asSticker[${index}]: ${asSticker[index]}`) // Validate file size if (sendAsSticker) {