added config
This commit is contained in:
		
							
								
								
									
										69
									
								
								config.js
									
									
									
									
									
								
							
							
						
						
									
										69
									
								
								config.js
									
									
									
									
									
								
							| @@ -0,0 +1,69 @@ | |||||||
|  | const fs = require('fs'); | ||||||
|  |  | ||||||
|  | const Markup = require('telegraf/markup'); | ||||||
|  | const Extra = require('telegraf/extra'); | ||||||
|  |  | ||||||
|  | const request = require('request'); | ||||||
|  |  | ||||||
|  | //=== TOOL FUNCTIONS | ||||||
|  |  | ||||||
|  | //=== MAIN MODULE CONFIG | ||||||
|  |  | ||||||
|  | module.exports = function(url, cmds){ | ||||||
|  | 	this.url = url; | ||||||
|  |  | ||||||
|  | 	return { | ||||||
|  | 		name : "APIreq", | ||||||
|  | 		version : 0.1, | ||||||
|  | 		requirements : { | ||||||
|  | 			gps: false, | ||||||
|  | 		}, | ||||||
|  | 		text : [ | ||||||
|  | 			{ | ||||||
|  | 				trigger : cmds, | ||||||
|  | 				requirements : (bot,event,message)=>{  | ||||||
|  | 					return new Promise((resolve, reject)=>{ | ||||||
|  | 						return resolve(200); | ||||||
|  | 					}); | ||||||
|  | 				}, | ||||||
|  | 				action : (bot,event,message)=>{ | ||||||
|  |  | ||||||
|  | 					let options = { | ||||||
|  | 			            url: this.url, | ||||||
|  | 			            form:message, | ||||||
|  | 			    	}; | ||||||
|  | 					return request.get(options, function (err, response, body) { | ||||||
|  | 		                if (err)  | ||||||
|  | 		                	return bot.error(err); | ||||||
|  |  | ||||||
|  | 		                if (response.statusCode != 200 ) | ||||||
|  | 							return bot.error(response.statusCode); | ||||||
|  | 						 | ||||||
|  | 						return event.reply(body.reply); | ||||||
|  | 			    		   		 | ||||||
|  | 				    }); | ||||||
|  | 				} | ||||||
|  | 			}, | ||||||
|  | 		], | ||||||
|  | 		reply : [], | ||||||
|  | 		regex : [], | ||||||
|  | 		media : [], | ||||||
|  | 		callback : [], | ||||||
|  | 		inline : [], | ||||||
|  | 		new_member : (bot,event)=>{}, | ||||||
|  | 		weburl : [{ | ||||||
|  | 			url : 'self', | ||||||
|  | 			post_action : (bot,req,rep)=>{ | ||||||
|  | 				rep.send({msg:req.from.id}); | ||||||
|  | 			}, | ||||||
|  | 			get_action : (bot,req,rep)=>{ | ||||||
|  | 				rep.send({msg:req.from.id}); | ||||||
|  | 			}, | ||||||
|  |  | ||||||
|  | 		}], | ||||||
|  | 		cron : [] | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	 | ||||||
|  | 	 | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user