From 475a790b513a8e89f274b7424b2cc8599db00bb7 Mon Sep 17 00:00:00 2001 From: Cedric Hoelzl Date: Mon, 21 Oct 2019 14:44:36 +0200 Subject: [PATCH] Coded --- config.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/config.js b/config.js index e3d0df3..ec225a4 100644 --- a/config.js +++ b/config.js @@ -67,7 +67,7 @@ const cbt = { sel:"s", } -function gen_kb(bot, parr,lang){ +function gen_kb(bot, p_en, parr,lang){ let bck_nxt = ""; let bck = ""; let kb = []; @@ -88,6 +88,9 @@ function gen_kb(bot, parr,lang){ } if(ntmr){ for(let k of Object.keys(ntmr)){ + if(p_en.indexOf(k.toString()) == -1){ + continue; + } let ctmr = ntmr[k]; if(ctmr.sub){ let str = ctmr.desc[lang]; @@ -107,15 +110,11 @@ function gen_kb(bot, parr,lang){ } } } - - kb.push(bot.mkcb("Back",cbt.sel,bck)); + if(parr.length > 0) + kb.push(bot.mkcb("Back",cbt.sel,bck)); return kb; } -let bot ={ - mkcb(x,y,z)=>{return y+"_"+z}; -} -console.log(gen_kb(bot,["atrium","basic"],0)) module.exports = function(arr){ this.arr = arr; @@ -142,7 +141,7 @@ module.exports = function(arr){ }); }, action : (bot,event,message)=>{ - var kb = gen_kb(bot,this.arr,event.master.lang); + var kb = gen_kb(bot,this.arr,[],event.master.lang); return event.reply("Select An Option", {"reply_markup":Markup.inlineKeyboard(kb),"parse_mode":"Markdown"}); } @@ -160,11 +159,11 @@ module.exports = function(arr){ }); }, action : (bot,event,data)=>{ - let arr = this.arr; + let arr = []; if(data != "") arr = data.split("_"); - let kb = gen_kb(bot,arr,event.master.lang); + let kb = gen_kb(bot,this.arr,arr,event.master.lang); return event.editMessageText("Select An Option", {"reply_markup":Markup.inlineKeyboard(kb),"parse_mode":"Markdown"}); }