telebot-template/config.js

129 lines
2.8 KiB
JavaScript
Raw Permalink Normal View History

2019-09-25 17:21:24 +02:00
const fs = require('fs');
const Markup = require('telegraf/markup');
const Extra = require('telegraf/extra');
const example_lang = require('./lang.js');
//=== TOOL FUNCTIONS
/* Here you usualy write util functions that are used multiple times in the code (or a second file is recommended)*/
//=== MAIN MODULE CONFIG
module.exports = function(){
2019-10-21 09:53:25 +02:00
this.key = "tmpl";
2019-09-25 17:21:24 +02:00
return {
name : "Template", //Unique Module name
2019-10-21 09:53:25 +02:00
key : this.key, //Unique Key for this module, if multiple instances add a number/text to it
2019-09-25 17:21:24 +02:00
version : 0.1, //Version Number, Currently unused
requirements : {
gps: false, //Currently un-used (all module have access to GPS)
},
text : [
{
trigger : ["/ping"], //Array of Triggers
public : true, //Should it be shown to user (user can still run the command without knowing it exists)
desc : {0:"Pings the user",
1:"Envois un ping à l'utilisateur",
2:"Yu-za- de pingu wo tsukawashite",
3:"*insert arabic*",
},
requirements : (bot,event,message)=>{
return new Promise((resolve, reject)=>{
if (false)
return reject(400);
return resolve(200);
});
},
action : (bot,event,message)=>{
return event.reply("pong");
}
},
],
reply : [
{
requirements : (bot,event,message)=>{
return new Promise((resolve,reject)=>{
if(!message.text || message.reply_to_message.text != "Beep")
return reject(400);
return resolve(200);
});
},
action : (bot,event,message)=>{
return event.reply(bot.gls(example_lang,"boop",event.master.lang));
//The GLS functions returns automaticly the right message given the "key" and lang...
}
}
],
regex : [
],
media : [
],
callback : [
{
2019-10-21 09:53:25 +02:00
trigger : 'template',
requirements : (bot,event,data)=>{
2019-09-25 17:21:24 +02:00
return new Promise((resolve, reject)=>{
return resolve(200);
});
},
action : (bot,event,data)=>{
return event.reply("Beep");
}
},
],
inline : [
{
public : true,
desc : {
0:"English",
1:"French",
2:"Japanese",
3:"Arabic",
4:"German",
},
reply : (bot,event,data)=>{
return {
type: 'article',
id: 'aid',
title: 'BEEP Template',
description: "Template Module",
message_text: "BEEP BOP",
parse_mode:"Markdown",
reply_markup:Markup.inlineKeyboard([]),
};
}
}
],
new_member : (bot,event)=>{
//return event.replyWithMarkdown("Welcome !");
},
weburl : [
{
url : '_',
post_action : (bot,req,rep)=>{
},
get_action : (bot,req,rep)=>{
},
}
],
cron : [
{
cstr : '0 0 * * * *',
params : [ null, true],
timezone : 'Europe/Zurich',
2019-11-18 13:39:59 +01:00
action : (bot)=> {
this.bot = bot;
return ()=>{
return this.bot.telegram.sendMessage("0","Beep",{"parse_mode":"Markdown"});
}
2019-09-25 17:21:24 +02:00
}
}
]
}
}