Skip to content

jizhang495/telegram-bot

Repository files navigation

A Telegram chatbot that:

  • Replies using OpenAI GPT-4.1 nano.
  • Sends 3 daily messages (2 random messages/day (8AM–8PM) with updates or fun facts; 1 bedtime message (e.g., 10:30PM) checking in or saying goodnight).
  • Acts like a close friend.
  • Runs easily on cloud (Google Cloud, etc).

Environment Variables:

TELEGRAM_BOT_TOKEN=...
OPENAI_API_KEY=...
OPENAI_MODEL=gpt-4.1-nano
USER_CHAT_ID=...  # optional
TIMEZONE=Europe/London

Running locally

Install dependencies (requires openai==0.28) and start the bot:

pip install -r requirements.txt
python bot.py

Deploying on Google Cloud Run

Build and deploy the container:

docker build -t telegram-bot .
# then push to a registry and deploy using gcloud run deploy

TODO:

  • Store chat history and chat summary on Cloud server to have memory of conversation

About

Simple Telegram chatbot using OpenAI API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published