-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplugin_loader.py
More file actions
25 lines (23 loc) · 906 Bytes
/
plugin_loader.py
File metadata and controls
25 lines (23 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
__author__ = 'Aleksi'
import threading, default_Plugins, additional_Plugins #rename additional_Plugins and add loading of custom plugins there.
class Plugin_loader:
def __init__(self, bot):
self.teeBot = bot
self.plugins = []
self.initialize()
def register(self, plugin):
self.plugins.append(plugin)
pass
def event_handler(self, event):
thread_list = []
for x in self.plugins:
if event["event_type"] in x.handle_events or "*" in x.handle_events:
t = threading.Thread(target=x.handle, args=(event, self.teeBot, self.plugins))
thread_list.append(t)
t.start()
for x in thread_list:
#x.start
x.join()
def initialize(self):
default = default_Plugins.default_Plugins(self)
additional = additional_Plugins.additional_Plugins(self)