{"id":27633168,"url":"https://github.com/archetipico/telegrambot","last_synced_at":"2025-08-21T19:22:11.832Z","repository":{"id":204425500,"uuid":"710339641","full_name":"archetipico/TelegramBot","owner":"archetipico","description":"Telegram bot","archived":false,"fork":false,"pushed_at":"2024-03-04T23:39:14.000Z","size":37584,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-23T18:13:53.100Z","etag":null,"topics":["clearurls","deployable","image-manipulation","image-processing","ocr","python","solver","telegram","telegram-bot","tts","weather"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/archetipico.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2023-10-26T13:54:52.000Z","updated_at":"2024-07-26T09:18:08.000Z","dependencies_parsed_at":"2023-11-20T18:31:14.339Z","dependency_job_id":"f659d994-da64-4f14-936a-9134a130b85e","html_url":"https://github.com/archetipico/TelegramBot","commit_stats":null,"previous_names":["archetipico/telegrambot"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archetipico%2FTelegramBot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archetipico%2FTelegramBot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archetipico%2FTelegramBot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archetipico%2FTelegramBot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/archetipico","download_url":"https://codeload.github.com/archetipico/TelegramBot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250487534,"owners_count":21438612,"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":["clearurls","deployable","image-manipulation","image-processing","ocr","python","solver","telegram","telegram-bot","tts","weather"],"created_at":"2025-04-23T18:14:00.576Z","updated_at":"2025-04-23T18:14:01.190Z","avatar_url":"https://github.com/archetipico.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ORB TelegramBot\nDo you want to check the weather? Roll a die? Need text-to-speech or just want to have some fun? This is the bot for you!\n\nSet up your own instance by following the step-by-step instructions in the [installation guide](https://github.com/archetipico/TelegramBot#installation).\n\n# Commands\nLegend for the following guide:\n- `#` highlights the command in the list of commands\n- `|` serves as a separator between commands, to be understood as OR\n- `\u003c...\u003e` indicates the need to insert a specific type of data\n- `[...]` is used for optional arguments\n- `\u003e` represents the concept of the executed command\n- `!` is for comments\n\nYou don't need to include these symbols in the command; they are only used as markdown for this guide. Therefore, if, for example, you want to execute the command to clean a link, just type `clr` , and not `# clr`, or in the case without JavaScript, `clr -js`.\n\n```markdown\n# /help\nHelp\n\u003e /help                     ! Remember that it's the only command with a slash\n\n# 8ball [\u003ctext\u003e]\nShake a Magic 8 Ball in response to a text or by asking a question afterward\n\u003e 8ball\n\u003e 8ball Will tomorrow be a nice day?\n\n# canny [-m] [\u003cmin\u003e \u003cmax\u003e]\nHighlight the edges within photos\n\u003e canny                     ! Set to (50, 150) by default\n\u003e canny -m                  ! Mask image\n\u003e canny 60, 120\n\u003e canny -m 10, 100\n\n# clr [-js]\n(CLeaR) Cleanse the dirty URLs\n\u003e clr                       ! No more trackers\n\u003e clr -js                   ! No more JavaScript\n\n# color \u003chex\u003e\nConvert the hexadecimal color code into the actual color name\n\u003e color 00ff44\n\n# cpt [-f] \u003cup\u003e, \u003cdown\u003e\n(CaPTion) Create captions on images (PNG or JPEG), on GIFs and on videos\n\u003e cpt top, bottom           ! Classic\n\u003e cpt top text,             ! Top only\n\u003e cpt , bottom text         ! Bottom only\n\u003e cpt ,                     ! No effect\n\u003e cpt                       ! No effect\n\u003e cpt -f                    ! Make the media faster\n\u003e cpt -f top, bottom        ! Also make the media faster\n\n# detect\nBasic neural network to detect objects (80 distinct) and faces (underlined in green) in images\n\u003e detect                    ! It could take a while\n\n# info\nInformations about a message\n\u003e info\n\n# kanji\nReturn a random kanji (Note: kanji symbols are added gradually as I learn them)\n\u003e kanji                     ! 果\n\n# malus [show|\u003cuser\u003e]|[add|rm \u003cmalus\u003e]\nApply a random event to yourself or to a user by responding to their message or by tagging them\n\u003e malus\n\u003e malus add New malus I think is funny\n\u003e malus add earns [2:10] XP\n\u003e malus rm malus old malus I don't need anymore\n\u003e malus show\n\u003e malus @johndoe\n\u003e malus John Doe\n\n# manuser add|rm\nAnswer to a user's message to add or remove them from the allowed users list\n** Note: only superadmins can use this feature **\n\u003e manuser add               ! Respect gained\n\u003e manuser rm                ! Respect lost\n\n# ocr [\u003clanguage\u003e]|[-l]\nGiven an image return the Optical Character Recognition\n\u003e ocr\n\u003e ocr chi_sim               ! Chinese simplified\n\u003e ocr it+fra                ! Italian and French\n\u003e ocr -l                    ! List all the supported languages\n\n# oled [\u003cwhite\u003e]\nAnswer to an image to adapt it to an OLED screen: the `white` threshold defines when a pixel should be considered white\n\u003e oled                      ! Set to 127 by default\n\u003e oled 90\n\u003e oled 3280                 ! Modulo 256\n\n# paint [\u003cval\u003e]\nPaint effect on an image, GIF or MP4, possibly using a reference value \u003cval\u003e\n\u003e paint                     ! Set to 5 by default\n\u003e paint -1                  ! Passed to modulo 10\n\n# palette [\u003cn\u003e]\nUse it in response to a photo to receive the color palette used in the image\n\u003e palette                   ! Set to 5 by default\n\u003e palette 3\n\u003e palette 40                ! 1..10 is okay but this is passed as 5 (default)\n\n# pixel [\u003cval\u003e]\nPixelate an image\n\u003e pixel                     ! Set to 50 by default\n\u003e pixel 5\n\u003e pixel 150                 ! Modulo 100\n\n# rgx \u003cregex\u003e, \u003ctesto\u003e\n(ReGeX) Given a regex, apply a text substitution\n\u003e rgx [a-zA-Z].+, xyzzy\n\n# relief [\u003cn\u003e \u003ck\u003e]\nShow relief on images\n\u003e relief                    ! Set to (30 2) by default\n\u003e relief 15 4\n\n# rev [-l]\n(REVerse) Invert video and audio of GIF, MOV, MP3, MP4, OGG, WEBM (commonly animated stickers on Telegram) and various formats files\n\u003e rev\n\u003e rev list                  ! List all the supported formats\n\n# roll [\u003cn\u003e]\nRoll a \u003cn\u003e-sided die\n\u003e roll                      ! Set to 6 by default\n\u003e roll 20                   ! DnD gamers rise up\n\u003e roll 30                   ! It seems they exist\n\u003e roll -1                   ! You will be mocked\n\n# scale [\u003cval\u003e]\nScale an image, GIF or MP4 using the Liquid Rescaling technique, possibly using a reference value \u003cval\u003e\n\u003e scale                     ! Set to 50 by default\n\u003e scale 25\n\u003e scale 1                   ! Goodbye\n\u003e scale -1                  ! 1..100 is okay but this is passed as 50 (default)\n\n# solve \u003cmath\u003e\nSolve anything in mathematical language\n\u003e solve 1 + 1\n\u003e solve 6 feet to m\n\u003e solve 1/(x^2+2x−3) to partial fraction\n\u003e solve life issues         ! Unfortunately we must solve our own problems\n\n# stats [self]\nShow commands usage: \"Failure\" does not refer to the person using the command\n\u003e stats\n\u003e stats self                ! Your statistics\n\n# strip [-l]\nRemove metadata and attempt to reduce the size of specific files\n\u003e strip\n\u003e strip -l                  ! List all the supported formats\n\n# tts [\u003clanguage\u003e [\u003ctext\u003e]]|[-l]\n(Text-To-Speech) Read the \u003ctext\u003e in the selected language (when responding to a message, \u003ctext\u003e is the message being replied to)\n\u003e tts                       ! Set to 'en' by default\n\u003e tts -l                    ! List all the supported languages\n\u003e tts it Ciao gente         ! Hello\n\n# urb \u003csearch\u003e\nSearch on the Urban Dictionary\n\u003e urb most deranged thing ever\n\n# wtr \u003clocation\u003e\n(WeaTheR) Given a location, provide real-time and highly detailed weather information\n\u003e wtr London\n\u003e wtr 東京\n\u003e wtr unknown place         ! 99.9% of the time it finds it\n\u003e wtr my fav pub            ! If it's in the database it will find that too\n\n# xkcd\nClassic nerd puns\n\u003e xkcd\n```\n\n# Installation\n## Preamble\nAs a first step, it is necessary to generate the files that will contain the information required for the correct operation of the bot. When possible, the required software will also be installed, as listed at the end of the README. Below you will find a guide for Linux users and a guide for Windows users. Regardless of your operating system, the execution should be successful; if not, feel free to open an issue.\n\n### Linux\n- Make sure you have `wget` installed (run `wget --version`)\n- In the main folder, you will find `preamble.sh`\n- Execute `chmod 755 preamble.sh`\n- Then run `./preamble.sh` to download the necessary files\n\n### Windows\nNote:\nIn addition to the required software [Chocolatey](https://chocolatey.org/) will also be installed.\n- Open a PowerShell terminal as an administrator\n- Remember that you may need to run `Set-ExecutionPolicy RemoteSigned`\n- In the main folder, you will find `preamble.ps1`\n- Execute `.\\preamble.ps1` to download the necessary files and install the required dependencies\n\n## Key generation\n- Register on [OpenWeatherMap](https://openweathermap.org) and obtain a free API key\n- Generate a key for a Telegram bot by contacting [@BotFather](https://t.me/BotFather)\n- Go into the subfolder `./orders/utility` and modify the `secrets` file\n- The first line of the file should be the OpenWeatherMap key\n- The second line of the file should be the Telegram key\n- Leave an empty line at the end as per the standard so that running `cat secrets` does not have an extra newline but also doesn't cause the terminal line to wrap\n- For example, the file should look like this:\n```markdown\nOWM-KEY\nTELEGRAM-KEY\n\n```\n- The `cat secrets` command should then display the following:\n```markdown\n[user@machine]:~/TelegramBot/orders/utility $ cat secrets\nOWM-KEY\nTELEGRAM-KEY\n[user@machine]:~/TelegramBot/orders/utility $\n```\n\nNote:\nIt may not be necessary to insert an empty line at the end of the text; it depends on many factors. However, remember this convention for the following steps as it is essential for the correct reading and writing of files.\n\n## Populate administrative files\n- Go into the subfolder `./orders/utility` and modify the `superadmins` file\n- Insert your Telegram user ID following the previous text formatting convention\n- If you don't know your Telegram user ID, you can write a short line of code inside `bot.py` to print your user ID, as follows:\n```python\n# You can find this function inside bot.py and write it at the first line\nasync def msg_filter( ... ):\n    print(update.effective_chat.id)\n```\n- Now, send a message to the bot privately, and it will print your ID to the terminal. Alternatively, you can contact a bot like `@userinfobot` (I haven't tested it, but it's commonly suggested)\n- Once you have obtained your ID and added it to `superadmins`, add your ID to `admins` as well, following the convention\n- If you want to allow other users to use your bot, you can do so by adding the bot to a group with the interested user and by typing `manuser add` in response to a message from the user you want to promote\n\n## Python dependencies\n- The bot has been programmed with `Python 3.9.2`\n- Install the requirements found in `requirements.txt`\n- Execute `pip install \"python-telegram-bot[job-queue]\"`\n- Execute `pip install \"python-telegram-bot[http2]\"`\n\n## Other dependencies to install\nBelow is the list of software necessary to use the bot commands, all installable from the command line. Depending on the OS, some of them are already installed.\n#### Linux\n- [ExifTool](https://exiftool.org/)\n- [FFmpeg](https://ffmpeg.org/)\n- [Ghostscript](https://www.ghostscript.com/)\n- [ImageMagick](https://imagemagick.org/)\n- [jpegoptim](https://github.com/tjko/jpegoptim)\n- [OptiPNG](https://optipng.sourceforge.net/)\n- [Qalculate](https://qalculate.github.io/)\n- [Tesseract](https://tesseract-ocr.github.io/)\n#### Windows\n- [Tesseract](https://tesseract-ocr.github.io/)\n\n## Execution\nYou can run the bot by executing `python bot.py` from the terminal. Alternatively, if you want the bot to start on machine startup (on Linux), type `crontab -e` and insert the following text string:\n```bash\n@reboot python ~/your_path/TelegramBot/bot.py \u003e ~/your_path/TelegramBot/out 2\u003e\u00261\n```\n\n# Third-party software used\nHere is the list of projects used, many thanks to them:\n- API calls\n  - https://openweathermap.org\n  - https://operations.osmfoundation.org\n- Non-API calls\n  - https://www.colorhexa.com\n  - https://www.urbandictionary.com\n  - https://xkcd.com\n- Software\n  - https://exiftool.org/\n  - https://ffmpeg.org/\n  - https://www.ghostscript.com/\n  - https://github.com/AlexeyAB/darknet/\n  - https://github.com/ClearURLs/Rules - personal version\n  - https://github.com/jcsirot/kanji.gif/\n  - https://github.com/scour-project/scour\n  - https://github.com/tjko/jpegoptim\n  - https://imagemagick.org/\n  - https://optipng.sourceforge.net/\n  - https://qalculate.github.io/\n  - https://tesseract-ocr.github.io/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchetipico%2Ftelegrambot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farchetipico%2Ftelegrambot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchetipico%2Ftelegrambot/lists"}