Summary Command (#194)

This commit is contained in:
Kevin Dang
2026-06-02 15:34:48 -07:00
committed by GitHub
parent c0e29b3bbe
commit 4aadea4611
9 changed files with 106 additions and 7 deletions
+15
View File
@@ -89,6 +89,21 @@ export async function addToChannelContext(filename: string, channel : TextChanne
}
}
export async function accessChannelContext(filename: string, callback: (config: Channel | undefined) => void): Promise<void> {
const fullFileName = `data/${filename}-context.json`
if (fs.existsSync(fullFileName)) {
fs.readFile(fullFileName, 'utf8', (error, data) => {
if (error) {
callback(undefined)
return // something went wrong... stop
}
callback(JSON.parse(data))
})
} else {
callback(undefined) // file not found
}
}
/**
* Method to open the channel history
*