A Telegram bot and scheduler that sends you daily quotes per x times and sends you a quote if you send any messages to the bot
- Fetches and sends a random quote daily at a scheduled time.
- Supports multiple quote sources: Bible API, Kanye REST API, motivational quotes.
- Users can request a quote on-demand via the Telegram command
/w
or any messages to the bot. - Deployable via Docker or runnable locally.
- Python 3.10+ installed locally.
pip
for installing Python dependencies.- A Telegram account to create a bot.
- Docker for containerized deployment.
git clone https://github.com/TriTacLe/DailyQuoteBot.git
cd DailyQuoteBot
- Open Telegram and start a chat with BotFather.
- Send /newbot and follow the prompts to set a name and username for your bot.
- BotFather will provide you with a bot token. Copy this token.
In order to send messages to you, the bot needs your Chat ID:
- Open a chat with your newly created bot and send any message (e.g., Hello).
- Ensure the .env file has your TELEGRAM_BOT_TOKEN set (see next step).
- Run the helper script:
python get_telegram_chat_id.py
This script will print your Chat ID. Copy value.
- Copy the example file:
cp .env.example .env
- Open .env in IDE and fill in the required fields:
# Time the bot sends a daily quote (24-hour format HH:MM)
TIME=07:00
# Quote Sources Endpoints (defaults work out of the box)
BASE_URL_BIBLE=https://bible-api.com/
BASE_URL_KANYE=https://api.kanye.rest
BASE_URL_MOTIVATIONAL=https://stoic.tekloon.net/stoic-quote
# Enable/Disable Quote Sources (true/false)
ENABLE_BIBLE=true
ENABLE_KANYE=false
ENABLE_MOTIVATIONAL=true
# Telegram Credentials
TELEGRAM_BOT_TOKEN=<your_bot_token>
TELEGRAM_BOT_USERNAME=@YourBotUsername
TELEGRAM_CHAT_ID=<your_chat_id>
# docker
CONTINENT=Continent
CITY=City
- Save
.env
pip install --no-cache-dir -r requirements.txt
From the project root, run:
python src/main.py
This will:
- Start the scheduler, which sends a quote daily at the time specified by TIME.
- Launch the Telegram bot, which listens for messages. You can request a quote manually by sending
/w
in the bot chat.
You can containerize the application for easier deployment.
- Build the Docker Image
docker build -t dailyquotebot:latest .
- Run the container manually
docker run -d --name dailyquotebot-container dailyquotebot:latest
- Stop and remove image and container
docker rmi dailyquotebot:latest
docker rm -f dailyquotebot-container
- Start service
docker compose down
docker compose up --build
docker compose up -d
#or
docker-compose up -d --build
- Stop service
docker compose down
docker images
docker ps -a
docker compose logs -f dailyquotebot
- Other commands
docker compose stop
docker compose start
pip freeze -> requirements.txt