2
0
This commit is contained in:
sora 2019-10-23 11:23:30 +02:00
parent ce40596ecc
commit 2d46490da5

View File

@ -28,26 +28,29 @@ module.exports = function(){
}); });
}, },
action : (bot,event,message)=>{ action : (bot,event,message)=>{
if(message.text_args){
return dic(message.text_arg).then(res=>{ return dic(message.text_arg).then(res=>{
let txt = `*Definitions of ${res.word}:*\n\n`; let txt = `*Definitions of ${res.word}:*\n\n`;
if(res.definitions.length ==0){ if(res.definitions.length ==0){
txt+= "_No definition found_"; txt+= "_No definition found_";
}else{ }else{
for(let r of res.definitions){ for(let r of res.definitions){
let t = r.speech!=''?r.speech:"Other" let t = r.speech!=''?r.speech:"Other"
txt+= `*${t}:*\n`; txt+= `*${t}:*\n`;
for(let l of r.lines){ for(let l of r.lines){
txt+= `${l.define}\n\n`; txt+= `${l.define}\n\n`;
}
txt += `\n`;
} }
txt += `\n`;
} }
} return event.replyWithMarkdown(txt);
return event.replyWithMarkdown(txt); }).catch(err=>{
}).catch(err=>{ //bot.error(err);
//bot.error(err); return event.reply("No word in dictionary");
return event.reply("No word in dictionary"); })
}) }else{
return event.reply("No word give");
}
} }
}, },
], ],