mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-20 20:59:16 +00:00
fix: sending a media from phone to gruop results in a new ticket with isGroup=false
This commit is contained in:
@@ -273,7 +273,10 @@ const wbotMessageListener = (wbot: Session): void => {
|
|||||||
if (msg.fromMe) {
|
if (msg.fromMe) {
|
||||||
msgContact = await wbot.getContactById(msg.to);
|
msgContact = await wbot.getContactById(msg.to);
|
||||||
|
|
||||||
// return if it's a media message, it will be handled by media_uploaded event
|
// media messages sent from me from cell phone, first comes with "hasMedia = false" and type = "image/ptt/etc"
|
||||||
|
// the media itself comes on body of message,in base64
|
||||||
|
// if this is the case, return and let this media be handled by media_uploaded event
|
||||||
|
// it should be improove to handle the base64 media here in future versions
|
||||||
|
|
||||||
if (!msg.hasMedia && msg.type !== "chat" && msg.type !== "vcard")
|
if (!msg.hasMedia && msg.type !== "chat" && msg.type !== "vcard")
|
||||||
return;
|
return;
|
||||||
@@ -310,8 +313,18 @@ const wbotMessageListener = (wbot: Session): void => {
|
|||||||
try {
|
try {
|
||||||
let groupContact: Contact | undefined;
|
let groupContact: Contact | undefined;
|
||||||
const msgContact = await wbot.getContactById(msg.to);
|
const msgContact = await wbot.getContactById(msg.to);
|
||||||
if (msg.author) {
|
|
||||||
const msgGroupContact = await wbot.getContactById(msg.from);
|
const chat = await msg.getChat();
|
||||||
|
|
||||||
|
if (chat.isGroup) {
|
||||||
|
let msgGroupContact;
|
||||||
|
|
||||||
|
if (msg.fromMe) {
|
||||||
|
msgGroupContact = await wbot.getContactById(msg.to);
|
||||||
|
} else {
|
||||||
|
msgGroupContact = await wbot.getContactById(msg.from);
|
||||||
|
}
|
||||||
|
|
||||||
groupContact = await verifyGroup(msgGroupContact);
|
groupContact = await verifyGroup(msgGroupContact);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user