@orc4bikes_bot

July 16, 2025 ยท View on GitHub

Telegram bot for ORC4BIKES, an RC4 interest group

What this bot does

Handles the rental of bicycles from ORC4BIKES.

Using telegram, users are able to check the availability of bikes, and rent them after verification.

Commands available

CommandDescription
/startInitializes the bot
/topupTop-up via PayLah / PayNow
/routesorc4bikes-curated routes
/statusCredits and rental status
/historyRecent transactions history
/bikesSee available bikes
/rentStart your rental trip here!
/getpinGet the PIN for the bike you rented
/returnReturn the current bicycle
/reportReport damages or anything sus

Setup

Local Development

  1. Download and install Python by following the instructions here. Ensure that the version is at least the major version declared in src/runtime.txt.

  2. Install Python modules required.

python3 -m pip install -r requirements.txt
  1. Additionally, install the python-dotenv library if you are testing locally.
python3 -m pip install python-dotenv
  1. Make a copy of .env.example as .env, then fill in the necessary environment variables.

  2. Start the bot.

python3 main.py

Production Deployment

This bot is designed to run on fly.io for production deployment.

The repository includes GitHub Actions for automatic deployment when you push to the main branch.

Setup (one-time):

  1. Get your fly.io API token:
flyctl auth token
  1. Add it to GitHub Secrets:

    • Go to your GitHub repository
    • Navigate to Settings > Secrets and variables > Actions
    • Add a new secret named FLY_API_TOKEN with your token
  2. Push to main branch:

git add .
git commit -m "Deploy changes"
git push origin main

How it works:

  • Any push to main triggers automatic deployment
  • Uses .github/workflows/fly.yml configuration
  • Runs flyctl deploy --remote-only on GitHub's servers
  • Monitor progress in the Actions tab

Manual Deployment

If you prefer manual deployment or need to deploy immediately:

  1. Install flyctl CLI and authenticate:
flyctl auth login
  1. Connect to your existing app:
flyctl config save -a orc4bikes
  1. Deploy your changes:
flyctl deploy

New Deployment

For complete deployment instructions including:

  • First-time setup
  • Environment variables configuration
  • Web interface management
  • Generating new bicycle QR codes
  • Troubleshooting

See FLYIO_SETUP.md for detailed deployment guide.

Environment Variables

The bot requires these key environment variables:

  • TELE_API_TOKEN - Your Telegram bot token
  • DB_ACCESS_KEY & DB_SECRET_KEY - AWS DynamoDB credentials
  • ADMIN_GROUP_ID - Admin group chat ID
  • ADMIN_LIST - Comma-separated admin usernames

For the complete list, see .env.example and FLYIO_SETUP.md.