def _find_applicable_plugins (self):

        '''
            Find Applicable plugins based on message type.

            --
            @return dict
        '''

        # Text types are special for the fact that they can have
        # command triggers too. We will only return a map
        # of those that have the command.
        #
        # We will have to clean up the text and remove any '/' or
        # '@' mentions so that the command may be triggered
        if self.message_type == 'text':

            text = self.response['text']

            # Remove a mention. This could be the case
            # if the bot was mentioned in a chat room
            if text.startswith('@'):
                text = text.split(' ', 1)[1].strip()

            # Some bots will accept commands that started
            # with a '/'
            if text.startswith('/'):
                # Remove the leading /
                text = text.replace('/', '', 1).strip()

                # If more than one bot is in a group chat, the
                # Telegram client with have commands autocomleted
                # as /action@bot_name. We will remove the mention
                # in order to extract the command
                text = text.split('@')[0].strip()

            # Return all of the plugins that have the command
            # defined as applicable, or any plugins that use
            # the wildcard command
            return [x for x in self.command_map['text'] \
                    if x['commands'] in text.split(' ')[0].lower() or '*' in x['commands']]

        return self.command_map[self.message_type]
dataset/ETHPy150Open leonjza/hogar/hogar/ResponseHandler.py/Response._find_applicable_plugins/swapped operands of `in`