-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
46 lines (42 loc) · 1.8 KB
/
Copy pathscript.js
File metadata and controls
46 lines (42 loc) · 1.8 KB
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
40
41
42
43
44
45
46
function sendWebhook() {
const webhookUrl = document.getElementById('webhookUrl').value;
const botName = document.getElementById('botName').value;
const message = document.getElementById('message').value;
const avatarUrl = document.getElementById('avatarUrl').value;
fetch(webhookUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
username: botName,
content: message,
avatar_url: avatarUrl
})
})
.then(response => response.json())
.then(data => {
alert('Webhook sent successfully!');
console.log(data);
})
.catch((error) => {
console.error('Error:', error);
alert('Failed to send webhook.');
});
}
function updatePreview() {
const botName = document.getElementById('botName').value;
const message = document.getElementById('message').value;
const avatarUrl = document.getElementById('avatarUrl').value || 'default_avatar.png';
document.getElementById('previewName').textContent = botName || "Bot Name";
document.getElementById('previewMessage').textContent = message || "Your message will appear here...";
document.getElementById('previewAvatar').src = avatarUrl;
}
function updatePreview() {
const botName = document.getElementById('botName').value;
const message = document.getElementById('message').value;
const avatarUrl = document.getElementById('avatarUrl').value || 'default_avatar.png';
document.getElementById('previewName').textContent = botName || "Bot Name";
document.getElementById('previewMessage').textContent = message || "Your message will appear here...";
document.getElementById('previewAvatar').src = avatarUrl;
}