Reformat and fix circular import
This commit is contained in:
7
utils/deliver_relay_commands.py
Normal file
7
utils/deliver_relay_commands.py
Normal file
@@ -0,0 +1,7 @@
|
||||
def deliverRelayCommands(num, relayCommands, user=None, stage2=None):
|
||||
keyFN = main.certPath + main.config["Key"]
|
||||
certFN = main.certPath + main.config["Certificate"]
|
||||
contextFactory = DefaultOpenSSLContextFactory(keyFN.encode("utf-8", "replace"), certFN.encode("utf-8", "replace"))
|
||||
bot = IRCBotFactory(net=None, num=num, relayCommands=relayCommands, user=user, stage2=stage2)
|
||||
host, port = getRelay(num)
|
||||
rct = reactor.connectSSL(host, port, bot, contextFactory)
|
||||
@@ -12,16 +12,16 @@ def loadCommands(allowDup=False):
|
||||
if filename.endswith(".py") and filename != "__init__.py":
|
||||
commandName = filename[0:-3]
|
||||
className = commandName.capitalize() + "Command"
|
||||
try:
|
||||
module = __import__("commands.%s" % commandName)
|
||||
if not commandName in CommandMap:
|
||||
# try:
|
||||
module = __import__("commands.%s" % commandName)
|
||||
if not commandName in CommandMap:
|
||||
CommandMap[commandName] = getattr(getattr(module, commandName), className)
|
||||
debug("Registered command: %s" % commandName)
|
||||
else:
|
||||
if allowDup:
|
||||
CommandMap[commandName] = getattr(getattr(module, commandName), className)
|
||||
debug("Registered command: %s" % commandName)
|
||||
else:
|
||||
if allowDup:
|
||||
CommandMap[commandName] = getattr(getattr(module, commandName), className)
|
||||
debug("Registered command: %s" % commandName)
|
||||
|
||||
error("Duplicate command: %s" % (commandName))
|
||||
except Exception as err:
|
||||
error("Exception while loading command %s:\n%s" % (commandName, err))
|
||||
error("Duplicate command: %s" % (commandName))
|
||||
# except Exception as err:
|
||||
# error("Exception while loading command %s:\n%s" % (commandName, err))
|
||||
|
||||
Reference in New Issue
Block a user