From 7fd34627a8c525f2f2d03ce6c1a35611b8fffd93 Mon Sep 17 00:00:00 2001 From: Cedric Hoelzl Date: Wed, 1 Jul 2020 11:15:24 +0200 Subject: [PATCH] kk --- config.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) 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"}); + }); + } }) }