How to send message to specific discord' ...

How to send message to specific discord's channel from your server application?

Jan 15, 2022

Had you wondered how to send the log/messages from the server application to the discord channel? In my personal project I use NodeJs for the server-side, each of the important details from the server will be sent to my discord's channel. For instance, each time my user made a payment or register for my app. I am about to demonstrate how exactly I did it.

I use the ES6 discipline for my application.

Packages I will be using are axios, and nodemon.

1. Initiate a project by npm init -y.

2. get the webhook URL by going to your channel's settings integration create a webhook.

3. start coding.

In this case, I will use the method of the HTTP POST request to the webhook. As in bash you can simply do:

зображення

Can be also coded in javascript
зображення

and it should work but calling the function log('something something');

or You can use my package here https://www.npmjs.com/package/discord-logger-js

For more, watch my video on youtube :

Подобається цей допис?

Купити для 钟智强 strawberry

Більше від 钟智强