add telegram notification

This commit is contained in:
LouisLam 2021-07-09 14:14:03 +08:00
parent 04ec91d7a9
commit 3bdf174e90
11 changed files with 418 additions and 85 deletions

View file

@ -1,5 +1,6 @@
const tcpp = require('tcp-ping');
const Ping = require("./ping-lite");
const {R} = require("redbean-node");
exports.tcping = function (hostname, port) {
return new Promise((resolve, reject) => {
@ -37,3 +38,25 @@ exports.ping = function (hostname) {
});
});
}
exports.setting = async function (key) {
return await R.getCell("SELECT `value` FROM setting WHERE `key` = ? ", [
key
])
}
exports.getSettings = async function (type) {
let list = await R.getAll("SELECT * FROM setting WHERE `type` = ? ", [
type
])
let result = {};
for (let row of list) {
result[row.key] = row.value;
}
console.log(result)
return result;
}