diff --git a/backend/src/@types/WAWebJS.d.ts b/backend/src/@types/WAWebJS.d.ts deleted file mode 100644 index 0d17ab2..0000000 --- a/backend/src/@types/WAWebJS.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare namespace WAWebJS { - export interface ClientInfo { - meuId: number; - } -} diff --git a/backend/src/libs/wbot.ts b/backend/src/libs/wbot.ts index 4cbf5dd..68ef54b 100644 --- a/backend/src/libs/wbot.ts +++ b/backend/src/libs/wbot.ts @@ -3,7 +3,11 @@ import { Client } from "whatsapp-web.js"; import { getIO } from "./socket"; import Whatsapp from "../models/Whatsapp"; -const sessions: Client[] = []; +interface Session extends Client { + id?: number; +} + +const sessions: Session[] = []; export const initWbot = async (whatsapp: Whatsapp): Promise => { console.log("starting"); @@ -84,7 +88,7 @@ export const initWbot = async (whatsapp: Whatsapp): Promise => { } }; -export const getWbot = (whatsappId: number): Client | null => { +export const getWbot = (whatsappId: number): Session | null => { const sessionIndex = sessions.findIndex(s => s.id === whatsappId); if (sessionIndex === -1) {