-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript2.js
39 lines (32 loc) · 1.11 KB
/
script2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const callMeButton = document.getElementById("call-me");
const reasonInput = document.getElementById("reason");
const webhookURL = "https://discord.com/api/webhooks/<lien>";
function sendMessageWithMention(content, userId) {
const mention = `<@${userId}>`;
content = `${mention}\n${content}`;
fetch(webhookURL, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
content: content,
}),
});
}
callMeButton.addEventListener("click", () => {
const userId = "964511260160970793";
const reason = reasonInput.value;
const content = `:speech_left: de Inconnue:${reason ? ` "${reason}"` : ""}`;
sendMessageWithMention(content, userId);
});
document.getElementById('call-me').addEventListener('click', function() {
var message = document.getElementById('reason').value;
if (message.trim() !== '') {
var messageSent = document.getElementById('message-sent');
messageSent.style.display = 'block';
setTimeout(function() {
messageSent.style.display = 'none';
}, 2000);
}
});