From 214ccc3986d9102029f81efd88f6e53904b575a3 Mon Sep 17 00:00:00 2001 From: Cedric Hoelzl Date: Thu, 2 Jul 2020 03:09:32 +0200 Subject: [PATCH] fix --- config.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/config.js b/config.js index 027a9b3..9079421 100644 --- a/config.js +++ b/config.js @@ -89,7 +89,7 @@ async function get_tracking(trck_ids){ if(rr.track) results.push({id:rr.no, date:rr.track.z0.a, loc:rr.track.z0.c, status:rr.track.z0.z}); else - results.push({id:rr.no, date:'?', loc:'?', status:"Unknown"}); + results.push({id:rr.no, date:'', loc:'', status:"Unknown"}); } return results; }); @@ -129,9 +129,9 @@ module.exports = function(){ return db.get_v(event.chat.id).then(res =>{ if(res && res != []){ return get_tracking(res).then(res=>{ - var text = "*Tracking*\n"; + var text = "*Tracking*\n\n"; for(var rr of res){ - text+=`_${rr.id}_ (${rr.date} - ${rr.loc})\n${rr.status}\n\n`; + text+=`*${rr.id}* (_${rr.date} - ${rr.loc}_)\n${rr.status}\n\n`; } return event.reply( text, {"reply_markup":Markup.inlineKeyboard(kb),"parse_mode":"Markdown"}); }); @@ -195,10 +195,12 @@ module.exports = function(){ }); }, action : (bot,event,data)=>{ - console.log(data); if(data){ return db.get_v(event.chat.id).then(res=>{ - db.set_v(event.chat.id,res.remove(data)); + for( var i = 0; i < res.length; i++){ + if ( res[i] == data) { + res.splice(i, 1); }} + db.set_v(event.chat.id,res); }); }else{ return db.get_v(event.chat.id).then(res =>{