umbrello-bot/README.md

87 lines
1.4 KiB
Markdown
Raw Normal View History

2019-08-26 17:19:52 +02:00
# umbrello-bot
An opensource telegram bot to know if you need to take the umbrella.
<img src="assets/screenshot.png" height="400">
**Technologies**:
- Node.js
- Telegraf.js
## Usage
2020-03-01 23:43:01 +01:00
**umbrello-bot** uses the [umbrello-api](https://github.com/franjsco/umbrello-api) to get weather information.
2019-08-26 17:28:43 +02:00
2019-08-26 17:19:52 +02:00
2019-08-26 17:21:53 +02:00
### 1. Search the city.
2019-08-26 17:19:52 +02:00
Search the city id with:
```
/search [city name]
```
*example: `/search Roma`*
It will send back the cities id.
2019-08-26 17:21:53 +02:00
### 2. Set the city.
2019-08-26 17:19:52 +02:00
Set the city wth:
```
/set [city id]
```
*example: `/set 3169070`. (3169070= Rome, IT)*
2019-08-26 17:21:53 +02:00
### 3. Get the forecasts.
2019-08-26 17:19:52 +02:00
Get the forecasts with:
```
/get
```
## Installation
2019-08-26 17:21:53 +02:00
### Step by step.
2019-08-26 17:19:52 +02:00
1. Install Node.js and npm.
2020-03-01 23:43:01 +01:00
2. Configure [umbrello-api](https://github.com/franjsco/umbrello-api).
2019-08-26 17:28:43 +02:00
3. Clone this repository.
4. Install dependencies with `npm install`.
5. Create a new bot with BotFather on Telegram
6. Create env file or set environment variables (read: "Environment variables")
7. Build the code with `npm run build`.
8. Launch the bot with `npm run serve`.
2019-08-26 17:19:52 +02:00
2019-08-26 17:21:53 +02:00
#### Environment Variables.
2019-08-26 17:19:52 +02:00
```
NODE_ENV=production
TELEGRAM_TOKEN=token-here
UMBRELLO_API_URL=url-here
DB_HOST=mongodb://host:port/db
DB_USER=user
DB_PASSWORD=pass
```
## Build Docker image
```
2019-08-26 17:47:47 +02:00
# cd umbrello-bot/
2019-09-05 18:46:16 +02:00
# docker build -t umbrello-bot .
# docker run umbrello-bot
2019-08-26 17:19:52 +02:00
```
## License
GPLv3
---
2020-03-01 23:43:01 +01:00
Made with ❤️ by Francesco Esposito ([@franjsco](https://github.com/franjsco))