Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var request = new XMLHttpRequest();
- request.open("POST", "https://discord.com/api/webhooks/944003693852901449/f_oJlQtVE_khP9gD4pBSWDN-lVlBRQoDtaw54hZNmlx1e-aHwCdgDEi_KU31pKwqKYRo");
- // again, replace the url in the open method with yours
- request.setRequestHeader('Content-type', 'application/json');
- var myEmbed = {
- field: {
- name: "test",
- value: "message"
- },
- title: "Webhook",
- description: "This is a cool-looking Discord embed, sent directly from JavaScript!",
- color: hexToDecimal("#ff0000")
- }
- var params = {
- username: "test",
- embeds: [ myEmbed ]
- }
- request.send(JSON.stringify(params));
- // function that converts a color HEX to a valid Discord color
- function hexToDecimal(hex) {
- return parseInt(hex.replace("#",""), 16)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement