Skip to content
This repository was archived by the owner on Aug 15, 2022. It is now read-only.

Commit bfe7df4

Browse files
committed
fixed regression, now self.debug exists in Plugin class context
1 parent 08f9fea commit bfe7df4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

rtmbot/core.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ def load_plugins(self):
110110
# try:
111111
if name in self.config:
112112
logging.info("config found for: " + name)
113-
plugin_config = self.config.get(name)
113+
plugin_config = self.config.get(name, {})
114+
plugin_config['DEBUG'] = self.debug
114115
self.bot_plugins.append(Plugin(name, plugin_config))
115116
# except:
116117
# print "error loading plugin %s" % name
@@ -121,6 +122,7 @@ def __init__(self, name, plugin_config={}):
121122
self.jobs = []
122123
self.module = __import__(name)
123124
self.module.config = plugin_config
125+
self.debug = self.module.config.get('DEBUG')
124126
self.register_jobs()
125127
self.outputs = []
126128
if 'setup' in dir(self.module):
@@ -138,7 +140,7 @@ def register_jobs(self):
138140
def do(self, function_name, data):
139141
if function_name in dir(self.module):
140142
#this makes the plugin fail with stack trace in debug mode
141-
if not debug:
143+
if not self.debug:
142144
try:
143145
eval("self.module."+function_name)(data)
144146
except:

0 commit comments

Comments
 (0)