/starter-python-telegram-bot

Cyclic Python Telegram Bot starter

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Python Telegram Bot Starter

This is simple Python Telegram Bot.

Deploy to Cyclic in seconds

Deploy to Cyclic

  1. Set server.py as your entry point.
  2. Create a new Telegram bot using BotFather
  3. Store the bot token into a BOT_TOKEN environment variable
  4. Create a SECRET_TOKEN and set it in the SECRET_TOKEN environment variable
  5. Run the following curl substituting the appropriate variables:
    curl https://api.telegram.org/bot${BOT_TOKEN}/setWebhook
        -F "url=https://${CYCLIC_URL}/webhook/" \
        -F "secret_token=${SECRET_TOKEN}"
    
  6. Message you bot with /start or just say Hello!
  7. Check your bot's status: https://api.telegram.org/bot${BOT_TOKEN}/getWebhookInfo

Run Locally

Prerequisites:

  • pyenv
  • python 3.10.11

Install: bin/install

  • creates virtual env
  • installs dependencies from requirements.txt

Run: bin/dev

  • runs a uvicorn server in reload mode

Run: bin/start

  • runs a uvicorn server

Helpful Docs:

Questions / Help

Join us on Discord: https://discord.cyclic.sh

Enjoy!