Prerequisites
Before you begin, you’ll need:- A Telegram account
- Python 3.8 or higher (for self-hosting)
- PostgreSQL database (for self-hosting)
- A Telegram Bot Token from @BotFather
Installation
Choose your preferred installation method:- Docker (Recommended)
- Manual Installation
First steps with the bot
Once the bot is running, follow these steps to plan your first journey:Start a conversation
Open Telegram and search for your bot, then send the The bot will register you automatically and display a welcome message:
/start command:Open the main menu
Send the You’ll see several options:
/menu command to open the interactive menu:- 🏚️ Addresses menu
- 👋 Registration menu
- 🚌 Get nearby stops
- 🗺 Get journeys
- ⚙️ Settings
Set your home address
Before planning journeys, you need to configure your addresses:
- Select 🏚️ Addresses menu
- Click Add address
- Enter your home address (e.g., “Alexanderplatz, Berlin”)
- Confirm the address from the search results
- Mark it as 🔘 Home address
Add a destination address
Repeat the process to add a destination address:
- In the Addresses menu, click Add address again
- Enter your destination (e.g., “Berlin Hauptbahnhof”)
- Confirm the location
- Mark it as 🔘 DefaultDestination
Plan your first journey
Now you’re ready to get route information:
- Return to the main menu
- Select 🗺 Get journeys
- The bot will display journey options from your home to destination
- Departure and arrival times
- Total duration
- All legs (segments) of the journey
- Transport lines and directions
- Walking times between stops
Customize your settings (Optional)
Fine-tune the bot to your preferences:
- Select ⚙️ Settings from the main menu
- Adjust settings like:
- Walking speed (slow/normal/fast)
- Min. transfer time (default: based on your settings)
- Max. transfers (maximum number of connections)
- Max. journeys (how many route alternatives to show)
- Transport modes (enable/disable bus, tram, subway, etc.)
- Arrival time (for daily notifications)
- Check time (when to receive daily updates)
Settings are saved per user and persist across bot restarts.
Using geolocation
The bot can find nearby stops using your current location:Share your location
In the Telegram chat with your bot, tap the attachment icon (📎) and select Location.
Send live or static location
Choose Send My Current Location to share your position.The bot will automatically detect the location and show nearby stops.
Available commands
Here are the main commands you can use:| Command | Description |
|---|---|
/start | Initialize or reload the bot |
/menu | Open the main interactive menu |
/help | Display all available commands |
Owner commands
If you’re the bot owner (configured inconfig.toml), you also have access to:
| Command | Description |
|---|---|
/ping | Check bot ping and response time |
/stats | Show bot statistics |
Most interactions happen through the interactive menu system powered by aiogram-dialog, providing a smooth button-based interface.
Setting up daily notifications
Get automated journey updates every morning:Configure your commute times
- Go to ⚙️ Settings
- Click Change arrival time
- Enter your desired arrival time (format:
HH:MM, e.g.,09:00) - Click Change check time
- Enter when you want to receive the notification (e.g.,
07:00)
Verify your addresses
Make sure you have both a home and destination address configured. The bot uses these for daily route calculations.
Receive your first notification
At your configured check time, the bot will automatically send you journey options that arrive at your destination by your specified arrival time.
The background service checks every 15 seconds for users who need notifications. Each user receives only one notification per day, which resets at midnight.
Code reference
The bot’s main functionality is implemented in several key modules:- Journey planning: app/vbb/func.py:116 -
get_journeys()function - Address management: app/dialogs/addresses.py - Address dialog system
- Geolocation handling: app/handlers/user/geolocation.py:11 - Location message handler
- Daily notifications: app/vbb/service/checker.py:18 - Background journey checker
- Settings configuration: app/dialogs/settings.py - User preferences dialog
Troubleshooting
Bot doesn't respond to commands
Bot doesn't respond to commands
- Verify the bot is running (
docker-compose psor check your terminal) - Check your bot token in
config.tomlis correct - Ensure you’ve sent
/startto initialize your user account
Can't find my address
Can't find my address
- Try using more specific address details (street number, city name)
- Use well-known landmarks or station names
- The VBB API uses OpenStreetMap data for geocoding
No journeys found
No journeys found
- Verify both home and destination addresses are set
- Check your transport mode filters in settings (at least one must be enabled)
- Ensure your addresses are within the VBB service area (Berlin-Brandenburg region)
Daily notifications not working
Daily notifications not working
- Confirm both arrival time and check time are configured in settings
- Verify the background service is running (check logs for “checking user” messages)
- Notifications are sent only once per day and reset at midnight
Next steps
Now that you have the bot set up:- Explore different journey options by changing your walking speed
- Add multiple destination addresses for different commute routes
- Experiment with transport mode filters to prefer buses over trains
- Try the nearby stops feature when you’re exploring new areas
View source code
Check out the full source code on GitHub