Inspiration

I like to climb with friends at BoulderWorld, and sometimes we need to book slots together.

BoulderWorld provides a Telegram channel for real-time slot updates, but it's quite annoying to have to constantly be on the lookout for the slot you want.

This bot solves it by allowing you to set a reminder for the specific timeslot you want, sending you a ping when the slot is open.

Note that this unofficial, crappy bodge isn't affliated with BoulderWorld. It's the tech equivalent of a crappy WattPad fanfic of the BoulderWorld cinematic universe.

What it does

You can set a reminder for any date and timeslot you want using the inline keyboard.

When the bot registers a change in slot capacity from FULL to open, or when it sees a new slot that's just been released, it sends a ping to anyone that has registered for a ping for that slot!

How we built it

The bot itself is divided into four services.

bot_interactive.py and bot_reminder.py are built with python-telegram-bot. bot_interactive.py handles the parts of the bot which have to interact with users - setting reminders. bot_reminder.py is responsible for pushing the reminder to the user.

db.py is a Python script that handles requests to and from the database.

listener.py is built with Telethon and basically just sits in the BoulderWorld channel waiting for updates/edits to the number of slots. When it sees a new change, it sends the timeslot to db.py to process, which then queries for all users who have a reminder set for that time slot and sends all of them a ping via bot_reminder.py.

RabbitMQ is the glue that holds it all together, responsible for helping the different services communicate with one another.

Challenges we ran into

Telegram doesn't allow bots to subscribe to public channels

Workaround by using a user account to read from the BoulderWorld channel, and communicating any updates via RabbitMQ to the relevant services.

Weird async/concurrency nonsense if all services run from the same script

Break it up into multiple services and communicate between them with messaging queues.

Accomplishments that we're proud of

Honestly just having a working prototype lmao

What we learned

  • Using messaging queues for communication between services
  • Inline queries for Telegram bots
  • The power of documentation/examples

What's next for BoulderWorld Ping Bot

Dockerise it to make it easier to deploy. It's currently being run on 4 tmux windows on my home server old laptop which is... not ideal.

Add some logging, error handling, and improve its security a bit.

Thanks to

Artem Bakhanov for his sick Python Telegram Bot Calendar library

Try it out

You can mess around with it at @BoulderWorldPingBot on Telegram. I'm still messing around with it, so most likely it won't send you pings reliably.

I haven't added a function to remove reminders, so if you set a reminder for an open slot, be ready to get spammed with pings.

Built With

Share this project:

Updates