diff --git a/config.js b/config.js index 92a1231..6d7f7e7 100644 --- a/config.js +++ b/config.js @@ -43,10 +43,12 @@ module.exports = function(){ kb.push([bot.mkcb_close("Close")]); return db.get_v(event.chat.id).then(res =>{ - console.log(res); - return event.reply( (res+"") , {"reply_markup":Markup.inlineKeyboard(kb),"parse_mode":"Markdown"}); - }).catch(err => { - return event.reply("*No Tracking Yet*", {"reply_markup":Markup.inlineKeyboard(kb),"parse_mode":"Markdown"}) + if(res){ + return event.reply( (res+"") , {"reply_markup":Markup.inlineKeyboard(kb),"parse_mode":"Markdown"}); + }else{ + return event.reply("*No Tracking Yet*", {"reply_markup":Markup.inlineKeyboard(kb),"parse_mode":"Markdown"}); + } + }) @@ -64,15 +66,17 @@ module.exports = function(){ }); }, action : (bot,event,message)=>{ - var ids = message.replace('.','').split('\n'); + var ids = messaget.text.replace('.','').split('\n'); return db.get_v(event.chat.id).then(res =>{ - return db.set_v(event.chat.id,res.concat(ids)).then(res=>{ - return event.reply("Added ids to Tracking.", {"parse_mode":"Markdown"}) - }); - }).catch(err => { - return db.set_v(event.chat.id, ids).then(res=>{ - return event.reply("Added ids to Tracking.", {"parse_mode":"Markdown"}); - }); + if(res){ + return db.set_v(event.chat.id,res.concat(ids)).then(res=>{ + return event.reply("Added ids to Tracking.", {"parse_mode":"Markdown"}) + }); + }else{ + return db.set_v(event.chat.id, ids).then(res=>{ + return event.reply("Added ids to Tracking.", {"parse_mode":"Markdown"}); + }); + } }) }