Skip to content

Commit 729a28d

Browse files
authored
Merge pull request #1 from dpeite/develop
Develop
2 parents 937a29f + 2223847 commit 729a28d

File tree

6 files changed

+259
-32
lines changed

6 files changed

+259
-32
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Daniel Vilar
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Vitrasa Telegram Bot
2+
3+
Es un bot de Telegram en el que consultar el tiempo aproximado de llegada de los autobuses en la ciudad de Vigo, puedes añadir el bot a telegram a traves de este enlace [VitrasaBot](http://t.me/vitrasabot)
4+
5+
Su funcionamiento es sencillo, solo tendremos que indicarle el numero de parada o buscar entre las paradas más proximas. Además también es posible enviar una ubicación para obtener los horarios de la parada más cercana.
6+
7+
Por otro lado también es posible guardar las paradas favoritas para poder acceder de forma mas sencilla a ellas.
8+
9+
### Capturas de pantalla
10+
![](https://i.imgur.com/qsQnmaL.png)
11+
![](https://i.imgur.com/KF1XGqB.png)
12+
13+
## Instalación
14+
15+
El bot está programado en python y utiliza MongoDB como base de datos, hace uso de las siguientes librerias [pyTelegramBotAPI](https://github.com/eternnoir/pyTelegramBotAPI), [Time for Vbus API](https://github.com/dpeite/time-for-vbus-api/tree/updates_for_telegram), [pymongo](https://api.mongodb.com/python/current/), y [Suds](https://bitbucket.org/jurko/suds)
16+
17+
Existen dos variantes del bot, una versión normal usando pyTelegramBotAPI y pymongo. Y otra versión pensada para usar en Google App Engine, que usa una versión modificada de pyTelegramBotAPI y de este propio bot, webhooks y pymongolab debido a las limitaciones de GAE.
18+
19+
Para cada variante existe una rama, [master](https://github.com/dpeite/VitrasaTelegramBot/tree/master) es la version normal. Mientras que [master_appengine](https://github.com/dpeite/VitrasaTelegramBot/tree/master_appengine) es la version para Google App Engine.
20+
21+
### Versión normal
22+
23+
Para poder ejecutar esta versión es necesario realizar los siguientes pasos:
24+
```bash
25+
git clone https://github.com/dpeite/VitrasaTelegramBot.git
26+
cd VitrasaTelegramBot
27+
git submodule init
28+
git submodule update --remote
29+
cd api
30+
sudo pip install -r requirements.txt
31+
cd ..
32+
sudo pip install -r requirements.txt
33+
```
34+
35+
Una vez hecho los pasos anteriores debemos añadir en el codigo nuestro token de autenticación y la ruta de nuestro mongo en el fichero `Vitrasa.py`:
36+
37+
```python
38+
token = "Añadir aquí el token que nos proporciona BotFather"
39+
...
40+
client = MongoClient("mongodb://url_mongo")
41+
```
42+
43+
Ahora ya estamos listos para lanzar nuestro bot:
44+
```bash
45+
python Vitrasa.py
46+
```
47+
48+
### Versión para Google App Engine
49+
50+
Esta versión tiene unos cuantos tweaks para poder funcionar correctamente sobre la nube de Google. Para ello hemos tenido que modificar [pyTelegramBotAPI](https://github.com/dpeite/pyTelegramBotAPI-for-Google-App-Engine) para que no use la libreria requets, en la liberia [Time for Vbus API](https://github.com/dpeite/time-for-vbus-api/tree/updates_for_telegram_appengine) hemos tenido que desactivar la cache, y por ultimo en vez de utilizar pymongo usamos pymongolab ya que es casi obligatorio usar mongo hosteado desde [mlab](https://mlab.com).
51+
52+
Para poder ejecutar esta versión es necesario realizar los siguientes pasos:
53+
1. Clonar e inicializar el proyecto
54+
```bash
55+
git clone https://github.com/dpeite/VitrasaTelegramBot.git
56+
cd VitrasaTelegramBot
57+
git checkout master_appengine
58+
git submodule init
59+
git submodule update --remote
60+
```
61+
2. Descargar las librerias necesarias a la carpeta `lib`
62+
```bash
63+
sudo pip install -r requirements.txt -t lib
64+
```
65+
3. Generar los certificados necesarios. (Mas info en el fichero `Vitrasa.py`)
66+
4. Subir la app a Google App Engine
67+
5. Una vez subida la app ir a la url del proyecto, de esta forma activamos el webhook. Ej: https://vbot.appspot.com/

0 commit comments

Comments
 (0)