telebot-basicecho/config.js

71 lines
1.4 KiB
JavaScript
Raw Normal View History

2019-08-28 09:59:09 +09:00
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){
2019-08-28 10:24:08 +09:00
this.ans = ans;
this.cmd = cmd;
2019-08-28 09:59:09 +09:00
return {
2019-08-28 10:24:08 +09:00
trigger : this.cmd,
2019-09-25 09:00:58 +02:00
public : true,
desc : {0:`Replies "${ans}"`,
1:`Repond "${ans}"`,
2:`${ans} ga kotaete`,
3:`${ans} *insert arabic*`,
},
2019-08-28 09:59:09 +09:00
requirements : (bot,event,message)=>{
return new Promise((resolve, reject)=>{
2019-09-05 14:08:03 +09:00
return resolve(200);
2019-08-28 09:59:09 +09:00
});
},
action : (bot,event,message)=>{
2019-08-28 10:24:08 +09:00
return event.reply(this.ans);
2019-08-28 09:59:09 +09:00
}
};
}
//=== MAIN MODULE CONFIG
module.exports = function(echo_list,regex_list){
let echoobj = {
name : "BasicEcho",
2019-09-25 08:37:43 +02:00
key : 'bsce',
2019-08-28 09:59:09 +09:00
version : 0.1,
requirements : {
gps: false,
},
text : [],
reply : [],
regex : [],
media : [],
callback : [],
inline : [],
new_member : (bot,event)=>{
//return event.replyWithMarkdown("Welcome !");
},
weburl : [],
cron : [],
cron_register : function(cron_f,bot,c){
new cron_f(c.cstr, new c.action(bot), c.params[0], c.params[1], c.timezone);
},
};
for(var i in echo_list){
var element = echo_list[i];
2019-08-28 10:27:44 +09:00
echoobj.text.push(new get_echo_obj(element.cmd,element.ans));
2019-08-28 09:59:09 +09:00
}
for(var i in regex_list){
2019-08-28 10:24:08 +09:00
var element = regex_list[i];
2019-08-28 10:27:44 +09:00
echoobj.regex.push(new get_echo_obj(element.cmd,element.ans));
2019-08-28 09:59:09 +09:00
}
return echoobj;
}