Code Monkey home page Code Monkey logo

menu_bot's Introduction

menuScraper

Bot telegram che scarica i menù dei due ristoranti che servono la facoltà di Informatica ad UniTo e li manda come messaggio agli studenti iscritti.

Preparazione

secrets

Creare un file secrets.json con la seguente struttura:

{
  "token": "",
  "db_username":"",
  "db_password":"",
  "db_host":"",
  "database":""
}

cookies

Creare un file cookies.json con la seguente struttura:

[
  {
        "Host raw": "https://.facebook.com/",
        "Name raw": "datr",
        "Path raw": "/",
        ....
  },
  {
        "Host raw": "https://.facebook.com/",
        "Name raw": "c_user",
        "Path raw": "/",
        ....
  },
  {
        "Host raw": "https://.facebook.com/",
        "Name raw": "xs",
        "Path raw": "/",
        ....
  }
]

credo che bastino solo questi tre cookie xs, c_user e datr, ma non nel dubbio usare una estensione per il browser che permetta di esportare tutti i cookie di un sito in un file json. [https://github.com/ysard/cookie-quick-manager]{cookie-quick-manager} disponibile per firefox e chrome.

database

modificare il metodo main del file bot.py specificando all'interno del comando create_engine il database che si vuole usare. Io ho utilizzato Mariadb, quindi mysql+pymysql

Docker

Il file docker-compose.yml crea due container: il bot in se ed il database a cui il bot si collegherà.

volendo si può modificare per andare ad utilizzare il database che si preferisce, basta che questo sia compatibile con SQLAlchemy e che ci si ricordi di specificare all'interno del comando create_engine nel file bot.py il database che si vuole usare.

menu_bot's People

Contributors

lory9894 avatar lorenzodipi avatar stefa168 avatar dependabot[bot] avatar

Stargazers

Rexus752 avatar

Watchers

 avatar  avatar

menu_bot's Issues

Menu Commands

Toglierei i comandi /doc e /dubai lasciando solo Start_Dubai/Doc e Stop_Dubai/Doc.
Quando una persona fa Start_... il programma controlla se in quella giornata è già stato mandato il menù del giorno, se si glielo manda appena si iscrive mentre se non l'ha ancora inviato gli si manda il messaggio "Sei stato inserito, appena possibile ti sarà inviato il menù", così che all'orario prefissato dallo scheduler lo manderà anche a lui normalmente.

Esempi(Scheduler parte alle 11):

  • Se mi iscrivo alle 9 mi aggiunge al DB e alle 11 mi manderà il menù come a tutti;
  • Se mi iscrivo alle 11:30 i menù sono stati già inviati quindi bisognerà mandare il menù solo a quella persona appena iscritta.

Stats

Aggiungere al metodo print_subscribers anche il numero di iscritti totali al bot

Credits, license e contribuzione

Sarebbe utile al primo avvio indicare oltre al funzionamento del bot da chi è fatto, come si può collaborare, ecc.

Bisogna anche decidere una licenza (GPL3?) e in tal caso indicare dove si trova il sorgente come la licenza richiede di fare...

Infine, anche un bottone e/o un comando potrebbe essere una buona idea per visualizzare nuovamente queste informazioni!

Opinioni?

File Admin

Aggiungere un file admin in cui scrivere tutti gli id di coloro che possono usare i comandi "riservati".
Quando si richiama un metodo riservato il programma controlla se l'id esiste in quel file, così da poter avere più facilità nell'aggiungere o togliere Admin

Missing jobs

Ogni tanto il bot pare non inviare i menù. Questo è il log

2023-11-28 10:33:51,572 - apscheduler.executors.default - WARNING - Run time of job "send_menus (trigger: cron[day_of_week='mon,tue,wed,thu,fri', hour='11', minute='30', second='0'], next run at: 2023-11-29 11:30:00 CET)" was missed by 0:03:51.572420

questa domanda su StackOverflow sembra essere la soluzione

fix /subscribers

il comando /subscribers non mostra il numero totale di iscritti, bensì solo chi è iscritto a dubai e doc

Annunci mirati

Aggiungere possibilità di fare annunci solo a chi è iscritto al doc o al dubai.

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.