Possibility of creating an HTTP Interactions Bot with Discord.js #7690
Closed
ySnoopyDogy
started this conversation in
Ideas
Replies: 1 comment 4 replies
-
The discord.js client is built to be a gateway client. Everything you've said about http interactions is correct, but the client would be a massive overhead in that scenario. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
HTTP Interactions became very handy in terms of connection stability and even the Bot Scalability. Serving an HTTP server is much lighter than a Bot User in terms of processing and memory usage.
It will be very usefull if we could use the Discord.js Client to manage our HTTP Interactions. A way of using the same code of a gateway bot for events, and an HTTP server for interactions is like this:
In this example we can use an HTTP server and a Gateway at the same time. I guess this is good, because Websocket disconnections may close commands in the middle of usage (if you give a certain amount of seconds for a user to respond to an interaction). And it is good for updating commands, as a fully reconnect of a gateway bot can last more than 15 minutes.
Looking by the other side, users may want to use Discord.js Library for only an HTTP bot, in this way, we could instanciate the Discord.js client for managing the interactions webhook response without have to change anything in the code itself.
Interactions send permissions and stuff, so we don't need to cache anything, in this case, we could just turn on our http server (which whould need to access client.actions that its private now) and send the interactions to the client. Without using client.login().
As webhook only uses the bot token, so we can make something like client.setToken('token'), and things like interaction.reply() whould just send a http request, without having to connect to the gateway.
I don't know if this is possible today, and if is, i would like to know, beacuse i want to make my bot only with http interactions and a little bit of gateway for some events.
Beta Was this translation helpful? Give feedback.
All reactions