starryzone/starrybot-discord

Sometimes guild.systemChannelId comes back empty

mikedotexe opened this issue · 2 comments

This must be a Discord API problem, as I've run the same code twice and seen the Discord API endpoint fail (with 404) and then succeed.

aloha systemChannelId undefined
starrybot has star(ry)ted.
/Users/mike/Documents/starrybot-discord/node_modules/discord.js/src/rest/RequestHandler.js:349
      throw new DiscordAPIError(data, res.status, request);
            ^

DiscordAPIError: 404: Not Found
    at RequestHandler.execute (/Users/mike/Documents/starrybot-discord/node_modules/discord.js/src/rest/RequestHandler.js:349:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (/Users/mike/Documents/starrybot-discord/node_modules/discord.js/src/rest/RequestHandler.js:50:14)
    at async ChannelManager.fetch (/Users/mike/Documents/starrybot-discord/node_modules/discord.js/src/managers/ChannelManager.js:114:18)
    at async login (/Users/mike/Documents/starrybot-discord/src/discord.js:61:17) {
  method: 'get',
  path: '/channels',
  code: 0,
  httpStatus: 404,
  requestData: { json: undefined, files: [] }
}

So anything using guild.systemChannelId needs to be in a try/catch or else look for weirdness of it coming back undefined sometimes.

Marking as bug because this will crash the app when this happens currently