const fs = require('fs'); const Markup = require('telegraf/markup'); const Extra = require('telegraf/extra'); const dic = require('./wiktionary.js'); //=== MAIN MODULE CONFIG module.exports = function(){ return { name : "Wiktionary", key : "wikt", version : 0.1, requirements : { gps: false, }, text : [ { trigger : ["/define"], public : true, desc : {0:"Search meaning", 1:"Search signification", }, requirements : (bot,event,message)=>{ return new Promise((resolve, reject)=>{ return resolve(200); }); }, action : (bot,event,message)=>{ return dic(message.text_arg).then(res=>{ let txt = `*Definitions of ${message.text_arg}:\n`; for(let r of res.definitions){ for(let l of r.lines){ txt+= `_${l.define}_\n`; } txt += `\n`; } return event.replyWithMarkdown(txt); }).catch(err=>{ bot.error(err); return event.reply("No word in dictionary"); }) } }, ], reply : [], regex : [], media : [], callback : [], inline : [], new_member : (bot,event)=>{}, weburl : [], cron : [] } }