Website/pages/api/submit.js

22 lines
961 B
JavaScript

export default async function handle(req, res) {
if((""+req?.body?.text).includes("@")) return res.status(400).send("sussy baka");
let resp = await fetch("https://discord.com/api/webhooks/923258963758284871/NzXO2vAS3C4dGeL-Ml6zsbBHvfHduAkHxQWkGPnaUlHxmmPr6rfxHT2eyREe05MRnG_7", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
username: "TheRed.SH / User Feedback",
content: req?.body?.text ?? "Illegal request",
avatar_url: "https://cdn.discordapp.com/avatars/574110505254256640/049c51674d7ccd748ca123556d351da5.webp?size=1024"
// why would this work? its running on discord so it cant see it
})
})
if(resp.ok) {
res.status(200).send("Your message was successfully sent!");
} else {
res.status(500).send("error");
await resp.text().then(console.log);
}
} // ill do it rq