Is this a platform issue?

So um, i have this code:

client.on('guildCreate', (guild) => {

  var defaultsettings = {

"modroles": [],

"exemptroles": [],

"mutedrole": "Muted",

"badwords": [],

"modlogchannel": "0"

  const {promisify} = require('util')
const writeFileAsync = promisify(require('fs').writeFile)

writeFileAsync('./guilds/''.json', JSON.stringify(defaultsettings)).then(console.log).catch(console.error);

Why doesn’t it write the file? It’s not a code issue, i’m just asking if it’s an issue with Glitch.


Here it is writing to the file:!/quickest-weed, so it does work.

For now, files created/edited via the console or code aren’t synced in the editor, so perhaps it was writing but the file wasn’t showing yet? Running refresh from the command line, or letting the project sleep and reload will update the editor.

Depending on where your code is relative to the guilds directory, I also suggest prepending the location with __dirname so that it’s definitely pointing to the location you expect.

So technically the file has changed but I don’t see the change?

that’s right - until you refresh. This is something we’ll be changing shortly.

1 Like