const fsPromises = require("fs/promises");
const fs = require("fs");

import ListUsersService from "../services/UserServices/ListUsersService";
import { get } from "./RedisClient";

const _botIsOnQueue = async (botName: string) => {
  const botInfo = await get({ key: "botInfo", parse: true });

  if (
    botInfo &&
    botInfo?.userId &&
    botInfo?.queueId &&
    botInfo?.botIsOnQueue == true
  ) {
    return {
      userIdBot: botInfo.userId,
      botQueueId: botInfo.queueId,
      isOnQueue: botInfo.botIsOnQueue
    };
  }
  return { userIdBot: null, botQueueId: null, isOnQueue: false };
};

export default _botIsOnQueue;
