import { get, set } from "../helpers/RedisClient"; export async function setBotInfo(user: any) { if (user?.name?.trim() == "botqueue") { let botInfo; if ( user?.queues?.length > 0 && user.queues[0]?.name?.trim() == "botqueue" ) { botInfo = JSON.stringify({ userId: user.id, queueId: user.queues[0].id, botIsOnQueue: true }); botInfo = JSON.parse(botInfo); await set("botInfo", botInfo); } else if ( user?.queues?.length == 0 || user.queues[0]?.name?.trim() != "botqueue" ) { botInfo = JSON.stringify({ userId: user.id, queueId: 0, botIsOnQueue: false }); botInfo = JSON.parse(botInfo); await set("botInfo", botInfo); } } }