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

setName method for updating channel name does not consistently resolve promises #9739

Closed
Digiox opened this issue Jul 30, 2023 · 1 comment
Closed

Comments

@Digiox
Copy link

Digiox commented Jul 30, 2023

Which package is this bug report for?

discord.js

Issue description

The setRemainingTimeBeforeBloodMoon function is called within a setInterval in the Discord.js bot code. This function is responsible for updating the name of a category channel with the remaining time before a blood moon event. However, it appears that the setName method used inside this function does not consistently resolve or reject promises.

Note: The setInterval in the index.js file repeatedly calls the updateCategoryName function, which in turn calls the setRemainingTimeBeforeBloodMoon function. The inconsistent behavior of the setName method inside setRemainingTimeBeforeBloodMoon leads to occasional failures in updating the category name. This issue may be related to API limitations or other factors.

Please let me know if there are any additional details needed to address this issue effectively.

Code sample

// ... (other code)

module.exports = async (client, days) => {
  console.log("Is function called");
  const remainingTimeCategory = await client.channels.fetch(remaining_time_before_BM);
  const name = time_display_channel_prefix + days + time_display_channel_suffix;

  // The problematic part - setName method does not consistently resolve or reject promises.
  remainingTimeCategory.setName(name)
    .then(() => {
      console.log("Remaining Time category name updated successfully.");
    })
    .catch((err) => {
      log(err);
      console.log("Error updating Remaining Time category name");
    });
}

Versions

  • Node.js version: 20.5.0
  • Discord.js version: 12.5.3
  • Operating System: Windows

Issue priority

Medium (should be fixed soon)

Which partials do you have configured?

Not applicable

Which gateway intents are you subscribing to?

Guilds

I have tested this issue on a development release

No response

@Jiralite
Copy link
Member

You are encountering a rate limit. If you would like for it to throw, you can use the rejectOnRateLimit REST option.

@Jiralite Jiralite closed this as not planned Won't fix, can't repro, duplicate, stale Jul 30, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants