Removed Unnecessary Comments

This commit is contained in:
IM23a-spirgif
2025-06-15 22:54:46 +02:00
parent d5ca84e9a3
commit 2947f92802
3 changed files with 123 additions and 204 deletions
+5 -37
View File
@@ -6,91 +6,59 @@ const prohibitedWords = ['fuck', 'shit', 'asshole', 'bitch', 'bastard', 'damn',
'fuckface', 'shitfaced', 'asshat', 'bint', 'chink', 'gook', 'jap', 'negro', 'dyke', 'queer', 'tranny', 'tosser',
'spaz', 'mong', 'coon', 'beaner', 'cracker', 'wetback', 'homo', 'fudgepacker', 'tard', 'cocks', 'bollocks',
'numbnuts', 'knob', 'muppet', 'git', 'shag', 'minge', 'git', 'bugger', 'tosser', 'nonce', 'plonker', 'pillock']
; // Example word filtering
;
// Function to get the last submission time from localStorage
function getLastSubmissionTime() {
const storedTime = localStorage.getItem('lastSubmissionTime');
return storedTime ? parseInt(storedTime, 10) : 0;
}
// Function to save the last submission time to localStorage
function setLastSubmissionTime(time) {
localStorage.setItem('lastSubmissionTime', time.toString());
}
function sendMessage() {
// Get the current time
const currentTime = Date.now();
// Retrieve the last submission time from localStorage
const lastSubmissionTime = getLastSubmissionTime();
// Cooldown logic to prevent spamming
if (currentTime - lastSubmissionTime < cooldownDuration) {
alert(`Please wait for ${cooldownDuration / 1000} seconds between submissions.`);
return;
}
// Get the values from the input fields
const pseudoname = document.getElementById("name").value || "Anonymous";
const rating = parseInt(document.getElementById("rate").value, 10);
const comment = document.getElementById("text").value.trim();
// Validation: Rating should be between 1 and 10
if (isNaN(rating) || rating < 1 || rating > 10) {
alert("Rating must be a number between 1 and 10.");
return;
}
// Validation: Comment length (min 5, max 500) and simple prohibited word check
if (comment.length < 5 || comment.length > 500) {
alert("Comment must be between 5 and 500 characters.");
return;
}
// Check for prohibited words (basic check)
for (const word of prohibitedWords) {
if (comment.toLowerCase().includes(word)) {
alert("Your comment contains inappropriate content.");
return;
}
}
// If all checks pass, send the message to the Discord webhook
const request = new XMLHttpRequest();
request.open("POST", "https://discord.com/api/webhooks/1284936894890901649/Zi-2ZV12L1v1OSBoM-DluE1V1LECXilrNNRZYJcxelnwO7rGgXNH47dxvfFEOK7Fe9_J");
request.setRequestHeader('Content-type', 'application/json');
// Create the content to send to the Discord webhook
const content = `**Rating:** ${rating}\n**Comment:**\n${comment}`;
// Debugging information
console.log('Sending message with content:', content);
// Send the message payload to the Discord webhook
const params = {
username: pseudoname, // Pseudoname will appear as the username
content: content // The combined content (pseudoname, rating, and comment)
username: pseudoname,
content: content
};
request.send(JSON.stringify(params));
// Update the last submission time to the current time
setLastSubmissionTime(currentTime);
// Optionally, you can reset the form after sending
document.getElementById("name").value = "";
document.getElementById("rate").value = "";
document.getElementById("text").value = "";
// Display the success message
const successMessage = document.getElementById("successMessage");
successMessage.textContent = "Successfully sent the message!";
successMessage.style.display = "block"; // Ensure the message is visible
// Optionally hide the message after a few seconds
successMessage.style.display = "block";
setTimeout(() => {
successMessage.style.display = "none"; // Hide message after 3 seconds
successMessage.style.display = "none";
}, 3000);
}