feat: if theres only one queue on whatsapp, assign tickets to this queue

This commit is contained in:
canove
2021-01-14 21:21:20 -03:00
parent 7b4f38965e
commit 964ed649d7
2 changed files with 5 additions and 2 deletions

View File

@@ -138,7 +138,6 @@ const verifyQueue = async (
const { queues, greetingMessage } = await ShowWhatsAppService(wbot.id!);
if (queues.length === 1) {
// await ticket.$set("queue", queues[0].id);
await UpdateTicketService({
ticketData: { queueId: queues[0].id },
ticketId: ticket.id
@@ -267,7 +266,7 @@ const handleMessage = async (
!chat.isGroup &&
!msg.fromMe &&
!ticket.userId &&
whatsapp.queues.length > 1
whatsapp.queues.length >= 1
) {
await verifyQueue(wbot, msg, ticket, contact);
}

View File

@@ -389,6 +389,10 @@ const messages = {
ERR_CREATING_TICKET: "Error while creating ticket on database.",
ERR_FETCH_WAPP_MSG:
"Error fetching the message in WhtasApp, maybe it is too old.",
ERR_QUEUE_COLOR_ALREADY_EXISTS:
"This color is already in use, pick another one.",
ERR_WAPP_GREETING_REQUIRED:
"Greeting message is required if there is more than one queue.",
},
},
},