const fsPromises = require("fs/promises");
const fs = require('fs')  
 
import ShowWhatsAppService from "../services/WhatsappService/ShowWhatsAppService";

import { Client } from "whatsapp-web.js"; 

interface Session extends Client { id?: number;}

const _queuesOutBot =async (wbot:Session, botId: string | number) => {

    const { queues, greetingMessage } = await ShowWhatsAppService(wbot.id!);   
  
    const indexQueue = queues.findIndex((q) => q.id == botId) 
  
    if(indexQueue != -1){  
      queues.splice(indexQueue, 1)  
    }   
  
    return {queues, greetingMessage}
    
  }

export default _queuesOutBot;