telebot-basicecho/config.js

66 lines
1.2 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,
2019-09-25 11:58:57 +02:00
desc : {
0:`Replies "+${ans}"`,
1:`Repond "${ans}"`,
2019-09-25 16:46:02 +02:00
2:`"${ans}" wo kotaete`,
2019-09-25 12:38:10 +02:00
3:`"${ans}" *insert arabic*`,
4:`Antwortet "${ans}"`,
2019-09-25 11:40:50 +02:00
},
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 : [],
2019-09-25 16:07:42 +02:00
new_member : (bot,event)=>{},
2019-08-28 09:59:09 +09:00
weburl : [],
cron : [],
};
2019-09-25 16:07:42 +02:00
for(var el of echo_list){
echoobj.text.push(new get_echo_obj(el.cmd,el.ans));
2019-08-28 09:59:09 +09:00
}
2019-09-25 16:07:42 +02:00
for(var el of regex_list){
echoobj.regex.push(new get_echo_obj(el.cmd,el.ans));
2019-08-28 09:59:09 +09:00
}
return echoobj;
}