mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-18 19:59:20 +00:00
feat: started multiple whatsapps support
This commit is contained in:
@@ -132,12 +132,13 @@ const handleMessage = async (msg, ticket, contact) => {
|
||||
});
|
||||
};
|
||||
|
||||
const wbotMessageListener = () => {
|
||||
const wbot = getWbot();
|
||||
const wbotMessageListener = dbSession => {
|
||||
const wbot = getWbot(dbSession.name);
|
||||
const io = getIO();
|
||||
|
||||
wbot.on("message_create", async msg => {
|
||||
console.log(msg);
|
||||
|
||||
if (
|
||||
msg.from === "status@broadcast" ||
|
||||
msg.type === "location" ||
|
||||
|
||||
@@ -7,7 +7,7 @@ const { getWbot, init } = require("../libs/wbot");
|
||||
|
||||
const wbotMonitor = dbSession => {
|
||||
const io = getIO();
|
||||
const wbot = getWbot();
|
||||
const wbot = getWbot(dbSession.name);
|
||||
|
||||
try {
|
||||
wbot.on("change_state", async newState => {
|
||||
@@ -58,8 +58,8 @@ const wbotMonitor = dbSession => {
|
||||
|
||||
setTimeout(
|
||||
() =>
|
||||
init()
|
||||
.then(({ dbSession }) => {
|
||||
init(dbSession)
|
||||
.then(() => {
|
||||
wbotMessageListener();
|
||||
wbotMonitor(dbSession);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user