Can I use Node.JS with this?

I'm trying to code a bot for Twitch. The intention is to interpret chat messages and use that to rebind controller inputs on a virtual gamepad. For example, 'swap "X" and "Y"'.

Twitch provide a node.js compatible API for their Twitch chat, so that's what the bot is currently written in. I've also found a few node modules that will read controller inputs (and an obsolete one that can create virtual controllers).

I'm an inexperienced hobby developer with no experience with drivers. For example I don't yet know what words like "bus" mean. I see there are a lot of different of different github projects for ViGEm and I'm finding the language used to describe them somewhat indecipherable.

Could someone give me a few nudges in the right direction here please? Is there a way I can code something in Node that will cause ViGEm to press buttons on a virtual controller?


I'm aware of this community library that might offer what you need, I can't tell you though if it's still maintained, how it works etc. since I myself don't do stuff with node.

Basically a quick summary how ViGEm works: you have a driver that emulates ("mimics") a well-known game controller (which see READMEs), the drivers inner workings aren't really necessary for you to grasp when you simply wanna use it. There's a developer SDK called the ViGEm client libraries (like the one I linked) you can use to interact with the driver and tell it what to do. You use the SDK to "feed" the virtual controller devices input state changes so they can behave like the real thing, just that the inputs can come from anything, not just a hardware device.

Hope that helps, cheers!

Thanks a lot!

I've got something workable now using the node.js library you linked. Your post was very helpful, as is your driver.

If any Googler is interested in what I'm going to be using to meet might needs, I'm using these modules:

tmi.js to read Twitch chat and detect which messages are channel reward redemptions
gamecontroller - this reads HID which is a bad way to do this in the long term because pressing LT and RT at the same time results in it thinking neither is being pressed. I couldn't find an xinput library that would build in Node 12. I'll migrate if I ever need LT/RT. I had to manually modify the vendor information to support xbox-like controllers.
node-ViGEmClient as linked by nefarius in his post.