Giter Club home page Giter Club logo

comedoresugrbot's Introduction

ComedoresUGRbot

http://telegram.me/ComedoresUGRbot

Telegram bot to check the menu of Universidad de Granada dining hall. It works thanks to pyTelegramBotAPI and puppeteer.

Puppeteer is used to launch a headless Chrome browser, find menu tables and save them as png images. This implementation can be maintained more easily, because scu.ugr.es DOM has been changing a lot and parse the data in the tables seems to be more problematic. I made a request to them in order to get a simple JSON API for developers and they answered that they would consider it, but for the moment it's necessary to parse scu.ugr.es DOM one way or another.

Installation

First of all, you need Python 3 correctly installed on your machine. Then, run:

pip install -r requirements.txt

In some environments, you have to use pip3 instead of pip in order to install the packages for Python 3.

Also, you need to install all the necessary node dependencies to run the renderer. To do that, run:

npm install

In order to test the renderer, run the following command and be sure that all menu tables are being saved in ./images-new folder:

node renderer.js

Once you have installed all the dependencies, add your bot token in BOT_TOKEN environment variable. Optionally, you can configure a custom chromium browser path in BROWSER_PATH environment variable if you don't want to use the chromium browser bundled with puppeteer npm package.

When everything is properly configured, run the bot script:

python3 ComedoresUGRbot.py

All should work okay. Menu images are updated every hour.

Code licensed under GPLv3. See LICENSE file for more information.

comedoresugrbot's People

Contributors

alejandrocq avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

jvlianodorneles

comedoresugrbot's Issues

Remove subscriptions that don't work after some attempts

Checking the bot's logs I noticed that some subscriptions don't work anymore because the users probably blocked the bot or deleted the chat. In order to avoid this errors to show forever, some solution should be applied.

One possible way to do this is to add an attempt counter next to the chat id in the subscriptions file, and remove the subscriptions after 3 attempts.

Menú no disponible

Esta semana al intentar ver el menú de hoy jueves 3 de noviembre dice que no está disponible, cuando si lo está.

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.