mirror of
https://github.com/TheShadowEevee/Konpeki-Discord-Bot.git
synced 2025-01-11 14:38:49 -06:00
Create data
folder if it doesn't exist
This commit is contained in:
parent
a336e21a90
commit
fb7b87c291
1 changed files with 6 additions and 1 deletions
|
@ -68,7 +68,12 @@ try {
|
||||||
// See https://stackoverflow.com/a/34347475
|
// See https://stackoverflow.com/a/34347475
|
||||||
const helpJSON = JSON.stringify(JSON.parse(helpJSONString.replace(/,(?!\s*?[{["'\w])/g, '')), null, 4);
|
const helpJSON = JSON.stringify(JSON.parse(helpJSONString.replace(/,(?!\s*?[{["'\w])/g, '')), null, 4);
|
||||||
|
|
||||||
// write file to disk
|
// Create data folder if it doesn't exist
|
||||||
|
if (!fs.existsSync('data')) {
|
||||||
|
fs.mkdirSync('data');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write file to disk
|
||||||
fs.writeFile('./data/help-text.json', helpJSON, err => {
|
fs.writeFile('./data/help-text.json', helpJSON, err => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(`Unable to write help-text.json: ${err}`);
|
console.log(`Unable to write help-text.json: ${err}`);
|
||||||
|
|
Loading…
Reference in a new issue