nefertiti-node
Version:
ES module to work with Nefertiti crypto trade bot.
32 lines (25 loc) • 1.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = sendNotificationsTest;
var _child_process = require("child_process");
var _variables = require("./variables.js");
// Notifications test
/**
* @function sendNotificationsTest
* @description Sends a message to the notifications service
* @param {string} service - the notification service. can be 'pushover' or 'telegram'
* @param {string} appKey - application key
* @param {string} chatKey - chat key (for telegram) or user key (for pushover)
*/
function sendNotificationsTest(service, appKey, chatKey) {
const msg = '🎉 This is your test message from Nefertiti 🎉';
if (service === 'pushover') {
(0, _child_process.execFile)(_variables.executable, ['notify', `--pushover-app-key=${appKey}`, `--pushover-user-key=${chatKey}`, `--msg=${msg}`]);
}
if (service === 'telegram') {
(0, _child_process.execFile)(_variables.executable, ['notify', '--pushover-app-key=none', // Shell will pause without this
`--telegram-app-key=${appKey}`, `--telegram-chat-id=${chatKey}`, `--msg=${msg}`]);
}
}