mirror of
https://github.com/dyzulk/webhooks.git
synced 2026-01-26 13:31:53 +07:00
Add files via upload
This commit is contained in:
59
main.js
Normal file
59
main.js
Normal file
@@ -0,0 +1,59 @@
|
||||
window.addEventListener("load", function () {
|
||||
const loader = document.querySelector(".loader-wrapper");
|
||||
console.log(loader)
|
||||
loader.className += " hidden"; // class "loader hidden"
|
||||
});
|
||||
/*
|
||||
whurl variable should be equal to your webhooks link!
|
||||
|
||||
|
||||
On discord you create a webhook by going to
|
||||
the server settings and from there to the
|
||||
integrations tab, then click on webhooks and
|
||||
press new webhook. Then copy the link and paste it
|
||||
in the whurl variable.
|
||||
|
||||
Make sure to hide this link using https://javascriptobfuscator.com/Javascript-Obfuscator.aspx
|
||||
if someone takes this link they can send messages to you with this webhook so make sure to
|
||||
hide this link!
|
||||
*/
|
||||
whurl = ""
|
||||
var str= "";
|
||||
var name= "";
|
||||
function f1(){
|
||||
name = document.getElementById("NameInput").value;
|
||||
str = document.getElementById("InputField").value;
|
||||
console.log(document.getElementById("InputField").value)
|
||||
}
|
||||
function send(){
|
||||
f1();
|
||||
const msg = {
|
||||
"content": str,
|
||||
"username": name
|
||||
};
|
||||
console.log(msg)
|
||||
if(str == ""){
|
||||
document.getElementById("Message1").style.opacity = 1;
|
||||
setTimeout(function(){
|
||||
document.getElementById("Message1").style.opacity = 0;
|
||||
}, 4000)
|
||||
console.log("ERROR")
|
||||
return;
|
||||
}
|
||||
try{
|
||||
fetch(whurl + "?wait=true", {"method":"POST", "headers": {"content-type": "application/json"}, "body": JSON.stringify(msg)});
|
||||
document.getElementById("InputField").value = "";
|
||||
document.getElementById("MessageSent").style.opacity = 1;
|
||||
setTimeout(function(){
|
||||
document.getElementById("MessageSent").style.opacity = 0;
|
||||
}, 4000)
|
||||
|
||||
} catch(e){
|
||||
document.getElementById("MessageFailed").style.opacity = 1;
|
||||
|
||||
setTimeout(function(){
|
||||
document.getElementById("MessageFailed").style.opacity = 0;
|
||||
}, 4000)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user