Debug: Agregar logs para depurar envio de stickers
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m8s
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m8s
This commit is contained in:
@@ -183,16 +183,20 @@ async function handleMediaMessage(
|
|||||||
isPtt = item.data.toString() === 'true'
|
isPtt = item.data.toString() === 'true'
|
||||||
} else if (item.name === 'asSticker' && item.data) {
|
} else if (item.name === 'asSticker' && item.data) {
|
||||||
// Parse asSticker array (sent as JSON string)
|
// Parse asSticker array (sent as JSON string)
|
||||||
|
const rawValue = item.data.toString()
|
||||||
|
console.log(`[Send] Received asSticker raw value: ${rawValue}`)
|
||||||
try {
|
try {
|
||||||
const parsed = JSON.parse(item.data.toString())
|
const parsed = JSON.parse(rawValue)
|
||||||
|
console.log(`[Send] Parsed asSticker:`, parsed)
|
||||||
if (Array.isArray(parsed)) {
|
if (Array.isArray(parsed)) {
|
||||||
asSticker.push(...parsed)
|
asSticker.push(...parsed)
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
// If not JSON, try comma-separated values
|
// 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'))
|
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) {
|
} else if ((item.name === 'files' || item.name === 'file') && item.data && item.type) {
|
||||||
files.push({
|
files.push({
|
||||||
name: item.filename || 'file',
|
name: item.filename || 'file',
|
||||||
@@ -221,10 +225,12 @@ async function handleMediaMessage(
|
|||||||
const sentMessages = []
|
const sentMessages = []
|
||||||
|
|
||||||
// Send each file
|
// Send each file
|
||||||
|
console.log(`[Send] Processing ${files.length} files, asSticker array:`, asSticker)
|
||||||
for (let index = 0; index < files.length; index++) {
|
for (let index = 0; index < files.length; index++) {
|
||||||
const file = files[index]
|
const file = files[index]
|
||||||
const sendAsSticker = asSticker[index] === true && canConvertToSticker(file.type)
|
const sendAsSticker = asSticker[index] === true && canConvertToSticker(file.type)
|
||||||
const mediaType = getMediaType(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
|
// Validate file size
|
||||||
if (sendAsSticker) {
|
if (sendAsSticker) {
|
||||||
|
|||||||
Reference in New Issue
Block a user