From 85d91de996ddf9f34938bc251d83c194e6be8cc7 Mon Sep 17 00:00:00 2001 From: Cedric Hoelzl Date: Wed, 1 Jul 2020 11:21:12 +0200 Subject: [PATCH] kk --- db.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/db.js b/db.js index 6f258de..62ea2b6 100644 --- a/db.js +++ b/db.js @@ -20,14 +20,14 @@ module.exports = function(name){ this.name = name; this.db = dbc(name); - this.get_chat = function(obj){ + this.get_chat = function(cid){ return new Promise((resolve, reject)=>{ - let res = this.db.get("chats").find({ id: obj.chat_id }).value(); + let res = this.db.get("chats").find({id:cid}).value(); if(res) return resolve(res); - this.db.get("chats").push({ id:obj.chat_id, lang: 0, geo:{lon:0,lat:0}}).write(); - res = this.db.get("chats").find({ id: obj.chat_id }).value(); + this.db.get("chats").push({id:cid, tracking:[]}).write(); + res = this.db.get("chats").find({id:cid}).value(); if(res) return resolve(res); return reject({error:true, msg:"Error With DB..."}); @@ -48,7 +48,7 @@ module.exports = function(name){ this.get_v = function(cid){ return new Promise((resolve, reject)=>{ - resolve(this.db.find({id:cid}).get('tracking').value()); + resolve(this.db.find({id:cid}).value().tracking); }); }