test
This commit is contained in:
		
							
								
								
									
										23
									
								
								src/trigger/bot.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								src/trigger/bot.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					const util = require('util');
 | 
				
			||||||
 | 
					const vm = require('vm');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module.exports = (lib) => {
 | 
				
			||||||
 | 
					  const sandbox = {
 | 
				
			||||||
 | 
					    bot: lib.bot
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  lib.trigger.add({
 | 
				
			||||||
 | 
					    name: 'bot debug',
 | 
				
			||||||
 | 
					    call: /^!bot (.*)/i,
 | 
				
			||||||
 | 
					    level: 100,
 | 
				
			||||||
 | 
					    active: 1,
 | 
				
			||||||
 | 
					    func: (e) => {
 | 
				
			||||||
 | 
					      var args = e.message.trim().match(/^!bot (.*?)/i)[1];
 | 
				
			||||||
 | 
					      const script = new vm.Script(args);
 | 
				
			||||||
 | 
					      const context = new vm.createContext(sandbox);
 | 
				
			||||||
 | 
					      script.runInContext(context);
 | 
				
			||||||
 | 
					      e.reply(util.inspect(sandbox));
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    desc: 'bot debug'
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
		Reference in New Issue
	
	Block a user