Change webhook destination

master
trémeur 1 month ago
parent fafbbc80f5
commit 2c2244e401

@ -119,7 +119,7 @@ def commentpage(ficno,directory,local=False):
except: except:
pass pass
if fffandom or timeelapsed.days < 730: if fffandom or timeelapsed.days < 730:
filewrite.write("<script>\nasync function sendContact(ev) {\nev.preventDefault();\nconst theFic = document\n.getElementById('ficno').innerHTML;\nconst senderName = document\n.getElementById('nameInput').value;\nconst senderAddress = document\n.getElementById('emailInput').value;\nconst senderSite = document\n.getElementById('siteInput').value;\nconst senderMessage = document\n.getElementById('messageInput').value;\nconst webhookBody = {\nembeds: [{\ntitle: 'New comment received',\nfields: [\n{ name: 'Fic ID', value: theFic },\n{ name: 'Pseudonym', value: senderName },\n{ name: 'Email', value: senderAddress },\n{ name: 'Site', value: senderSite },\n{ name: 'Comment', value: senderMessage }\n]\n}],\n};\n\nconst webhookUrl = 'https://discord.com/api/webhooks/1110564759109120001/nJRKlR2vGf_kQNNniChju_kt5MA-Y6WC3c-3nTrDuwH8s3Pg4wUfgxwd1SI9ZHicXP0m';\n\nconst response = await fetch(webhookUrl, {\nmethod: 'POST',\nheaders: {\n'Content-Type': 'application/json',\n},\nbody: JSON.stringify(webhookBody),\n});\n\nif (response.ok) {\nalert('Comment submitted, thank you!');\n} else {\nalert('This is fucked, sorry.');\n}\n\ndocument.getElementById(\"theform\").reset();\n}\n</script>\n") filewrite.write("<script>\nasync function sendContact(ev) {\nev.preventDefault();\nconst theFic = document\n.getElementById('ficno').innerHTML;\nconst senderName = document\n.getElementById('nameInput').value;\nconst senderAddress = document\n.getElementById('emailInput').value;\nconst senderSite = document\n.getElementById('siteInput').value;\nconst senderMessage = document\n.getElementById('messageInput').value;\nconst webhookUrl = 'https://kes.praze.net/api/v1/statuses';\nconst response = await fetch(webhookUrl, {\nmethod: 'POST',\nheaders: {\n 'Content-Type': 'application/json',\n 'Authorization': 'Bearer OTBKMDFMMJMTMZNKYY0ZMGQZLWJJMJUTYJE0MMY5ZJK3NJU4',\n },\n body: JSON.stringify({'status' : 'new comment on fic ' + theFic + ' from ' + senderName + ' (' + senderAddress + ', ' + senderSite + ')\\n\\n' + senderMessage}),\n});\n\nif (response.ok) {\nalert('Comment submitted, thank you!');\n} else {\nalert('This is fucked, sorry. Email me instead, whatever at praze dot net!');\n}\n\ndocument.getElementById(\"theform\").reset();\n}\n</script>\n")
filewrite.close() filewrite.close()
headerfooter.footerwrite(commentspath + "/index.html",False,local) headerfooter.footerwrite(commentspath + "/index.html",False,local)

Loading…
Cancel
Save