fix: open chat with active poll and add new endpoint

This commit is contained in:
Anton Voylenko 2025-03-15 19:26:59 +02:00
commit 588642e904
4 changed files with 171 additions and 26 deletions

View file

@ -472,10 +472,12 @@ const reply = async (req, res) => {
}
case 'Poll': {
contentMessage = new Poll(content.pollName, content.pollOptions, content.options)
// fix for poll events not being triggered (open the chat that you sent the poll)
await client.interface.openChatWindow(chatId)
break
}
default:
return sendErrorResponse(res, 400, 'contentType invalid, must be string, MessageMedia, MessageMediaFromURL, Location, Buttons, List, Contact or Poll')
return sendErrorResponse(res, 400, 'contentType invalid, must be string, MessageMedia, MessageMediaFromURL, Location, Contact or Poll')
}
const repliedMessage = await message.reply(contentMessage, chatId, options)
res.json({ success: true, repliedMessage })