How does the bot launch process work? That is, how can my computer accept requests from the discord server? Is it possible to make a discord bot in the form of a web application for example on "Express"? I know that the question is slightly off topic discord.js, but I would like to know about the internal structure of the library.
#How bot run works?
21 messages · Page 1 of 1 (latest)
• 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.
You need a gateway connection over a websocket to be open to receive events from discord. If you just want an interaction-only bot you can have it run as a web application, but if you want a bot user (which discord.js always has) to get other events you need a permanent connection
What do you mean: "interaction only bot"?
Like @sick heath
Oh, how I run it like web application?
It only replies to / or context menu commands as well as buttons/modals. But doesn’t use other events, isn’t logged in to the gateway
By using a different framework than discord.js. discord-interactions is one for example
But I also can implement send messages, read chat history, create roles etc, but only use API directly
?
Yes, you just can’t do it by reacting to any other events than interactionCreate
Have you written anything on this before? I don't understand how discord resend request to my computer. Do I need to establish a websocket connection with the Discord gateway?
Like on this module
Discord-interactions
Like, how this will look if I use Express for example?
I would be very grateful to you
No, that’s the idea. You don’t need a gateway connection, you only need to have a HTTP endpoint that discord can send the interactions to, set that endpoint in developer portal
This?
Yes
Wow that's very cool. Discord bot without infinity loop 😎
**Guild: **