
from twisted.plugin import IPlugin
from desertbot.moduleinterface import IModule, BotModule
from zope.interface import implementer


@implementer(IPlugin, IModule)
class CommandHandler(BotModule):
    def actions(self):
        return super(CommandHandler, self).actions() + [('message-channel', 1, self.handleCommand),
                                                        ('message-user', 1, self.handleCommand)]

    def handleCommand(self, message):
        if message.command:
            return self.bot.moduleHandler.runGatheringAction('botmessage', message)


commandhandler = CommandHandler()


from twisted.plugin import IPlugin
from desertbot.moduleinterface import IModule, BotModule
from zope.interface import implementer


@implementer(IPlugin, IModule)
class CommandHandler(BotModule):
    def __init__(self):
        BotModule.__init__(self)
        self.loadingPriority = 10

    def actions(self):
        return super(CommandHandler, self).actions() + [('message-channel', 1, self.handleCommand),
                                                        ('message-user', 1, self.handleCommand)]

    def handleCommand(self, message):
        if message.command:
            return self.bot.moduleHandler.runGatheringAction('botmessage', message)


commandhandler = CommandHandler()

Load the command handler before the commands
Load the command handler before the commands

  
  from twisted.plugin import IPlugin
  from desertbot.moduleinterface import IModule, BotModule
  from zope.interface import implementer
  
  
  @implementer(IPlugin, IModule)
  class CommandHandler(BotModule):
+     def __init__(self):
+         BotModule.__init__(self)
+         self.loadingPriority = 10
+ 
      def actions(self):
          return super(CommandHandler, self).actions() + [('message-channel', 1, self.handleCommand),
                                                          ('message-user', 1, self.handleCommand)]
  
      def handleCommand(self, message):
          if message.command:
              return self.bot.moduleHandler.runGatheringAction('botmessage', message)
  
  
  commandhandler = CommandHandler()
  
Load the command handler before the commands
## Code Before:

from twisted.plugin import IPlugin
from desertbot.moduleinterface import IModule, BotModule
from zope.interface import implementer


@implementer(IPlugin, IModule)
class CommandHandler(BotModule):
    def actions(self):
        return super(CommandHandler, self).actions() + [('message-channel', 1, self.handleCommand),
                                                        ('message-user', 1, self.handleCommand)]

    def handleCommand(self, message):
        if message.command:
            return self.bot.moduleHandler.runGatheringAction('botmessage', message)


commandhandler = CommandHandler()

## Instruction:
Load the command handler before the commands
## Code After:

from twisted.plugin import IPlugin
from desertbot.moduleinterface import IModule, BotModule
from zope.interface import implementer


@implementer(IPlugin, IModule)
class CommandHandler(BotModule):
    def __init__(self):
        BotModule.__init__(self)
        self.loadingPriority = 10

    def actions(self):
        return super(CommandHandler, self).actions() + [('message-channel', 1, self.handleCommand),
                                                        ('message-user', 1, self.handleCommand)]

    def handleCommand(self, message):
        if message.command:
            return self.bot.moduleHandler.runGatheringAction('botmessage', message)


commandhandler = CommandHandler()
