2
0
telebot-wiktionary/config.js
2019-10-15 20:46:01 +02:00

58 lines
1.1 KiB
JavaScript

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 wiki(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=>{
return event.reply("No word in dictionary");
})
}
},
],
reply : [],
regex : [],
media : [],
callback : [],
inline : [],
new_member : (bot,event)=>{},
weburl : [],
cron : []
}
}