alteraçao para possibilitar que o wbot origine de sessoes remotas
parent
c2e9048cb0
commit
3f29ce5d5f
|
@ -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');
|
||||
|
||||
if (body.search('dialog_actions') != -1) {
|
||||
|
@ -544,7 +544,7 @@ const extractCallCode = (str: string) => {
|
|||
}
|
||||
|
||||
const sendDialogflowAwswer = async (
|
||||
wbot: Session,
|
||||
wbot: any,
|
||||
ticket: Ticket,
|
||||
msg: WbotMessage,
|
||||
contact: Contact,
|
||||
|
@ -592,7 +592,7 @@ const sendDialogflowAwswer = async (
|
|||
|
||||
|
||||
const verifyQueue = async (
|
||||
wbot: Session,
|
||||
wbot: any,
|
||||
msg: WbotMessage,
|
||||
ticket: Ticket,
|
||||
contact: Contact
|
||||
|
@ -667,7 +667,9 @@ const verifyQueue = async (
|
|||
});
|
||||
|
||||
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);
|
||||
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')
|
||||
|
||||
|
@ -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!);
|
||||
|
||||
|
@ -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 });
|
||||
|
||||
|
@ -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(
|
||||
|
||||
|
@ -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(
|
||||
|
||||
|
@ -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 => {
|
||||
handleMessage(msg, wbot);
|
||||
|
|
Loading…
Reference in New Issue