Last active
January 7, 2022 10:22
-
-
Save Eniwder/d5bf9f825a4dd36dc92afdc2ff118b8a to your computer and use it in GitHub Desktop.
discord request sample in dev tool
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var xhr = new XMLHttpRequest(); | |
| xhr.open("POST", "https://discordapp.com/api/v6/channels/{channelId}/messages", true); | |
| xhr.setRequestHeader('Content-Type','application/json'); | |
| xhr.setRequestHeader('Authorization',authKey); // check message header | |
| xhr.send(JSON.stringify({ | |
| content:'somthing message' | |
| })); | |
| // sample request | |
| var xhr = new XMLHttpRequest(); | |
| xhr.open("POST", "https://discordapp.com/api/v6/channels/595532963211640845/messages", true); | |
| xhr.setRequestHeader('Content-Type','application/json'); | |
| xhr.setRequestHeader('Authorization','NDgxOD3xMjx2NxMzMxY3MxEx.xQ4Bxw.xhXxk8x8uxDHx8qxYmxzAqxRxlx'); | |
| xhr.send(JSON.stringify({ | |
| content:'Hello' | |
| })); | |
| // add reaction | |
| var xhr = new XMLHttpRequest(); | |
| xhr.open("PUT", "https://discordapp.com/api/v6/channels/{channelId}/messages/{messageId}/reactions/💯/@me", true); | |
| xhr.setRequestHeader('Content-Type','application/json') | |
| xhr.setRequestHeader('Authorization','NDgxOD3xMjx2NxMzMxY3MxEx.xQ4Bxw.xhXxk8x8uxDHx8qxYmxzAqxRxlx') | |
| xhr.send(); | |
| // PING -> PONG | |
| setInterval( () => { | |
| var log = document.querySelectorAll('.containerCozy-336-Cz'); // chat log class | |
| var lastChat = log[log.length-1].innerText.trim(); | |
| if(lastChat==='PING'){ | |
| var xhr = new XMLHttpRequest(); | |
| xhr.open("POST", "https://discordapp.com/api/v6/channels/{channelId}/messages", true); | |
| xhr.setRequestHeader('Content-Type','application/json') | |
| xhr.setRequestHeader('Authorization','NDgxOD3xMjx2NxMzMxY3MxEx.xQ4Bxw.xhXxk8x8uxDHx8qxYmxzAqxRxlx') | |
| xhr.send(JSON.stringify({ | |
| content:'PONG' | |
| })); | |
| } | |
| },1000) | |
| // add Notification | |
| setInterval( () => { | |
| var sound = new Audio('/assets/5a000a0d4dff083d12a1d4fc2c7cbf66.mp3'); | |
| var log = document.querySelectorAll('.containerCozy-336-Cz'); // chat log class | |
| var lastChat = log[log.length-1].innerText.trim(); | |
| if(lastChat==='PING'){ | |
| sound.play(); | |
| } | |
| },1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment