Hi there, I believe I need some help around importing node_modules, and I thought maybe the community could help shed some light on what seems to be fairly puzzling.
I am attempting to build a discord bot and would like to use ReScript. However, In the first few moments of trying to use ReScript I found myself stumped when I tried to import a library from the node_modules folder. Please keep in mind that this question may seem ridiculous-but it probably has to do with the fact that I am new to JS and do not use React.
The library in question is called “discord.js”. Note that this contains a period in the name.
I looked at the documentation for Importing & Exporting, but it says that it doesn’t need import statements and that you simply would write something like Student.message
. That’s fine but discord.js as a name contains that period, which essentially led me down what felt like a pretty overwhelming rabbit hole, when all I wanted to type was const { Client, Collection, GatewayIntentBits} = require("discord.js")
Is there an easy way to do this? I currently have the following lines
@module("discord.js") external client: Js.Dict.t<string> = "Client"
@module("discord.js") external collection: Js.Dict.t<string> = "Collection"
@module("discord.js") external gatewayIntentBits: Js.Dict.t<string> = "GatewayIntentBits"
But I am pretty sure this isn’t what I want either. So is there any documentation that I should be looking at to help me use the modules from this library that I need?
I know I am way to far out of my depth now as the next two lines I would like to write are
let cur_client = client({ intents: gatewayIntentBits.Guilds });
cur_client.commands = new collection();
And I have no idea how