The Palos Publishing Company

Follow Us On The X Platform @PalosPublishing
Categories We Write About

Build a quote-of-the-day bot

Here’s a simple “Quote of the Day” bot written in Python. This bot selects a random quote from a predefined list and displays it. You can expand it later to fetch quotes from an API or database.

python
import random import datetime class QuoteOfTheDayBot: def __init__(self): self.quotes = [ "The only limit to our realization of tomorrow is our doubts of today. – Franklin D. Roosevelt", "In the middle of every difficulty lies opportunity. – Albert Einstein", "Success is not final, failure is not fatal: It is the courage to continue that counts. – Winston Churchill", "Believe you can and you're halfway there. – Theodore Roosevelt", "Do not wait to strike till the iron is hot, but make it hot by striking. – William Butler Yeats", "Everything you’ve ever wanted is on the other side of fear. – George Addair", "What lies behind us and what lies before us are tiny matters compared to what lies within us. – Ralph Waldo Emerson" ] self.current_date = None self.todays_quote = None def get_quote_of_the_day(self): today = datetime.date.today() if self.current_date != today: self.todays_quote = random.choice(self.quotes) self.current_date = today return self.todays_quote # Example usage bot = QuoteOfTheDayBot() print("Quote of the Day:", bot.get_quote_of_the_day())

Features:

  • Displays one unique quote per day.

  • Caches the quote for the day to avoid repeating different quotes on the same day.

  • Easily extensible for future features like API integration, database storage, or sending quotes via email or messaging apps.

Let me know if you want a web version, Discord bot, or integration with APIs like zenquotes.io.

Share this Page your favorite way: Click any app below to share.

Enter your email below to join The Palos Publishing Company Email List

We respect your email privacy

Categories We Write About