check for presence of transcript file before attempting to write to it
This commit is contained in:
parent
b641b18a28
commit
18d96af731
5
dist/bot.js
vendored
5
dist/bot.js
vendored
@ -184,6 +184,11 @@ class OcrccBot {
|
|||||||
timeZone: "America/New_York"
|
timeZone: "America/New_York"
|
||||||
});
|
});
|
||||||
const filepath = this.localStorage.getItem(`${roomId}-transcript`);
|
const filepath = this.localStorage.getItem(`${roomId}-transcript`);
|
||||||
|
|
||||||
|
if (!filepath) {
|
||||||
|
return _logger.default.log("error", `NO TRANSCRIPT FILE FOR ROOM: ${roomId}`);
|
||||||
|
}
|
||||||
|
|
||||||
const message = `${sender} [${time}]: ${content.body}\n`;
|
const message = `${sender} [${time}]: ${content.body}\n`;
|
||||||
fs.appendFileSync(filepath, message, "utf8");
|
fs.appendFileSync(filepath, message, "utf8");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -173,6 +173,11 @@ class OcrccBot {
|
|||||||
timeZone: "America/New_York"
|
timeZone: "America/New_York"
|
||||||
});
|
});
|
||||||
const filepath = this.localStorage.getItem(`${roomId}-transcript`)
|
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`;
|
const message = `${sender} [${time}]: ${content.body}\n`;
|
||||||
|
|
||||||
fs.appendFileSync(filepath, message, "utf8");
|
fs.appendFileSync(filepath, message, "utf8");
|
||||||
|
Loading…
Reference in New Issue
Block a user