I have code to control 2 motors with a wired joystick but I wanna use Bluetooth

I am new at Arduino but I'm trying to learn how to be better but I need help now.
I am making a little robot that moves around and could potential carry things. But for now the joystick that controls it has to be wired directly to the breadboard/Arduino that control the wires. I have a DSD TECH HM-10 Master and Slave Pin, so I'm thinking of using those to control my robot via Bluetooth, to make more comfortable and practical to use.
Here's the code I have for now, could someone tell me how to connect the joystick via Bluetooth (code for the Master Arduino and for the Slave one)?

#define enA 9
#define in1 4
#define in2 5
#define enB 10
#define in3 6
#define in4 7

//Define speed of motors
int motorSpeedA = 0;
int motorSpeedB = 0;


void setup() {

  pinMode(enA, OUTPUT);
  pinMode(enB, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);

}


void loop() {

  int xAxis = analogRead(A0); // Read Joysticks X-axis
  int yAxis = analogRead(A1); // Read Joysticks Y-axis


  // Y-axis used for forward and backward control
  if (yAxis < 470) {
    // Set Motor A backward
    digitalWrite(in1, HIGH);
    digitalWrite(in2, LOW);
    // Set Motor B backward
    digitalWrite(in3, HIGH);
    digitalWrite(in4, LOW);
    // Convert the declining Y-axis readings for going backward from 470 to 0 into 0 to 255 value for the PWM signal for increasing the motor speed
    motorSpeedA = map(yAxis, 470, 0, 0, 255);
    motorSpeedB = map(yAxis, 470, 0, 0, 255);


  }
  else if (yAxis > 550) {
    // Set Motor A forward
    digitalWrite(in1, LOW);
    digitalWrite(in2, HIGH);
    // Set Motor B forward
    digitalWrite(in3, LOW);
    digitalWrite(in4, HIGH);
    // Convert the increasing Y-axis readings for going forward from 550 to 1023 into 0 to 255 value for the PWM signal for increasing the motor speed
    motorSpeedA = map(yAxis, 550, 1023, 0, 255);
    motorSpeedB = map(yAxis, 550, 1023, 0, 255);
  }
  // If joystick stays in middle the motors are not moving

  if (470 < xAxis && xAxis < 550 && 470 < yAxis && yAxis < 500) { 
    //if joystick is in the center motors stop turning
    digitalWrite(in1, LOW);
    digitalWrite(in2, LOW);
    digitalWrite(in3, LOW);
    digitalWrite(in4, LOW);
  }

  // X-axis used for left and right control
  if (xAxis < 470) {
    // Set Motor A backward
    digitalWrite(in1, HIGH);
    digitalWrite(in2, LOW);
        // Set Motor B forward
    digitalWrite(in3, LOW);
    digitalWrite(in4, HIGH);
    // Convert the increasing Y-axis readings for going forward from 550 to 1023 into 0 to 255 value for the PWM signal for increasing the motor speed
    motorSpeedA = map(xAxis, 550, 1023, 0, 255);
    motorSpeedB = map(xAxis, 550, 1023, 0, 255);

  }
  if (xAxis > 550) {

    // Set Motor A forward
    digitalWrite(in1, LOW);
    digitalWrite(in2, HIGH);
        // Set Motor B backward
    digitalWrite(in3, HIGH);
    digitalWrite(in4, LOW);
    // Convert the increasing Y-axis readings for going forward from 550 to 1023 into 0 to 255 value for the PWM signal for increasing the motor speed
    motorSpeedA = map(xAxis, 550, 1023, 0, 255);
    motorSpeedB = map(xAxis, 550, 1023, 0, 255);
    
  }
  // Prevent buzzing at low speeds (Adjust according to your motors. My motors couldn't start moving if PWM value was below value of 70)
  if (motorSpeedA < 70) {
    motorSpeedA = 0;
  }
  analogWrite(enA, motorSpeedA); // Send PWM signal to motor A
  analogWrite(enB, motorSpeedB); // Send PWM signal to motor B
}

Not sure to understand your objective : I guess your robot is arduino controlled, meaning that the Arduino is connected physically to and drive the motors. You want to control it remotely using a joystick, via bluetooth. OK.

Does your joystick nativelly support Bluetooth? If yes, all you have to do is find the commands that are sent via bluetooth when you act on the joystick (buttons and directions), and write the Arduino code that receive and process these commands.

But if your joystick doesn't suport bluetooth, do you want to connect it to another Arduino with another Bluetooth module to send the joystick's commands? If yes, you need another set "Arduino + BT module". But another solution is to use an appropriate app on your smartphone which would act as the joystick and send the commands to the robot's Arduino.

So what do you prefer?

I will be using to Arduino boards. One will be on the robot and the other will have the joystick. Both of them will have an HM-10 Bluetooth connected. What I want is to send info from one board to the other through the Bluetooth

Bluetooth is just "serial by wireless" so have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.

The technique in the 3rd example will be the most reliable. It is what I use for Arduino to Arduino and Arduino to PC communication.

You can send data in a compatible format with code like this (or the equivalent in any other programming language)

Serial.print('<'); // start marker
Serial.print(value1);
Serial.print(','); // comma separator
Serial.print(value2);
Serial.println('>'); // end marker

...R