-
-
Save AllGistsEqual/65ad6562a36cd0f3aebefd9c98f2d678 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File: src/index.js | |
/* [ALPHA] | |
* If the file does not exist, create it | |
*/ | |
if (!configExists) { | |
bot.log.info(`No config file found, generating...`) | |
try { | |
mkdirp.sync(path.dirname(this.configFile)) | |
const { token, name, prefix } = initialConfig | |
const baseConfig = { | |
discordToken: token, | |
prefix, | |
name, | |
} | |
fs.writeFileSync(this.configFile, JSON.stringify(baseConfig, null, 4)) | |
} catch (err) { | |
this.log.error(chalk.red.bold(`Unable to create config.json: ${err.message}`)) | |
throw err | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment