diff --git a/controllers/Bot.js b/controllers/Bot.js index 28cb0cb..aca85bd 100644 --- a/controllers/Bot.js +++ b/controllers/Bot.js @@ -1,12 +1,12 @@ import ActionsService from '../services/Actions.js' import AI from '../services/AI.js' import logger from '../utils/logger.js' -import {db} from '../server.js' +import DBService from '../services/DBService.js' import { v4 as uuidv4 } from 'uuid' import MapsService from '../services/MapService.js' import get_text_by_key from '../utils/language.js' const mapService = new MapsService() - +const db = new DBService() const actionsService = new ActionsService() /** diff --git a/services/DBService.js b/services/DBService.js index 26dac25..1b887b9 100644 --- a/services/DBService.js +++ b/services/DBService.js @@ -149,38 +149,7 @@ class DBService { return sessions; } - async set_data(key, data) { - let response = { - status: false, - } - try { - await this.redisClient.set(key, JSON.stringify(data)) - response.status = true - response.message = 'Data set successfully!' - } catch (err) { - logger.error(err) - response.error = err - } - - logger.info(response) - return response - } - async get_data(key) { - let response = { - status: false, - } - try { - const data = await this.redisClient.get(key) - response.status = true - response.message = 'Data fetched successfully!'; - response.data = JSON.parse(data) - } catch (err) { - logger.error(err) - response.error = err - } - - logger.info(response) - return response} + } export default DBService; \ No newline at end of file