mirror of
https://git.sr.ht/~emerson/reflectionircd
synced 2025-04-13 09:59:52 +00:00
add tsconfig and rawlogbot
This commit is contained in:
parent
918402659f
commit
a84ac146a0
2 changed files with 45 additions and 0 deletions
18
.tsconfig.json
Normal file
18
.tsconfig.json
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"lib": ["es2020"],
|
||||||
|
"module": "es2020",
|
||||||
|
"target": "es2020",
|
||||||
|
"outDir": "./lib",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
|
||||||
|
"strict": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"forceConsistentCasingInFileNames": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/*.ts",
|
||||||
|
"src/**/*.ts"
|
||||||
|
]
|
||||||
|
}
|
27
test/rawlogbot.js
Normal file
27
test/rawlogbot.js
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
import { readFileSync } from "fs";
|
||||||
|
import { connect } from "tls";
|
||||||
|
|
||||||
|
const config = JSON.parse(readFileSync('config.json'));
|
||||||
|
|
||||||
|
const client = connect({
|
||||||
|
host: 'localhost',
|
||||||
|
port: config["port"],
|
||||||
|
rejectUnauthorized: false
|
||||||
|
}, () => {
|
||||||
|
process.stdin.pipe(client);
|
||||||
|
process.stdin.resume();
|
||||||
|
})
|
||||||
|
|
||||||
|
client.setEncoding('utf8');
|
||||||
|
client.on('data', (data) => {
|
||||||
|
const dataArray = data.toString().split('\r\n');
|
||||||
|
dataArray.forEach(m => {
|
||||||
|
const trimmedMsg = m.replace('\r', '').replace('\n', '');
|
||||||
|
if (trimmedMsg !== '') {
|
||||||
|
console.log(`--> ${trimmedMsg}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
client.on('end', () => {
|
||||||
|
console.log('server ends connection');
|
||||||
|
});
|
Loading…
Add table
Reference in a new issue