/SGNearMe

A telegram bot based on OneMap API

Primary LanguagePythonMIT LicenseMIT

SGNearMe Telegram Bot

Sometimes you just want to find the nearest supermarket to buy your grocery, or the nearest hawker centre to grab a quick lunch.

SGNearMe Telegram Bot allows you to easily find the 8 nearest places that you are looking for. You can search for the nearest preschools or even the nearest historical sites around you.

The bot is powered by OneMap, a service provided by Singapore Land Authority. The information are contributed and updated by various government agencies

The bot requires location services and can only be used on mobile devices.

Tools used

Usage

  1. Starting the bot - /start and select đź“ŤShare Location

  2. Selecting a category - /menu to manually bring up the categories menu

  3. Selecting a search query

  4. The nearest 8 related facilities will be shown. (Up to ~2.5km - using a 5km square bounding box)

  5. Show a OneMap map image (night mode) - /map
    Example map:

Installation

To get a local copy up and running follow these simple steps:

  1. Create a new bot and get the bot API token from @BotFather

    • Follow the instructions here for a detailed guide
  2. Register for OneMap API here

  3. Clone the repo

    git clone https://github.com/JinHao-L/SGNearMe.git
  4. Enter your API in config.py

    # Telegram bot token from BotFather
    BOT_TOKEN = "ENTER YOUR BOT API TOKEN"
  5. Enter your OneMap login details in config.py (for auto-updating of OneMap access token)

    # Login credentials for OneMap
    email = "ENTER YOUR ONEMAP LOGIN EMAIL"
    password = "ENTER YOUR ONEMAP LOGIN PASSWORD"

    Be careful not to push this config file onto a public platform

  6. Start the bot locally by running the python file on the command line

    python bot.py
  7. (optional) Update the DEVELOPER_CHAT_ID in bot.py by obtaining the id using update.message.chat.id

    • This is used for sending error message to the developer

Hosting on Heroku

Read up on Getting started on Heroku with Python or Deploying Telegram Bot using Heroku

License

Distributed under the MiT license. See LICENSE for more information