- An Interaction Discord Bot writing using HTTP API
- Although the bot is offlined, it still can be continue working properly.
- Only can use application commands, X no message content command
- There's no any status (
online
,offline
,idle
,dnd
,streaming
) to this type of bot.
git clone https://github.com/chingh1123/nodejs-http-interaction-bot/
-
The project needs a public endpoint where Discord can send requests. To develop and test locally, you can use something like ngrok to tunnel HTTP traffic.
-
Install ngrok if you haven't already (
npm i ngrok
), then start listening on port 3000:
ngrok http 3000
You should see your connection open:
Session Status online
Session Expires 1 hour, 59 minutes
Version 2.3.40
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://1234-someurl.ngrok.io -> http://localhost:3000
Forwarding https://1234-someurl.ngrok.io -> http://localhost:3000
Connections ttl opn rt1 rt5 p50 p90
0 0 0.00 0.00 0.00 0.00
Copy the forwarding address that starts with https, in this case https://1234-someurl.ngrok.io, then go to your app's settings and paste it to the Interactions Endpoint URL option.
- Type this in your terminal and enter it:
npm run register
and then you are all set!
- do
npm start
for start booting the server.
- Remember don't close the
ngrok http 3000
terminal &npm start
terminal, or else the commands in the bot will not be working