(Unofficial) TripAdvisor bot for Telegram

In the past I used my experiences when visiting restaurants to help find a suitable place to eat. The problem was that it caused me to re-visit the same places as they were reliable. As a result, I knew that I was missing new opportunities to increase my palate.

So, I decided to develop another bot that would use restaurant info to find me new places to visit. NB> Bot utilises TripAdvisor restaurant data for only Swansea (currently).

Available commands

The following sub-headings detail the available commands at current disposal.

# Return list of restaurants by the cuisine type. 
/American
/Thai

# Retrieve 3 random restaurants.
/random 3

# Return restaurant info, price bracket (££-£££) and URL to the TripAdvisor page.
/r Five Guys

# Play restaurant roulette based on given cuisine type.
/roulette Chinese

Custom query

# Custom query 
/q rating=5 review=50 limit=7

This command allows the user combine multiple arguments to narrow down the list of restaurants. In this instance, the command will only return restaurants rated 5 out of 5, with a review count of 50 or more and limit results to 7 items.

Command uses regular expression to extract values from each field and will still work when given in a different order, for example /q limit=3 review=14 rating=4.5.

Issues encountered

The primary issue was setting up regex to manage custom expressions, rather than creating a bespoke one for each edge case. In doing so, I also improved my regex skills, which is transferable in all programming languages.

Improvements

  1. Add user documentation for using the bot: currently not present as the app is still in development.
  2. Allow users to set their own location as bot can support this feature.
  3. Custom query to handle cuisine type.
  4. Improved custom query handling: currently if the user was to exclude an argument, query will not properly work.