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