-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsend.js
executable file
·25 lines (23 loc) · 867 Bytes
/
send.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#! /usr/bin/env node
'use strict';
const
config = require('config'),
dapnet = require('./services/dapnet-call'),
args = require('minimist')(process.argv.slice(2));
if (args.h || !args.c || !args.m || !args.t) {
console.log("Usage:\n\t-c Call to send to\n\t-m Message to send\n\t-t Transmitter Group to use");
console.log("For help on TX groups, see https://hampager.de/#/transmitters/groups");
} else if (config.get('user.api_user') === 'CHANGEME') {
console.error("It seems you have to edit config/default.js. Set your call, api_user and api_pass.");
process.exit(1);
} else {
dapnet.send([args.c],args.m,[args.t])
.then(() => {
console.log("Message(s) sent");
process.exit(0);
})
.catch((err) => {
console.error("Oups, there was at least one error",err);
process.exit(1);
});
}