How to send a Discord message to a discord channel using JS & Chrome Console without using Discord API?
It seems that it is impossible...
Under Method, select POST. Under Body Type, select Raw. Under Content Type, select JSON (application/json) Finally, under Request Content, type in the message to be sent to the channel as a JSON payload as per Discord's API.
discord.js is a powerful Node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
Open discord console : ctrl + shift + i (doesn't work? see edit below)
Then go into the network tab.
Now we need to sniff a message, so type a message in discord and send it.
Then in the console network tab right click the request named "messages", and pick "Copy as fetch".
Then go to the "Console" tab. Paste the request.
Edit this request to remove the "noonce" field.
And also there, edit the "content" field with your message.
When you press enter it should send it.
EDIT
As of today, discord team disabled the console by default.
There are 2 options to use it :
I know this is an old question, but I think I found the answer you were looking for. Many of the headers that you may have thought to use are unnecessary for this to work.
The headers that matter for most everything:
authorization: TOKEN
accept: "/"
authority: discordapp.com
When sending a message, you must also specify the content-type:
content-type: application/json
Therefore, you can easily construct a JavaScript POST request to send a discord message to a channel using the following code or similar:
messsage = "Hi!";
token = "TOKEN";
channel_id = "CHANNEL ID";
channel_url = `https://discordapp.com/api/v6/channels/${channel_id}/messages`
request = new XMLHttpRequest();
request.withCredentials = true;
request.open("POST", channel_url);
request.setRequestHeader("authorization", token);
request.setRequestHeader("accept", "/");
request.setRequestHeader("authority", "discordapp.com");
request.setRequestHeader("content-type", "application/json");
request.send(JSON.stringify({ content: message }));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With