alteraçao para possibilitar que o wbot origine de sessoes remotas

pull/20/head
adriano 2023-04-17 16:31:14 -03:00
parent c2e9048cb0
commit 3f29ce5d5f
1 changed files with 12 additions and 10 deletions

View File

@ -307,7 +307,7 @@ const monitoramento_response2 = async (response: any | null, wbot: any, contact:
async function sendDelayedMessages(wbot: Session, ticket: Ticket, contact: Contact, message: string, _msg?: WbotMessage) { async function sendDelayedMessages(wbot: any, ticket: Ticket, contact: Contact, message: string, _msg?: WbotMessage) {
const body = message.replace(/\\n/g, '\n'); const body = message.replace(/\\n/g, '\n');
if (body.search('dialog_actions') != -1) { if (body.search('dialog_actions') != -1) {
@ -544,7 +544,7 @@ const extractCallCode = (str: string) => {
} }
const sendDialogflowAwswer = async ( const sendDialogflowAwswer = async (
wbot: Session, wbot: any,
ticket: Ticket, ticket: Ticket,
msg: WbotMessage, msg: WbotMessage,
contact: Contact, contact: Contact,
@ -592,7 +592,7 @@ const sendDialogflowAwswer = async (
const verifyQueue = async ( const verifyQueue = async (
wbot: Session, wbot: any,
msg: WbotMessage, msg: WbotMessage,
ticket: Ticket, ticket: Ticket,
contact: Contact contact: Contact
@ -667,7 +667,9 @@ const verifyQueue = async (
}); });
const _ticket = await ShowTicketService(ticket.id); const _ticket = await ShowTicketService(ticket.id);
const chat = await msg.getChat(); // const chat = await msg.getChat();
const chat = wbot.chat
await sendDialogflowAwswer(wbot, _ticket, msg, contact, chat); await sendDialogflowAwswer(wbot, _ticket, msg, contact, chat);
return return
@ -733,7 +735,7 @@ const verifyQueue = async (
} }
}; };
const transferTicket = async (queueIndex: number, wbot: Session, ticket: Ticket, contact: Contact) => { const transferTicket = async (queueIndex: number, wbot: any, ticket: Ticket, contact: Contact) => {
const botInfo = await BotIsOnQueue('botqueue') const botInfo = await BotIsOnQueue('botqueue')
@ -789,7 +791,7 @@ const isValidMsg = (msg: WbotMessage): boolean => {
}; };
const queuesOutBot = async (wbot: Session, botId: string | number) => { const queuesOutBot = async (wbot: any, botId: string | number) => {
const { queues, greetingMessage } = await ShowWhatsAppService(wbot.id!); const { queues, greetingMessage } = await ShowWhatsAppService(wbot.id!);
@ -803,7 +805,7 @@ const queuesOutBot = async (wbot: Session, botId: string | number) => {
} }
const botTransferTicket = async (queues: Queue, ticket: Ticket, contact: Contact, wbot: Session) => { const botTransferTicket = async (queues: Queue, ticket: Ticket, contact: Contact, wbot: any) => {
await ticket.update({ userId: null }); await ticket.update({ userId: null });
@ -811,7 +813,7 @@ const botTransferTicket = async (queues: Queue, ticket: Ticket, contact: Contact
} }
const botSendMedia = async (ticket: Ticket, contact: Contact, wbot: Session, mediaPath: string, fileNameExtension: string) => { const botSendMedia = async (ticket: Ticket, contact: Contact, wbot: any, mediaPath: string, fileNameExtension: string) => {
const debouncedSentMessage = debounce( const debouncedSentMessage = debounce(
@ -843,7 +845,7 @@ const botSendMedia = async (ticket: Ticket, contact: Contact, wbot: Session, med
} }
const botSendMessage = (ticket: Ticket, contact: Contact, wbot: Session, msg: string) => { const botSendMessage = (ticket: Ticket, contact: Contact, wbot: any, msg: string) => {
const debouncedSentMessage = debounce( const debouncedSentMessage = debounce(
@ -1175,7 +1177,7 @@ const handleMsgAck = async (msg_id: any, ack: any) => {
} }
}; };
const wbotMessageListener = (wbot: Session): void => { const wbotMessageListener = (wbot: any): void => {
wbot.on("message_create", async msg => { wbot.on("message_create", async msg => {
handleMessage(msg, wbot); handleMessage(msg, wbot);