Example #1
0
class Bot(object):
    def __init__(self):
        if settings.MATTERMOST_API_VERSION == 4:
            self._client = MattermostClientv4(settings.BOT_URL,
                                              settings.BOT_TEAM,
                                              settings.BOT_LOGIN,
                                              settings.BOT_PASSWORD,
                                              settings.SSL_VERIFY)
        else:
            self._client = MattermostClient(settings.BOT_URL,
                                            settings.BOT_TEAM,
                                            settings.BOT_LOGIN,
                                            settings.BOT_PASSWORD,
                                            settings.SSL_VERIFY)
        logger.info('connected to mattermost')
        self._plugins = PluginsManager()
        self._dispatcher = MessageDispatcher(self._client, self._plugins)

    def run(self):
        self._plugins.init_plugins()
        self._dispatcher.start()
        _thread.start_new_thread(self._keep_active, tuple())
        self._dispatcher.loop()

    def _keep_active(self):
        logger.info('keep active thread started')
        while True:
            time.sleep(60)
            self._client.ping()
Example #2
0
 def __init__(self):
     self._client = MattermostClient(local_settings.BOT_URL,
                                     local_settings.BOT_TEAM,
                                     local_settings.BOT_LOGIN,
                                     local_settings.BOT_PASSWORD,
                                     local_settings.SSL_VERIFY)
     self._plugins = PluginsManager(local_settings.PLUGINS)
     self._dispatcher = MessageDispatcher(self._client, self._plugins)
Example #3
0
 def __init__(self):
     self._client = MattermostClient(settings.BOT_URL, settings.BOT_TEAM,
                                     settings.BOT_LOGIN,
                                     settings.BOT_PASSWORD,
                                     settings.SSL_VERIFY)
     logger.info('connected to mattermost')
     self._plugins = PluginsManager()
     self._dispatcher = MessageDispatcher(self._client, self._plugins)
Example #4
0
class MMBot(Bot):
    def __init__(self):
        self._client = MattermostClient(local_settings.BOT_URL,
                                        local_settings.BOT_TEAM,
                                        local_settings.BOT_LOGIN,
                                        local_settings.BOT_PASSWORD,
                                        local_settings.SSL_VERIFY)
        self._plugins = PluginsManager(local_settings.PLUGINS)
        self._dispatcher = MessageDispatcher(self._client, self._plugins)

    def _keep_active(self):
        while True:
            time.sleep(60)
            self._client.ping()
            self._client.online()
Example #5
0
 def __init__(self):
     self._client = MattermostClient(
         settings.BOT_URL, settings.BOT_TEAM,
         settings.BOT_LOGIN, settings.BOT_PASSWORD,
     )
     logger.info('connected to mattermost')
     self._plugins = PluginsManager()
     self._dispatcher = MessageDispatcher(self._client, self._plugins)
Example #6
0
 def __init__(self):
     self._client = MattermostClient(driver_settings.BOT_URL,
                                     driver_settings.BOT_TEAM,
                                     driver_settings.BOT_LOGIN,
                                     driver_settings.BOT_PASSWORD,
                                     driver_settings.SSL_VERIFY)
     self._plugins = PluginsManager()
     self._plugins.init_plugins()
     self._dispatcher = MessageDispatcher(self._client, self._plugins)
Example #7
0
class Bot(object):
    def __init__(self):
        self._client = MattermostClient(
            settings.BOT_URL, settings.BOT_TEAM,
            settings.BOT_LOGIN, settings.BOT_PASSWORD,
        )
        logger.info('connected to mattermost')
        self._plugins = PluginsManager()
        self._dispatcher = MessageDispatcher(self._client, self._plugins)

    def run(self):
        self._plugins.init_plugins()
        self._dispatcher.start()
        _thread.start_new_thread(self._keep_active, tuple())
        self._dispatcher.loop()

    def _keep_active(self):
        logger.info('keep active thread started')
        while True:
            time.sleep(60)
            self._client.ping()