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

Enhancements for Better Error Handling, Rate Limiting, and Pagination #55

Open
Trumilnasit opened this issue Oct 10, 2024 · 2 comments
Open

Comments

@Trumilnasit
Copy link

This issue proposes several enhancements to improve the functionality, usability, and stability of the Crypto Bot. Below are the detailed changes that need to be implemented:

  1. Secure Bot Token Management
    Current Issue: The bot token is hardcoded in the code, which is not secure.
    Proposed Solution: Use environment variables (os.getenv('BOT_TOKEN')) to load the bot token securely and add error handling if the token is missing.
    Benefit: Prevents accidental token exposure, improving the bot’s security.
  2. Improved Error Handling
    Current Issue: The error handler only prints errors but does not inform the user or log details.
    Proposed Solution: Enhance the error_handler function to log errors for debugging purposes and notify the user with a friendly message when something goes wrong.
    Benefit: Helps developers debug and provides a better user experience.
  3. Rate Limiting and Retry Logic for API Requests
    Current Issue: API requests do not handle rate-limiting and could fail if the limit is hit.
    Proposed Solution: Add retry logic with a delay between requests to handle potential rate limits from the CoinGecko API.
    Benefit: Increases the reliability of the bot by reducing failed requests due to rate limits.
  4. Pagination for Large Data Sets
    Current Issue: When fetching large data sets (e.g., Top 100 Cryptocurrencies), the entire list is displayed, which may overwhelm users.
    Proposed Solution: Implement pagination for large data sets using inline buttons (Previous and Next) to navigate through pages of cryptocurrencies.
    Benefit: Improves the user experience by allowing them to view manageable chunks of data.
  5. Add Unit Tests
    Current Issue: The bot lacks unit tests, which makes it harder to verify the correctness of the code after changes.
    Proposed Solution: Add unit tests using a framework like pytest to cover the critical functions such as get_crypto_price() and get_crypto_details().
    Benefit: Ensures that the bot's functionality remains intact during future changes and makes the code more robust.
  6. Better Search Functionality
    Current Issue: The search functionality does not provide suggestions if the exact match is not found.
    Proposed Solution: Improve the search functionality by offering suggestions for similar results when no exact match is found.
    Benefit: Enhances the usability of the search feature, making it more user-friendly.
  7. Logging for Debugging
    Current Issue: The bot currently lacks proper logging for activities and errors.
    Proposed Solution: Add logging to track important activities like bot startup and user actions, along with error logs for debugging purposes.
    Benefit: Simplifies debugging and helps track bot usage patterns.
  8. Additional Commands
    Current Issue: The bot could benefit from additional features, such as price history and crypto-related news.
    Proposed Solution: Add commands like /pricehistory to display historical prices and /news to fetch crypto news from relevant APIs.
    Benefit: Adds more functionality, making the bot more versatile and useful for users.
    Tasks:
    Replace hardcoded token with environment variable.
    Enhance the error handler to log errors and notify users.
    Implement retry logic and handle rate limits for API requests.
    Add pagination support for large data sets.
    Add unit tests for key functionalities.
    Improve the search feature with suggestions for similar results.
    Add logging for debugging.
    Implement new commands: /pricehistory and /news.

@Harish-2003 :--can you assign me this with all labels and level-2 badges for this issue

Copy link

Hi there! Thanks for opening this issue. We appreciate your contribution to this open-source project. We aim to respond or assign your issue as soon as possible.

@harshitajha4680
Copy link

Please assign this issue to me, I'm intersted!

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