load_plugins ouside
This commit is contained in:
		
							
								
								
									
										22
									
								
								bot/bot.lua
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								bot/bot.lua
									
									
									
									
									
								
							@@ -165,22 +165,11 @@ end
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
function on_binlog_replay_end ()
 | 
					function on_binlog_replay_end ()
 | 
				
			||||||
  started = 1
 | 
					  started = 1
 | 
				
			||||||
  load_plugins()
 | 
					 | 
				
			||||||
  -- Uncomment the line to enable cron plugins.
 | 
					  -- Uncomment the line to enable cron plugins.
 | 
				
			||||||
  -- postpone (cron_plugins, false, 1.0)
 | 
					  -- postpone (cron_plugins, false, 1.0)
 | 
				
			||||||
  -- See plugins/ping.lua as an example for cron
 | 
					  -- See plugins/ping.lua as an example for cron
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Start and load values
 | 
					 | 
				
			||||||
our_id = 0
 | 
					 | 
				
			||||||
now = os.time()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
config = load_config()
 | 
					 | 
				
			||||||
_users = load_user_stats()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- load plugins
 | 
					 | 
				
			||||||
plugins = {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- load all plugins in the plugins/ directory
 | 
					-- load all plugins in the plugins/ directory
 | 
				
			||||||
function load_plugins()
 | 
					function load_plugins()
 | 
				
			||||||
  for k, v in pairs(scandir("plugins")) do
 | 
					  for k, v in pairs(scandir("plugins")) do
 | 
				
			||||||
@@ -206,3 +195,14 @@ function cron_plugins()
 | 
				
			|||||||
  -- Called again in 5 mins
 | 
					  -- Called again in 5 mins
 | 
				
			||||||
  postpone (cron_plugins, false, 5*60.0)
 | 
					  postpone (cron_plugins, false, 5*60.0)
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- Start and load values
 | 
				
			||||||
 | 
					our_id = 0
 | 
				
			||||||
 | 
					now = os.time()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					config = load_config()
 | 
				
			||||||
 | 
					_users = load_user_stats()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- load plugins
 | 
				
			||||||
 | 
					plugins = {}
 | 
				
			||||||
 | 
					load_plugins()
 | 
				
			||||||
		Reference in New Issue
	
	Block a user