mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-18 03:39:29 +00:00
added id to whatsbot session types
This commit is contained in:
5
backend/src/@types/WAWebJS.d.ts
vendored
5
backend/src/@types/WAWebJS.d.ts
vendored
@@ -1,5 +0,0 @@
|
||||
declare namespace WAWebJS {
|
||||
export interface ClientInfo {
|
||||
meuId: number;
|
||||
}
|
||||
}
|
||||
@@ -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<void> => {
|
||||
console.log("starting");
|
||||
@@ -84,7 +88,7 @@ export const initWbot = async (whatsapp: Whatsapp): Promise<void> => {
|
||||
}
|
||||
};
|
||||
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user