Skip to content

Conversation

@mhaxanali
Copy link

@mhaxanali mhaxanali commented Nov 3, 2025

Relevant Issues

Closes #1706

Description

  • Make bot/utils/quote.py for API requests using bot's HTTP session.
  • Add .quote daily and .quote random commands in bot/exts/fun/fun.py to retrieve the daily quote and random quotes from zenquotes.io API respectively.
  • Cache Daily Quote till midnight UTC to minimize API requests.
  • Use an embed in the final message sent by bot to add attribution required by zenquotes.io
  • Add proper Error Handling

Did you:

Copy link
Member

@jb3 jb3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These commands should be in a group together (e.g. .quote random and .quote daily).

See review comments, but additionally:

  • The API usage is metered, so you should cache the daily quote for a period instead of making frequent requests.
  • The ZenQuotes license mandates that you provide attribution when you use quotes from their API on their free plan (see https://docs.zenquotes.io/zenquotes-documentation/#use-limits). We need to either do this or find an API that does not require attribution (use an embed if you decide to add attribution).

@mhaxanali
Copy link
Author

mhaxanali commented Nov 5, 2025

Thanks for the detailed review, I'll work on implementing these changes and push as soon as possible.

@mhaxanali mhaxanali marked this pull request as ready for review November 5, 2025 10:00
Copy link
Member

@jb3 jb3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks for making those changes, looks much cleaner than the original implementation. Also, nice work integrating Redis for the caching.

Few more feedback points below:

@mhaxanali
Copy link
Author

I have implemented these changes.

@mhaxanali mhaxanali changed the title Add .quote and .daily_quote command to retrieve quotes from zenquotes.io api Add .quote daily and .quote random command to retrieve quotes from zenquotes.io api Nov 7, 2025
Copy link
Member

@jb3 jb3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The uv.lock changes can be reverted now as well since aiohttp is unpinned.

@mhaxanali mhaxanali requested a review from jb3 November 8, 2025 06:55
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

Successfully merging this pull request may close these issues.

Commands for Random and Daily Quote Retrieval from an API

2 participants