Giter VIP home page Giter VIP logo

omnomnom's Introduction

OmNomNom

OmNomNom is a Telegram bot that can tell you what you can eat in some canteens in Berlin (Germany). I would like to support more canteens in other towns or countries in the future. If you have any suggestions let me now. You can invite the bot to a group or ask it directly.

How to use it

Usually you do not need to run the bot yourself. You can just talk to the @OmnBot in Telegram. Feel free to invite it to your groups.

Developer & Maintainer

  • Max Rosin

Contributer

Thanks to everyone who contributed code or documentation improvements to the bot.

  • Christian Beneke
  • Matthias Loibl

If you want to add canteens or features to the bot or want to fix some bug feel free to open a GitHub issue and start hacking :-) Pull Requests are very wellcome! If you found some problem or would like to see a new feature or more canteens but are not able (or do not want to / do not have the time) please also open an issue at GitHub and/or talk to me via Telegram (@ekeih).

License

A Telegram bot to get canteen information.
Copyright (C) 2016  Max Rosin

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

omnomnom's People

Contributors

ekeih avatar emily3403 avatar metalmatze avatar mhajoha avatar renovate[bot] avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

omnomnom's Issues

Personalkantine - wrong date on website -> no information for today

Hi,

today the date at the Personalkantine website is wrong: "026.02.2018"
A copy of todays website can be found in the attachments.
I had quick look at the code and have no idea how to fix this. But maybe someone else has one.
Additionally this maybe leads to an overlap when the menu for the 26.02.2018 is reed.
But I would assume that this will just be overwritten.

Website:
website.zip

News feature

Implement some way to inform users about new features, canteens or other updates.

Add EN canteen

EN canteen is a canteen on TU campus. I think it should be possible to use the parser of Personalkantine.

Write Tests

Currently the bot has exactly zero tests. As the codebase and the userbase grow it would be smart to write tests. 💡

Add Cafe Nero at TU Bibliothek

I don't know whether you are already parsing some PDF menus anywhere, but if so, it would be nice if you could add the Cafe Nero located at TU Universitätsbibliothek as well.

The link to the current day's menu is embedded into an iframe view of the PDF uploaded to Dropbox... Maybe you can work some magic here and extract the meals anyways.
Link to menu: http://cafenero.net/speisekarte/

Thanks for the awesome bot! :)

Substring matching for unknown canteens

When a user asks for an unknown canteen I want to check if the request matches some existing canteens and offer them to the user.

/tu_m

Did you mean:
/tu_mensa
/tu_marchstr

Create a README.md

This projects needs a readme file to explain what it does and how to set it up.

Allow ACCESS_TOKEN from ENV

It would be nice to allow to set the ACCESS_TOKEN as environment variable. This is useful to deploy OmNomNom in a docker container.

if env
  use env
else if
  use config.py
else
  throw error
fi

Improve documentation

Currently the bot is missing mostly everything you would expect from a well documented project.

If you are thinking about contributing code or just want to run the bot yourself, please let me know, so I can prioritize this issue ;-)

Show link to original website in case of error (or always)

It would be nice if the response of the bot would contain the original url that it tried to parse so the user can check it manually in case of any error happening during processing or if the user just wants to see the original thing.

Of course the URL should not be displayed fully. A link on the title of the response would suffice for successful responses and a more detailed description in case of an error.

Add all Studentenwerk canteens

The Berlin Studentenwerk has many canteens in Berlin. It would be nice to add all of them. It should be really easy.

#!/usr/bin/env python3

import bs4
import requests

HEADERS = {'user-agent': 'User-Agent: Mozilla'}
PARAMS = {'resources_id': 534}
URL = 'https://www.stw.berlin/xhr/speiseplan-und-standortdaten.html'


request = requests.post(URL, headers=HEADERS, data=PARAMS)

if request.status_code == requests.codes.ok:
    soup = bs4.BeautifulSoup(request.text, 'html.parser')
    listbox = soup.find('select', class_='listboxStandorte')
    options = listbox.findAll('option')

    for option in options:
        canteen = '%s : %s' % (option.attrs['value'], option.get_text())
        print(canteen)
534 : Mensa ASH Berlin Hellersdorf
535 : Mensa Beuth Hochschule für Technik Kurfürstenstraße
527 : Mensa Beuth Hochschule für Technik Luxemburger Straße
537 : Mensa Charité Zahnklinik
529 : Mensa EHB Teltower Damm
271 : Mensa FU Herrenhaus Düppel
322 : Mensa FU II Otto-von-Simson-Straße
528 : Mensa FU Lankwitz Malteserstraße
531 : Mensa HfM Charlottenstraße
533 : Mensa HfS Schnellerstraße
320 : Mensa HTW Treskowallee
319 : Mensa HTW Wilhelminenhof
147 : Mensa HU Nord
191 : Mensa HU Oase Adlershof
367 : Mensa HU Süd
270 : Mensa HU Spandauer Straße
526 : Mensa HWR Badensche Straße
532 : Mensa Katholische HS für Sozialwesen
530 : Mensa KHS Weißensee
321 : Mensa TU Hardenbergstraße
323 : Mensa Veggie N° 1 - Die grüne Mensa
368 : Cafeteria FU Ihnestraße
660 : Cafeteria FU Koserstraße
542 : Cafeteria FU Pharmazie
277 : Cafeteria FU Rechtswissenschaft
543 : Cafeteria FU Wirtschaftswissenschaften
723 : Cafeteria HfM „Neuer Marstall“
726 : Cafeteria HTW Treskowallee
659 : Cafeteria HU „Jacob und Wilhelm Grimm Zentrum“
539 : Cafeteria TU Ackerstraße
540 : Cafeteria TU Architektur
657 : Cafeteria TU „Skyline“
631 : Cafeteria TU Hardenbergstraße
541 : Cafeteria TU Hauptgebäude „Wetterleuchten“
538 : Cafeteria TU Marchstraße
722 : Cafeteria UdK „Jazz-Cafe“
658 : Cafeteria UdK Lietzenburger Straße
647 : Coffeebar Beuth Hochschule
648 : Coffeebar Beuth Hochschule Haus Grashof
1407 : Coffeebar EHB Teltower Damm
724 : Coffeebar HfM Charlottenstraße
725 : Coffeebar HTW Wilhelminenhof
661 : Coffeebar HU „c.t“
721 : Coffeebar HU Mensa Nord
720 : Coffeebar HU Oase Adlershof
727 : Coffeebar HWR Alt-Friedrichsfelde
728 : Coffeebar HWR Badensche Straße
649 : Coffeebar Mensa FU II
650 : Coffeebar Mensa Lankwitz
632 : Coffeebar TU Hardenbergstraße

Split studierendenwerk in more celery tasks

Currently every canteen is a task. Since #15 every canteen parses two weeks of menus. To avoid rate limits there are a lot of sleep($time) statements in the code which leads to long blocking tasks in the queue. (Some tasks have to wait more than twenty minutes...)

Solution: Create a single celery task for every canteen/date combination and apply a global rate limit for this type of task. The new tasks are smaller and need less time. Other tasks without (or with another limit) should be able to run between them.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

docker-compose
docker-compose.yml
dockerfile
Dockerfile
  • python 3.12-alpine
github-actions
.github/workflows/test-and-release.yml
  • actions/checkout v4
  • actions/setup-python v5
  • actions/checkout v4
  • docker/login-action v3
  • docker/metadata-action v5
  • docker/build-push-action v5
pip_requirements
requirements-dev.txt
  • flaky ==3.8.1
  • freezegun ==1.5.1
  • ipdb ==0.13.13
  • ipython ==8.24.0
  • pytest ==8.2.1
  • pytest-freezegun ==0.4.2
  • python-magic ==0.4.27
  • requests-mock ==1.12.1
  • tox ==4.15.0
  • twine ==5.1.0
  • wheel ==0.43.0
requirements.txt
  • beautifulsoup4 ==4.12.3
  • celery ==5.4.0
  • dateparser ==1.2.0
  • emoji ==2.12.1
  • fake-useragent ==1.5.1
  • influxdb ==5.3.2
  • parsedatetime ==2.6
  • python-telegram-bot ==21.2
  • redis ==4.6.0
  • requests ==2.32.2

  • Check this box to trigger a request for Renovate to run again on this repository

Add date support

Currently the bot only knows the menus of the current day. It would be nice to add support for something like this.

/mar tomorrow
/tel tuesday
/a 10.02.2017

This needs changes in every parser.

Streamline logging

Currently the bot is logging some messages into InfluxDB. This should be streamlined to be more useful.
Maybe I can implement it as a custom python logger.

Continuous Delivery

Currently a push to master only triggers a build at hub.docker.com but it needs manual interaction to get deployed. This could and should be automated.

Store menus as JSON

Currently every menu is stored as a single string in redis. Instead they should be stored as a JSON object. This adds some overhead when the bot responds to messages but it enables the possibility to implement other frontends like an Alexa skill or a general API.

Remove "Tip" message from response

F.ex. /march prints a tip message at the bottom:

Tipp: Wenn Sie dieses Fenster schließen, wird es nur erneut durch Leeren des Cache wieder angezeigt.

which has nothing to do with the list of meals. This text should be removed from the bot response.

Report invalid answers

Users should be able to report invalid answers to bring a broken parser to my attention.

Add Sing Catering

Sing Catering is a canteen on TU campus. We need an additional HTML parser for this.

Personalkantine breaks during the weekend

On saturday and sunday the parser tries to find a menu for the current week. But most of the time the menu of Personalkantine is updated for the next week on friday night. As a result the parser overwrites the entire menu of the current week with an error.

Change license to AGPL

Because the bot runs on a server, the GPL copyleft probably doesn't work. If you intended it to work, you should change your license to AGPL.

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.