mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
motd.js for changing the motd easily
This commit is contained in:
parent
fe713b18b4
commit
f0d37be1bb
1 changed files with 18 additions and 0 deletions
18
motd.js
Executable file
18
motd.js
Executable file
|
@ -0,0 +1,18 @@
|
|||
const utils = require('./utils.js');
|
||||
const dataFile = "public/data.json";
|
||||
|
||||
if (GetParams().length <= 0) {
|
||||
console.log("no params!");
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
var param = GetParams().join(" ");
|
||||
var d = utils.ReadFile(dataFile);
|
||||
var parsed = JSON.parse(d);
|
||||
console.log(param);
|
||||
parsed.motd = param;
|
||||
utils.WriteFile(JSON.stringify(parsed), dataFile);
|
||||
|
||||
function GetParams() {
|
||||
return process.argv.splice(2);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue