I'm trying to use Node.js to scan a Google Document, then if a Roblox ID is on there then it tracks it. When it tracks it, if it joins one of the groups in the ID list, it auto-exiles it.
Any help?
I'm a little stuck on the scanning a Google Document line by line.
I am not sure about how to do it from a google doc, but if you are willing to move to using text files(.txt
) I think I could be of assistance.
Using Nodes FS we can read lines using a Line reader
import * as fs from 'fs'
import { createReadStream } from 'fs'
import { createInterface } from 'readline'
const lineReader = createInterface({
input: createReadStream('data/input.txt')
})
const output: string[] = []
lineReader.on('line', (item: string) => {
output.push(If you wanna output something to an output file put it here)
})
// Down here is the output of what you put in the output.push
lineReader.on('close', () => {
fs.writeFile('data/output.txt', output.join('\n'), err => {
if (err) throw err
console.log('The file has been saved!')
})
})
So the above code is in typescript, but typescript can be compiled down into javascript. If this code doesn't work for you I at least hope it gave some knowledge that helped you find your answer.