{"id":13862553,"url":"https://github.com/MasterCruelty/robbot","last_synced_at":"2025-07-14T12:31:17.779Z","repository":{"id":39968294,"uuid":"323674929","full_name":"MasterCruelty/robbot","owner":"MasterCruelty","description":"My personal Telegram bot made in Python. It has several features and it's based on Pyrogram.","archived":false,"fork":false,"pushed_at":"2024-10-28T22:32:38.000Z","size":671,"stargazers_count":18,"open_issues_count":8,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-28T23:25:24.107Z","etag":null,"topics":["atm-milano","covid-19","geopy","matplotlib-pyplot","openai","openstreetmap-data","openweathermap-api","pyrogram","pyrogram-bot","python","scraping-python","telegram","tper","tper-autobus","trenitalia","trivial","weather-forecast","wikipedia","wttrin"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MasterCruelty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://www.paypal.me/mastercruelty"]}},"created_at":"2020-12-22T16:15:48.000Z","updated_at":"2024-10-28T22:32:41.000Z","dependencies_parsed_at":"2024-04-07T14:36:56.263Z","dependency_job_id":"aa0d8dcc-d383-4fd9-958d-04414d404e4f","html_url":"https://github.com/MasterCruelty/robbot","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MasterCruelty%2Frobbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MasterCruelty%2Frobbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MasterCruelty%2Frobbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MasterCruelty%2Frobbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MasterCruelty","download_url":"https://codeload.github.com/MasterCruelty/robbot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225974504,"owners_count":17553965,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["atm-milano","covid-19","geopy","matplotlib-pyplot","openai","openstreetmap-data","openweathermap-api","pyrogram","pyrogram-bot","python","scraping-python","telegram","tper","tper-autobus","trenitalia","trivial","weather-forecast","wikipedia","wttrin"],"created_at":"2024-08-05T06:01:47.264Z","updated_at":"2024-11-22T22:31:17.395Z","avatar_url":"https://github.com/MasterCruelty.png","language":"Python","readme":"[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=MasterCruelty_robbot\u0026metric=sqale_rating)](https://sonarcloud.io/dashboard?id=MasterCruelty_robbot)\n[![Quality Gate Pass](https://sonarcloud.io/api/project_badges/measure?project=MasterCruelty_robbot\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=MasterCruelty_robbot)\n[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=MasterCruelty_robbot\u0026metric=ncloc)](https://sonarcloud.io/dashboard?id=MasterCruelty_robbot)\n![License](https://img.shields.io/github/license/MasterCruelty/robbot)\n[![image](https://img.shields.io/github/stars/MasterCruelty/robbot)](https://github.com/MasterCruelty/robbot/stargazers)\n[![image](https://img.shields.io/github/forks/MasterCruelty/robbot)](https://github.com/MasterCruelty/robbot/network/members)\n![CodeSize](https://img.shields.io/github/languages/code-size/MasterCruelty/robbot)\n[![image](https://img.shields.io/github/issues/MasterCruelty/robbot)](https://github.com/MasterCruelty/robbot/issues)\n![image](https://img.shields.io/github/languages/top/MasterCruelty/robbot)\n![image](https://img.shields.io/github/commit-activity/w/MasterCruelty/robbot)\n![Image](https://badgen.net/github/release/MasterCruelty/robbot?label=Latest%20release)\n![GitHub commits since latest release (by date)](https://img.shields.io/github/commits-since/MasterCruelty/robbot/latest?color=44CC11\u0026style=flat-square)\n![image](https://img.shields.io/github/contributors/MasterCruelty/robbot)\n\n# Robbot\n**IT/ENG**\n\n#### \u003ci\u003eThis Telegram bot has the same structure of this [project](https://github.com/MasterCruelty/my-tg-app) which is an userbot I made for several features I needed.\u003cbr\u003eSo this bot has some commands in common with that userbot but also other new commands and obviously there aren't those commands that a bot can't execute but a userbot can. \u003cbr\u003e So if you're interested you can also visit that repository.\u003c/i\u003e\n\n** **\n# \u003cb\u003eFeel free to contribute and improve the project. \u003cbr\u003e See more details on How to contribute [here](https://github.com/MasterCruelty/robbot/blob/master/CONTRIBUTING.md).\u003cbr\u003e\nAfter the Italian section you will find an english version of the README. In \u003ccode\u003edoc\u003c/code\u003e folder you will find a bit of documentation of RobBot.\u003c/b\u003e\n\n# **[IT]**\n\n# Come impostare\n\nPer un corretto funzionamento è necessario compilare a dovere il file ```config.json```. Quindi è necessario essere in possesso dei seguenti dati:\n\n* Api keys di Telegram: ```api_id``` e ```api_hash```. Puoi generarle da [qui](https://my.telegram.org/apps)\n* Bot token: ```bot_token```. Puoi generarlo da [qui](https://t.me/BotFather)\n* Api url atm se si vogliono usare le loro api: ```api_url``` , ```api_get``` e ```cookie```. (Non essendo pubbliche non le condividerò)\n* Api key di OpenWeatherMap: ```api_weather```. Puoi generare la tua key dal sito principale di [OpenWeatherMap](https://openweathermap.org/)\n* Api di OpenAI: ```api_openai```. Puoi generare la tua key dal sito principale di [OpenAI](https://www.openai.com)\n* Unsplash Access Key: ```unsplash_key```. Puoi generare la tua personale creando un'applicazione su [unsplash.com](https://www.unsplash.com)\n* I dati telegram dell'amministratore del bot: ```id_super_admin```.\n* Il percorso dove si trova il file .db: ```path_db```.\n* Nome della sessione: ```session_name```.\n* I nomi dei comandi utente, admin e superadmin: ```user_commands```, ```admin_commands``` e ```super_admin_commands```.\n\nI dati del super admin servono a colui che potrà usare le funzioni di interazione con il database e altre funzioni particolari.\nI nomi dei comandi da inserire nel ```config.json``` possono essere ricopiati dal codice oppure possono essere modificati sul codice e poi ricopiati nel file json.\t\n\nSe siete su un'ambiente totalmente a linea di comando e vi accedete in ssh, consiglio il seguente comando per avviare il bot:\n```ruby\npython3 app.py 2\u003e\u00261 \u003e /dev/tty1 \u0026\n```\n\n### Come funzionano i comandi utente del bot\n\nIl funzionamento dei comandi utente è spiegato all'interno del file ```help.json```. Si tratta del file che viene usato dal bot per rispondere al comando ```/helprob \u003cnome comando\u003e```.\nLe spiegazioni sono in Italiano, ma volendo si possono tradurre in qualsiasi lingua sostituendo i campi della struttura dati oppure addirittura renderlo multilingua, ma in quel caso c'è da sviluppare la componente che rende possibile il cambio di lingua.\n\n### Come funzionano i comandi admin e super\n\n* registrare un nuovo utente: ```/setrobuser``` \u003cid_utente\u003e\n* registrare un nuovo admin: ```/setrobadmin``` \u003cid_utente\u003e \n* cancellare un utente: ```/delrobuser``` \u003cid_utente\u003e\n* revocare i privilegi admin: ```/delrobadmin``` \u003cid_utente\u003e (l'utente sarà comunque ancora tra i registrati ma senza i poteri admin)\n* mostrare tutti gli utenti registrati: ```/listrobuser```\n* mostrare il numero di utenti registrati: ```/allrobuser```\n* verificare se il bot è online: ```/pingrob```\n* registrare un nuovo gruppo come unico autorizzato a ricevere un certo comando: `/setgroup` \u003cid_gruppo\u003e \u003ccomando\u003e\n* cancellare un gruppo salvato: `/delgroup` \u003cid_gruppo\u003e\n* mostrare tutti i gruppi salvati: `/listgroup`\n* modificare un valore nelle statistiche di un utente per un certo comando: `/updatestat` \u003cid_utente\u003e 'comando' \u003cnuovo_valore\u003e\n* cancellare un comando dalle statistiche di un utente: `/delstat` \u003cid_utente\u003e 'comando'\n* Aggiornare i dati Telegram di un utente(nome e username): `/updaterobuser` \u003cid_utente\u003e (oppure dando lo username)\n* Aggiornare il credito di un utente per l'utilizzo di openai: `/amount` \u003cid_utente\u003e \u003cvalore\u003e\n* Visualizzare l'elenco degli utenti che hanno del credito di utilizzo per openai: `/allamounts`\n* Riavviare il bot direttamente da Telegram senza passare dalla shell: `/restart`\n* Inviare un messaggio a un utente registrato: `/say` \u003cusername\u003e ; 'messaggio'\n\n### Dipendenze\n\n* Pyrogram\n* tgcrypto\n* peewee\n* utils_config\n* geopy\n* bs4\n* wikipedia\n* pandas\n* matplotlib\n* openai\n* urbandictionary\n* pdf2image\n* pytube\n* flightradar24\n* FlightRadarAPI\n* pokebase\n* wikipediaapi\n\n### Progetti esterni usati\n\n* [Pyrogram](https://github.com/pyrogram/pyrogram)\n* [OpenWeatherMap](https://openweathermap.org/)\n* [Covid19 dati Italiani sui casi](https://github.com/pcm-dpc/COVID-19)\n* [Covid19 dati Italiani sui vaccini](https://github.com/italia/covid19-opendata-vaccini)\n* [Geopy](https://github.com/geopy/geopy)\n* [Wikipedia wrapper](https://github.com/goldsmith/Wikipedia)\n* [Another Wikipedia wrapper](https://github.com/martin-majlis/Wikipedia-API)\n* [Peewee](https://github.com/coleifer/peewee)\n* [wttr.in](https://github.com/chubin/wttr.in)\n* [OpenAI](https://www.openai.com)\n* [Urban Dictionary](https://www.github.com/bocong/urbandictionary-py)\n* [Tper open data](https://solweb.tper.it/web/tools/open-data/open-data.aspx)\n* [TrainMonitor per le API viaggiatreno](https://github.com/bluviolin/TrainMonitor) (Queste API non sono pubbliche, non abusate del servizio)\n* [Trenitalia-API di SimoDax per le API frecce.it](https://github.com/SimoDax/Trenitalia-API) (Queste API non sono pubbliche, non abusate del servizio)\n* [Piste Kart Italia(scraping)](https://www.pistekartitalia.it)\n* [Open Trivia Database](https://opentdb.com/)\n* [Sito pmi.it per calcolo stipendio netto in Italia(scraping)](https://www.pmi.it/servizi/292472/calcolo-stipendio-netto.html)\n* [Api Mathjs](http://api.mathjs.org)\n* [The cat api](https://api.thecatapi.com/v1/images/search)\n* [Dog ceo api](https://dog.ceo/api/breeds/image/random)\n* [Random fox api](https://randomfox.ca/floof/)\n* [Free LaTeX api](https://latex.codecogs.com)\n* [Free api per immagini randomiche](https://source.unsplash.com)\n* [Sito web di Passport Index(scraping)](https://www.passportindex.org/)\n* [Bollettini criticita idrogeologica di open data Sicilia](https://github.com/opendatasicilia/DPC-bollettini-criticita-idrogeologica-idraulica)\n* [Dati sui comuni italiani di open data Sicilia](https://github.com/opendatasicilia/comuni-italiani)\n* [Nasa apod API](https://github.com/nasa/apod-api)\n* [BGG API](https://boardgamegeek.com/wiki/page/BGG_XML_API2)\n* [flightradar24](https://github.com/mkorkmaz/flightradar24)\n* [FlightRadarAPI](https://github.com/JeanExtreme002/FlightRadarAPI)\n* [Joke API](https://sv443.net/jokeapi/v2/)\n* [PokeAPI Python wrapper](https://github.com/PokeAPI/pokebase)\n\n\n# **[ENG]**\n\n# How to setup\n\nThe correct way to setup this bot is to compile the file  ```config.json```. So it's necessary to have these data:\n\n* Telegram api keys: ```api_id``` e ```api_hash```. You can generate them [here](https://my.telegram.org/apps)\n* Telegram bot token: ```bot_token```. You can generate it from [here](https://t.me/BotFather)\n* Atm api url if you wanna use their api: ```api_url``` , ```api_get``` and ```cookie```. (The api are not public so I won't share them here)\n* OpenWeatherMap api key: ```api_weather```. You can generate your key from the [OpenWeatherMap website.](https://openweathermap.org/)\n* OpenAI api key: ```api_openai```. You can generate your key from the [OpenAI](https://www.openai.com) website.\n* Unsplash Access Key: ```unsplash_key```. You can generate yours by creating an application on [unsplash.com](https://www.unsplash.com)\n* Telegram data of the owner of the bot: ```id_super_admin```.\n* The path where is the .db file: ```path_db```.\n* The session name: ```session_name```.\n* Name of user commands, admin commands and super admin commands: ```user_commands```, ```admin_commands``` e ```super_admin_commands```.\n\nData of super admin is needed because he's the only one who can use db functions and other special functions.\nName of commands to put inside ```config.json``` can be copied from source code or renamed inside source code and then copied in json file.\t\n\n### How the user bot's commands works\n\nThe features of the user commands are explained inside ```help.json```. It is the file which is used by the bot to reply at ```/helprob \u003ccommand name\u003e```.\nThis json file is only in Italian, but you can translate it in every languages by changing the correct fields with your translations or even making the bot multi-language but in that case you have to develop the component for change the language runtime.\n\nIf you're in a command-line env and you access with ssh, I suggest the following command to start the bot:\n```ruby\npython3 app.py 2\u003e\u00261 \u003e /dev/tty1 \u0026\n```\n\n### How the admin/super commands works\n\n* register a new user: ```/setrobuser``` \u003cid_user\u003e\n* register a new admin: ```/setrobadmin``` \u003cid_user\u003e \n* delete a user: ```/delrobuser``` \u003cid_user\u003e\n* delete an admin: ```/delrobadmin``` \u003cid_user\u003e (it will just revoke the admin power, it doesn't delete the user)\n* How to list all user registered: ```/listrobuser``` \n* How to show ho many users are registered: ```/allrobuser```\n* check if the bot is online: ```/pingrob```\n* Save a new group to make it the only one authorized to receive a specific command: `/setgroup` \u003cid_group\u003e \u003ccommand\u003e\n* Delete a saved group: `/delgroup` \u003cid_group\u003e\n* Show all saved groups: `/listgroup`\n* Update a value in a user's stat for a specific command: `/updatestat` \u003cid_user\u003e 'command' \u003cnew_value\u003e\n* Delete a command from a user's stat: `/delstat` \u003cid_user\u003e 'command'\n* Update user's Telergam data(name and username): `/updaterobuser` \u003cid_user\u003e (or giving username)\n* Update the user's credit for openai usage: `/amount` \u003cid_user\u003e \u003cvalue\u003e\n* Show all user and their openai credit: `/allamounts`\n* Restarting the bot directly in Telegram without manually doing in shell: `/restart`\n* Sending a message to a registered user: `/say` \u003cid_user\u003e ; 'message'\n\n\n### Dependencies\n\n* Pyrogram\n* tgcrypto\n* peewee\n* utils_config\n* geopy\n* bs4\n* wikipedia\n* pandas\n* matplotlib\n* openai\n* urbandictionary\n* pdf2image\n* pytube\n* flightradar24\n* FlightRadarAPI\n* pokebase\n* wikipediaapi\n\n\n### External projects used\n\n* [Pyrogram](https://github.com/pyrogram/pyrogram)\n* [OpenWeatherMap](https://openweathermap.org/)\n* [Covid19 cases Italian data](https://github.com/pcm-dpc/COVID-19)\n* [Covid19 vaccine Italian data](https://github.com/italia/covid19-opendata-vaccini)\n* [Geopy](https://github.com/geopy/geopy)\n* [Wikipedia wrapper](https://github.com/goldsmith/Wikipedia)\n* [Another Wikipedia wrapper](https://github.com/martin-majlis/Wikipedia-API)\n* [Peewee](https://github.com/coleifer/peewee)\n* [wttr.in](https://github.com/chubin/wttr.in)\n* [OpenAI](https://www.openai.com)\n* [Urban Dictionary](https://www.github.com/bocong/urbandictionary-py)\n* [Tper open data](https://solweb.tper.it/web/tools/open-data/open-data.aspx)\n* [TrainMonitor for viaggiatreno API](https://github.com/bluviolin/TrainMonitor) (These API aren't public, don't abuse the service)\n* [SimoDax's wiki for frecce.it API](https://github.com/SimoDax/Trenitalia-API)  (These API aren't public, don't abuse the service)\n* [Piste Kart Italia(scraping)](https://www.pistekartitalia.it)\n* [Open Trivia Database](https://opentdb.com/)\n* [pmi.it website to calculate Italian net salary(scraping)](https://www.pmi.it/servizi/292472/calcolo-stipendio-netto.html)\n* [Api Mathjs](http://api.mathjs.org)\n* [The cat api](https://api.thecatapi.com/v1/images/search)\n* [Dog ceo api](https://dog.ceo/api/breeds/image/random)\n* [Random fox api](https://randomfox.ca/floof/)\n* [Free LaTeX api](https://latex.codecogs.com)\n* [Free api for random images](https://source.unsplash.com)\n* [Passport Index Web Site(scraping)](https://www.passportindex.org/)\n* [Open data about extreme forecast event by open data Sicilia](https://github.com/opendatasicilia/DPC-bollettini-criticita-idrogeologica-idraulica)\n* [Open data about italian municipalities by Open data Sicilia](https://github.com/opendatasicilia/comuni-italiani)\n* [Nasa apod API](https://github.com/nasa/apod-api)\n* [BGG API](https://boardgamegeek.com/wiki/page/BGG_XML_API2)\n* [flightradar24](https://github.com/mkorkmaz/flightradar24)\n* [FlightRadarAPI](https://github.com/JeanExtreme002/FlightRadarAPI)\n* [Joke API](https://sv443.net/jokeapi/v2/)\n* [PokeAPI Python wrapper](https://github.com/PokeAPI/pokebase)\n","funding_links":["https://www.paypal.me/mastercruelty"],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMasterCruelty%2Frobbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMasterCruelty%2Frobbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMasterCruelty%2Frobbot/lists"}