1.0
This commit is contained in:
parent
debd09c23a
commit
c121a91c04
29
index.js
29
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
|
Loading…
Reference in New Issue
Block a user