2
0
This commit is contained in:
Cedric Hoelzl 2019-10-21 14:44:36 +02:00
parent bcb5a955ad
commit 475a790b51

View File

@ -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"});
}