telebot-basicecho/config.js
2019-09-25 16:46:02 +02:00

66 lines
1.2 KiB
JavaScript

const fs = require('fs');
const Markup = require('telegraf/markup');
const Extra = require('telegraf/extra');
//const db_js = require('./db.js');
//var db = new db_js("dbname");
//=== TOOL FUNCTIONS
function get_echo_obj(cmd,ans){
this.ans = ans;
this.cmd = cmd;
return {
trigger : this.cmd,
public : true,
desc : {
0:`Replies "+${ans}"`,
1:`Repond "${ans}"`,
2:`"${ans}" wo kotaete`,
3:`"${ans}" *insert arabic*`,
4:`Antwortet "${ans}"`,
},
requirements : (bot,event,message)=>{
return new Promise((resolve, reject)=>{
return resolve(200);
});
},
action : (bot,event,message)=>{
return event.reply(this.ans);
}
};
}
//=== MAIN MODULE CONFIG
module.exports = function(echo_list,regex_list){
let echoobj = {
name : "BasicEcho",
key : 'bsce',
version : 0.1,
requirements : {
gps: false,
},
text : [],
reply : [],
regex : [],
media : [],
callback : [],
inline : [],
new_member : (bot,event)=>{},
weburl : [],
cron : [],
};
for(var el of echo_list){
echoobj.text.push(new get_echo_obj(el.cmd,el.ans));
}
for(var el of regex_list){
echoobj.regex.push(new get_echo_obj(el.cmd,el.ans));
}
return echoobj;
}