From c121a91c04cfcf904975f7552ff9f890389047b9 Mon Sep 17 00:00:00 2001 From: dabbott Date: Sat, 6 Feb 2021 15:10:01 +0200 Subject: [PATCH] 1.0 --- index.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/index.js b/index.js index e69de29..043b056 100644 --- a/index.js +++ b/index.js @@ -0,0 +1,29 @@ +fetch = require("node-fetch") + + +gotify = { + url: "", + token: "", + priority: 5, + send: (title,message, priority) => { + if (gotify.url == ""){ + throw "gotify url value empty, please use: gotify.url == 'https://gotify.mydomain.tld'" + } else if(gotify.token == "") { + throw "gotify url value empty, please use: gotify.token == 'xyzxyz'" + } + if (!priority){ + priority = gotify.priority + } + + fetch(gotify.url+'/message?token='+gotify.token, { + method: 'POST', + body: 'title='+title+"&message="+message+"&priority="+priority , + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }}) + .then(res => res.text()) + .then(body => console.log(body)) + + } +} + + +module.exports = gotify \ No newline at end of file