check for presence of transcript file before attempting to write to it

This commit is contained in:
Sharon Kennedy
2020-04-23 10:24:03 -04:00
parent b641b18a28
commit 18d96af731
2 changed files with 10 additions and 0 deletions

View File

@@ -173,6 +173,11 @@ class OcrccBot {
timeZone: "America/New_York"
});
const filepath = this.localStorage.getItem(`${roomId}-transcript`)
if (!filepath) {
return logger.log("error", `NO TRANSCRIPT FILE FOR ROOM: ${roomId}`);
}
const message = `${sender} [${time}]: ${content.body}\n`;
fs.appendFileSync(filepath, message, "utf8");