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

Implement Rate Limit Handler for Discord API Calls #22

Open
Behzad-rabiei opened this issue May 11, 2023 · 1 comment
Open

Implement Rate Limit Handler for Discord API Calls #22

Behzad-rabiei opened this issue May 11, 2023 · 1 comment
Assignees

Comments

@Behzad-rabiei
Copy link
Member

Description:

To ensure compliance with Discord API rate limits and provide better handling of rate limit errors in our Discord bot, we need to implement a rate limit handler. This handler will handle rate limit errors returned by the Discord API and appropriately delay or queue API calls to prevent exceeding the rate limits.

Tasks to Implement:

1. Implement rate limit handler

  • Description: This handler should intercept rate limit errors returned by the Discord API and handle them by delaying or queueing the affected API calls.
  • Best practices to follow:
    • Use a library or framework that provides rate limit handling capabilities (e.g., discord.js, axios, etc.).
    • Implement error handling middleware or functions to intercept rate limit errors.
    • Parse the rate limit headers provided in the response to determine the delay and retry time.
    • Delay or queue the affected API calls to ensure compliance with the rate limits.
    • Provide appropriate logging or notifications to alert about rate limit events or actions taken.

2. Integrate rate limit handler with existing Discord API calls

  • Description: Update the existing Discord API calls in our bot's codebase to utilize the rate limit handler.
  • Best practices to follow:
    • Identify the relevant API calls in your bot's codebase that may be subject to rate limits.
    • Modify these API calls to use the rate limit handler before making requests to the Discord API.
    • Ensure that the rate limit handler is used consistently across all relevant API calls.
    • Test the integrated rate limit handler to verify its functionality and effectiveness.

Additional Notes:

  • Please refer to the Discord API documentation for information on rate limits and rate limit headers.
  • Consider using established libraries or frameworks that provide rate limit handling functionality to simplify implementation.
  • Follow best practices and recommendations from the library or framework being used for rate limit handling.
  • Document the implementation details of the rate limit handler in the codebase to facilitate future maintenance and understanding.
  • Thoroughly test the rate limit handler to ensure it effectively handles rate limit errors and prevents API rate limit breaches.

References:

@Behzad-rabiei Behzad-rabiei changed the title Issue: Implement Rate Limit Handler for Discord API Calls Implement Rate Limit Handler for Discord API Calls May 11, 2023
@Behzad-rabiei Behzad-rabiei self-assigned this May 11, 2023
@cyri113
Copy link
Contributor

cyri113 commented Jun 9, 2023

@Behzad-rabiei was this completed? or should we move it to another iteration?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants