{"id":38256689,"url":"https://github.com/alesanmed/python-telegram-bot-seed","last_synced_at":"2026-01-17T01:32:07.994Z","repository":{"id":43188782,"uuid":"142068893","full_name":"alesanmed/python-telegram-bot-seed","owner":"alesanmed","description":"Skeleton project for implementing bots in Python using the module python-telegram-bot","archived":false,"fork":false,"pushed_at":"2024-07-21T06:56:07.000Z","size":256,"stargazers_count":35,"open_issues_count":0,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-07-21T07:48:52.377Z","etag":null,"topics":["python-3","python-telegram-bot","python3","seed-project","telegram-bot","telegram-bot-api"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alesanmed.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,"publiccode":null,"codemeta":null}},"created_at":"2018-07-23T21:00:31.000Z","updated_at":"2024-07-21T06:56:04.000Z","dependencies_parsed_at":"2024-07-21T07:46:13.530Z","dependency_job_id":null,"html_url":"https://github.com/alesanmed/python-telegram-bot-seed","commit_stats":null,"previous_names":[],"tags_count":1,"template":true,"template_full_name":null,"purl":"pkg:github/alesanmed/python-telegram-bot-seed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alesanmed%2Fpython-telegram-bot-seed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alesanmed%2Fpython-telegram-bot-seed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alesanmed%2Fpython-telegram-bot-seed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alesanmed%2Fpython-telegram-bot-seed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alesanmed","download_url":"https://codeload.github.com/alesanmed/python-telegram-bot-seed/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alesanmed%2Fpython-telegram-bot-seed/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28491592,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T00:50:05.742Z","status":"ssl_error","status_checked_at":"2026-01-17T00:43:11.982Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["python-3","python-telegram-bot","python3","seed-project","telegram-bot","telegram-bot-api"],"created_at":"2026-01-17T01:32:07.893Z","updated_at":"2026-01-17T01:32:07.972Z","avatar_url":"https://github.com/alesanmed.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Telegram.com bot in Python - Seed Project\n\n- [Introduction](#introduction)\n- [Project structure](#project-structure)\n- [Let's begin](#lets-begin)\n- [First things first](#first-things-first)\n- [Create a Telegram bot](#create-a-telegram-bot)\n- [Installing dependencies](#installing-dependencies)\n- [Edit config file](#edit-config-file)\n- [Begin implementing your commands](#begin-implementing-your-commands)\n- [Feedback and new ideas](#feedback-and-new-ideas)\n\n## Introduction\n\nThis bot is a template for telegram bots in Python. The goal is to facilitate and speed up the bot developing process.\n\nThis project has been developed using Python 3.7 and assumes that you use [Poetry](https://python-poetry.org/) as the dependency manager.\n\nThe project uses [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot) as the underlying technology.\n\nThe project also allows you to deploy the bot as a webhook or polling bot.\n\n## Project structure\n```bash\n.\n├── assets\n├── bot\n│   └── start.py\n├── configurations\n│   └── settings.py\n├── connectors\n│   └── __init__.py\n├── logs\n│   └── seed_bot.log\n├── utils\n│   └── logger.py\n├── LICENSE\n├── main.py\n├── pyproject.toml\n├── poetry.lock\n└── README.md\n```\n\nLet's see how this project is structured:\n- assets: All your assets files such as icons, images, audio and video files, etc.\n- bot: All your bot [command](#begin-implementing-your-commands) files.\n- configurations: All of your bot configuration files.\n- connectors: Any connectors your bot will need (such as databases, APIs, etc.)\n- logs: Just the logs folder.\n- utils: Bot utils files. For example, files containing sets of helper functions.\n- LICENSE: Just the license file. You may want to change it for your project.\n- main.py: The project entry point.\n- pyproject.toml and poetry.lock: Dependencies files used by poetry.\n- README.md: This file.\n\n## Let's begin\n\n## First things first\nFirst of all, clone this repository and remove the .git folder. Now you can begin developing your bot in your repo.\n\n## Create a Telegram bot\n\nFirst, create a bot for having a *token*. You can register your bot by following the instructions at [Telegram.org](https://core.telegram.org/bots#3-how-do-i-create-a-bot) (you can read the guide for learning a bit more about bots and everything about what can they do for you).\n\n**NOTE**: Even if you want to deploy your bot as a webhook, you don't have to register it via Telegram API because python-telegram-bot and this project will do it for you.\n\n**Important:** you have to take into account two things:\n1. Your domain **has to be https**. Telegram does not allow bots in non-https environments. The good news is that you can use a self-signed certificate. You can also use a free [letsencrypt](https://letsencrypt.org/) certificate.\n2. In this guide, we assume that you have your bot listening in `https://example.com/YOUR:BOT_TOKEN` rather than just in `https://example.com/`. That's because we believe that making your bot listen in just a domain leaves it *open* to anyone so anyone can send your bot fakes updates. This guide also assumes that your server allows you to deploy an arbitrary number of bots on the same domain, e.g. having one bot on `https://example.com/path/to/bot1` and another on `https://example.com/path/to/bot2`... If this is not your case, you can also use this project for deploying only one bot per domain (or IP) as well as per allowed port. Remember that as [setWebhook](https://core.telegram.org/bots/api#setwebhook) documentation says, it currently supports only 80, 443, 88, and 8443 ports. This allows you to deploy up to four bots per domain without a reverse proxy.\n\n## Installing dependencies\n\nNow that you (surely) have poetry installed, run\n```bash\npoetry install\n```\nfrom the project directory\n\n## Edit config file\n\nThe default config file placed at `configurations/settings.py` has the following default content:\n```python\nTOKEN = \"bot:Token\"\nNAME = \"seed_bot\"\nWEBHOOK = False\n## The following configuration is only needed if you setted WEBHOOK to True ##\nWEBHOOK_OPTIONS = {\n    'listen': '0.0.0.0',  # IP\n    'port': 443,\n    'url_path': TOKEN,  # This is recommended for avoiding random people\n                        # making fake updates to your bot\n    'webhook_url': f'https://example.com/{TOKEN}'\n}\n```\n\n- **TOKEN**: Your bot's token. You have to edit this and put the token BotFather gave to your bot.\n- **NAME**: Your bot's name. Optional. Identifies your bot in places like the log file.\n- **WEBHOOK**: If set to True, you have to edit the other configuration options for making a full-working webhook bot. If you want to deploy a standard bot that automatically polls to the Telegram [getUpdates](https://core.telegram.org/bots/api#getupdates) method, leave it to False.\n- **IP**: The IP your bot will be listening to. Usually, you'll leave it a 0.0.0.0 as your bot will be listening on localhost.\n- **PORT**: The port your bot will be listening to. If you don't have a reverse proxy you'll leave it to 443 (or any other supported port like 80, 88, or 8443). If you have a reverse proxy, you'll change it to the port you want your bot to listen to. After that, you have to configure your reverse proxy to redirect all incoming traffic from https://example.com/TOKEN to IP:PORT.\n- **URL_PATH**: The path you set in the setWebhook call. I recommend leaving it equal to your bot's token, but you can change it if you want.\n- **WEBHOOK_URL**: Your full webhook URL. Usually, you'll just edit the domain name. But you can edit the full URL if you want.\n\n## Begin implementing your commands\nImplementing new commands is easy, but you might want to look at the [python-telegram-bot documentation](https://python-telegram-bot.org/).\n\nNow that you are an expert at python-telegram bot, let's see how to implement new commands.\n\nYou have to create a file that will hold all your command functionality. Let's take a closer look at this process.\n\nImagine you want to implement a `start` command. First, create your command file in the `bot/` directory. It is not required, but we recommend to name the file as your command. As the command would be `start` is a good idea to name the file `start` too, i.e. `bot/start.py`. This file will hold all of your command code. The only requirement is that your command file has to implement **at least** an `init` function. So the second thing you have to do is implement your command logic.\n\nAll main functions from command files receive the same argument, the *dipatcher*. This way, you can implement any type of command. I'll give you an example for the *start* command:\n\n```python\ndef init(dispatcher: Dispatcher):\n    \"\"\"Provide handlers initialization.\"\"\"\n    dispatcher.add_handler(CommandHandler('start', start))\n\n\ndef start(update: Update, context: CallbackContext):\n    \"\"\"Process a /start command.\"\"\"\n    update.message.reply_text(text=\"I'm a bot, please talk to me!\")\n\n```\n\nAnd you're done. Next time you launch your bot, it'll respond to the `/start` command.\n\n\n## Feedback and new ideas\nFeel free to give me some feedback or new ideas to improve the project. If you have any suggestions please feel free to create an [issue](https://github.com/alesanmed/python-telegram-bot-seed/issues) and tag it as `enhancement`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falesanmed%2Fpython-telegram-bot-seed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falesanmed%2Fpython-telegram-bot-seed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falesanmed%2Fpython-telegram-bot-seed/lists"}