Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CategoryChannel#parentID is sometimes undefined #4868

Closed
1 task done
Jiralite opened this issue Sep 30, 2020 · 1 comment · Fixed by #4881
Closed
1 task done

CategoryChannel#parentID is sometimes undefined #4868

Jiralite opened this issue Sep 30, 2020 · 1 comment · Fixed by #4881

Comments

@Jiralite
Copy link
Member

Please describe the problem you are having in as much detail as possible:
The .parentID property of a category is sometimes undefined, but it should always be null.

I tested in all guilds my bot was in and I was surprised to see a mixture of undefined and null values.

Include a reproducible code sample here, if possible:

const client = new (require("discord.js").Client)();

client.on("ready", () => {
  const results = [];

  client.guilds.cache.forEach(({ channels: { cache } }) => {
    results.push(cache.filter(({ type }) => type === "category").map(({ parentID }) => parentID));
  });

  console.log(results);
});

client.login("token");

results resulted as:

[
  [ undefined, undefined, undefined ],
  [ undefined, undefined ],
  [
    null, null, null,
    null, null, null,
    null, null, null
  ],
  [
    null,      undefined,
    undefined, null,
    undefined, null,
    undefined, null
  ],
  [ undefined, undefined, null ],
  [ undefined, undefined ],
  [ null, null, null, null, null ],
  [ null, null ],
  [ undefined, undefined ]
]

Further details:

  • discord.js version: 12.3.1
  • Node.js version: 14.10.0
  • Operating system: macOS 10.15.6
  • Priority this issue should have – please be realistic and elaborate if possible: Low

Relevant client options: N/A

  • partials: none
  • gateway intents: none
  • other: none
  • I have also tested the issue on latest master, commit hash: d234165
@almostSouji
Copy link
Member

almostSouji commented Sep 30, 2020

seems to be yet another case of #4593 | #4706
where discord simply doesn't send fields at all instead of as null values

CR in 12.3.1 with client.channels.cache.filter(c => c.type !== "category" && c.parentID === undefined).size

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants