detect gamepad

Hey ! I want to detect if a gamepad is connected to the computer to make different message on the tutorial of my game, if a gamepad is connected a message will tell you "press A to interact" but if there is not gamepad connected, a message will tell you "press ENTER to interact" but I don't know how to do so if someone know, please tell me.
You can try this external plugin.

https://developer.mozilla.org/en-US/docs/Web/API/Gamepad
It doesn't works 🙁
Someone else have an idea ?
Grab Yanfly's Gamepad plugin and add it to your project.

Now open up a conditional branch and under script paste the following:

Input.isControllerConnected() == true

Check else branch as well and under the met condition path you add your show text saying "Press A" and under your else branch you add your show text saying "Press Enter".

Things to keep in mind:

-MV won't automatically detect that the controller is detected simply from just being plugged in. You need to press a button such as A while the game is running. Moving the joystick does not count as a button press.

-I would be wary of text that just says "Press A" as some controllers such as PlayStation use X for its A button and other controllers may possibly have mapped another button to what you are thinking is A, and its A button is mapped to something else. Gamepads under ANY engine are a pain in the bum to deal with.

-Yanfly's plugin also adds an option in the game's option menu for the player to configure the gamepad buttons as they desire. You should encourage your players to adjust as they see fit.
Thank you very much, now it works !

Original thread: https://forums.rpgmakerweb.com/threads/detect-gamepad.87084/