Code Monkey home page Code Monkey logo

aqi-bot's Introduction

aqi-bot

Build Status

A minimal Telegram AQI notification bot

The latest version uses Cloud Firestore as the persistent storage backend. The original in-memory version can be found in the in-memory branch.

Set Up

You need to provide two environment variables:

  1. AQI_TOKEN
  2. BOT_TOKEN

And save your service account JSON keyfile from Google Cloud as keyfile.json in the root folder.

AQI token

Get your token from aqi.cn.

Bot token

Get your token from @BotFather

Cloud Firestore

This bot uses collection named subscriptions, and use the chat_id as key.

The free tier should be more than enough to cover the read/write from this bot. However, currently we haven't implemented anti-abuse mechanisms. Be extra careful if you've enabled billing for your project.

Docker

We provide a simple Dockerfile and sample docker-compose.yml for you to get started.

Public Demo Bot

@aqi_monitor_bot

Please do not abuse this service (excessive /set, /unset, or /get commands).

Usage

1. Find the nearest station

/find <lat> <lng>

find.png

2. Subscribe

Use the station id from /find. /set <station_id>

set

3. Unsubsribe

/unset

unset

Missing Features

1. Adaptive notification

Adjust behaviors according to the pollution level.

2. More robust schedule

Sometimes the update from an station can be delayed for more than 20 minutes(the maximum allowed delay in the current setting). Need a retry mechanism.

aqi-bot's People

Contributors

ceshine avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.