Including Discord.js for the web?

I don’t know if there is any way to use discord js for the web, like I want to run a express website and use discord.js in client side, if there is a way to do that helping would be amazing
15 Replies
d.js toolkit
d.js toolkit14mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Squid
Squid14mo ago
Do you even need a full Gateway client? It's probably best to just use API calls with the helpers from discord-api-types and the REST package
MaxJ
MaxJ14mo ago
I would say yes but if there is any other way of doing it it would be great to give me examples
Squid
Squid14mo ago
You only need the gateway to listen for events like interactionCreate and guildMemberUpdate. If you're just doing stuff like sending messages and editing guilds, the gateway is irrelevant
MaxJ
MaxJ14mo ago
Is there any way to do it with fetching? Cause I have been trying to get around it for a while and haven’t got the answer yet
Squid
Squid14mo ago
What is the "it" you're doing?
MaxJ
MaxJ14mo ago
I’m basically trying to get a button on my website to create channels (this is an example)
Squid
Squid14mo ago
That's just a simple API call, no gateway required, so no discord.js necessary
MaxJ
MaxJ14mo ago
Ah I got it, but any examples cause my brain isn’t good with api stuff
Squid
Squid14mo ago
If you remember from the DJS' guide command deployment script, you can use a combination of a REST instance and a route. Eg, rest.post(Routes.guildChannels(<guildId>), { body: {...} })
MaxJ
MaxJ14mo ago
I’ll try that to see what I get, I’ll ping you or I’ll send a message here if I get a error I wasn’t generally planning to do that, I was wondering if I can get the api to be included in the website as a script or smth I can’t find any way to do that I’ll try
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
MaxJ
MaxJ14mo ago
Thanks for suggestions I’ll try em out
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
MaxJ
MaxJ14mo ago
I’m gonna probs use svelte