This commit is contained in:
Cedric Hoelzl 2020-07-02 03:09:32 +02:00
parent 9d91409629
commit 214ccc3986

View File

@ -89,7 +89,7 @@ async function get_tracking(trck_ids){
if(rr.track) if(rr.track)
results.push({id:rr.no, date:rr.track.z0.a, loc:rr.track.z0.c, status:rr.track.z0.z}); results.push({id:rr.no, date:rr.track.z0.a, loc:rr.track.z0.c, status:rr.track.z0.z});
else else
results.push({id:rr.no, date:'?', loc:'?', status:"Unknown"}); results.push({id:rr.no, date:'', loc:'', status:"Unknown"});
} }
return results; return results;
}); });
@ -129,9 +129,9 @@ module.exports = function(){
return db.get_v(event.chat.id).then(res =>{ return db.get_v(event.chat.id).then(res =>{
if(res && res != []){ if(res && res != []){
return get_tracking(res).then(res=>{ return get_tracking(res).then(res=>{
var text = "*Tracking*\n"; var text = "*Tracking*\n\n";
for(var rr of res){ 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"}); return event.reply( text, {"reply_markup":Markup.inlineKeyboard(kb),"parse_mode":"Markdown"});
}); });
@ -195,10 +195,12 @@ module.exports = function(){
}); });
}, },
action : (bot,event,data)=>{ action : (bot,event,data)=>{
console.log(data);
if(data){ if(data){
return db.get_v(event.chat.id).then(res=>{ 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{ }else{
return db.get_v(event.chat.id).then(res =>{ return db.get_v(event.chat.id).then(res =>{