mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 13:27:38 +00:00
feat(notification): add pushover (#55)
Co-authored-by: Jef LeCompte <jeffreylec@gmail.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import {Config} from '../config';
|
||||
import {Logger} from '../logger';
|
||||
import Push = require('pushover-notifications');
|
||||
|
||||
const p = new Push({
|
||||
user: Config.notifications.pushover.user,
|
||||
token: Config.notifications.pushover.token
|
||||
});
|
||||
|
||||
export default function sendPushoverNotification(text: string) {
|
||||
const message = {
|
||||
message: text
|
||||
};
|
||||
|
||||
p.send(message, (err: Error, result: string) => {
|
||||
if (err) {
|
||||
Logger.error(err);
|
||||
} else {
|
||||
Logger.info(`✔ Pushover notification sent: ${result}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user