Ejemplo n.º 1
0
def run_bot( config_path ):
    conf = config.Config( config_path )
    bot = telebot.TeleBot( API_TOKEN )
    plugins.tracking.setting( bot, conf )
    plugins.load_user_plugins( bot )

    bot.polling( none_stop = True )
    conf.flush()
Ejemplo n.º 2
0
def run_bot(config_path):
    conf = config.Config(config_path)
    bot = telebot.TeleBot(API_TOKEN)
    plugins.tracking.setting(bot, conf)
    plugins.load_user_plugins(bot)

    bot.polling(none_stop=True)
    conf.flush()
Ejemplo n.º 3
0
    def _on_connect(self):
        """handle connection/reconnection"""

        logger.debug("connected")

        plugins.tracking.set_bot(self)
        command.set_tracking(plugins.tracking)
        command.set_bot(self)

        self.tags = tagging.tags(self)
        self._handlers = handlers.EventHandler(self)
        handlers.handler.set_bot(self) # shim for handler decorator

        """
        monkeypatch plugins go heere
        # plugins.load(self, "monkeypatch.something")
        use only in extreme circumstances e.g. adding new functionality into hangups library
        """

        #self._user_list = yield from hangups.user.build_user_list(self._client)

        self._user_list, self._conv_list = (
            yield from hangups.build_user_conversation_list(self._client)
        )

        self.conversations = yield from permamem.initialise_permanent_memory(self)

        plugins.load(self, "commands.plugincontrol")
        plugins.load(self, "commands.basic")
        plugins.load(self, "commands.tagging")
        plugins.load(self, "commands.permamem")
        plugins.load(self, "commands.convid")
        plugins.load(self, "commands.loggertochat")
        plugins.load_user_plugins(self)

        self._conv_list.on_event.add_observer(self._on_event)
        self._client.on_state_update.add_observer(self._on_status_changes)

        logger.info("bot initialised")
Ejemplo n.º 4
0
    def _on_connect(self, initial_data):
        """handle connection/reconnection"""

        logger.debug("connected")

        plugins.tracking.set_bot(self)
        command.set_tracking(plugins.tracking)
        command.set_bot(self)

        self.tags = tagging.tags(self)
        self._handlers = handlers.EventHandler(self)
        handlers.handler.set_bot(self)  # shim for handler decorator

        plugins.load(self, "monkeypatch.otr_support")

        self._user_list = yield from hangups.user.build_user_list(self._client,
                                                                  initial_data)

        self._conv_list = hangups.ConversationList(self._client,
                                                   initial_data.conversation_states,
                                                   self._user_list,
                                                   initial_data.sync_timestamp)

        self.conversations = yield from permamem.initialise_permanent_memory(self)

        plugins.load(self, "commands.plugincontrol")
        plugins.load(self, "commands.basic")
        plugins.load(self, "commands.tagging")
        plugins.load(self, "commands.permamem")
        plugins.load(self, "commands.convid")
        plugins.load(self, "commands.loggertochat")
        plugins.load_user_plugins(self)

        self._conv_list.on_event.add_observer(self._on_event)
        self._client.on_state_update.add_observer(self._on_status_changes)

        logger.info("bot initialised")
        yield from self.coro_send_message(CONTROL, _("Bot is back up"))
    def _on_connect(self):
        """handle connection/reconnection"""

        logger.debug("connected")

        plugins.tracking.set_bot(self)
        command.set_tracking(plugins.tracking)
        command.set_bot(self)

        self.tags = tagging.tags(self)
        self._handlers = handlers.EventHandler(self)
        handlers.handler.set_bot(self)  # shim for handler decorator
        """
        monkeypatch plugins go heere
        # plugins.load(self, "monkeypatch.something")
        use only in extreme circumstances e.g. adding new functionality into hangups library
        """

        #self._user_list = yield from hangups.user.build_user_list(self._client)

        self._user_list, self._conv_list = (
            yield from hangups.build_user_conversation_list(self._client))

        self.conversations = yield from permamem.initialise_permanent_memory(
            self)

        plugins.load(self, "commands.plugincontrol")
        plugins.load(self, "commands.basic")
        plugins.load(self, "commands.tagging")
        plugins.load(self, "commands.permamem")
        plugins.load(self, "commands.convid")
        plugins.load(self, "commands.loggertochat")
        plugins.load_user_plugins(self)

        self._conv_list.on_event.add_observer(self._on_event)
        self._client.on_state_update.add_observer(self._on_status_changes)

        logger.info("bot initialised")
Ejemplo n.º 6
0
    def _on_connect(self, initial_data):
        """handle connection/reconnection"""

        logger.debug("connected")

        plugins.tracking.set_bot(self)
        command.set_tracking(plugins.tracking)
        command.set_bot(self)

        self.tags = tagging.tags(self)
        self._handlers = handlers.EventHandler(self)
        handlers.handler.set_bot(self)  # shim for handler decorator

        plugins.load(self, "monkeypatch.otr_support")

        self._user_list = yield from hangups.user.build_user_list(
            self._client, initial_data)

        self._conv_list = hangups.ConversationList(
            self._client, initial_data.conversation_states, self._user_list,
            initial_data.sync_timestamp)

        self.conversations = yield from permamem.initialise_permanent_memory(
            self)

        plugins.load(self, "commands.plugincontrol")
        plugins.load(self, "commands.basic")
        plugins.load(self, "commands.tagging")
        plugins.load(self, "commands.permamem")
        plugins.load(self, "commands.convid")
        plugins.load(self, "commands.loggertochat")
        plugins.load_user_plugins(self)

        self._conv_list.on_event.add_observer(self._on_event)
        self._client.on_state_update.add_observer(self._on_status_changes)

        logger.info("bot initialised")