{"id":17543143,"url":"https://github.com/vb64/telemulator3","last_synced_at":"2025-06-14T06:02:28.972Z","repository":{"id":153992999,"uuid":"631353300","full_name":"vb64/telemulator3","owner":"vb64","description":"Mocked Telegram Bot API elements for unit tests of a bot based on the pyTelegramBotAPI library.","archived":false,"fork":false,"pushed_at":"2024-05-07T18:24:32.000Z","size":90,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-25T08:41:46.601Z","etag":null,"topics":["telegram-bot-api","unit-testing"],"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/vb64.png","metadata":{"files":{"readme":"README.md","changelog":"history.txt","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":"2023-04-22T18:52:14.000Z","updated_at":"2025-04-21T22:05:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"82e47553-00c5-474b-97a0-0ca8ac751e0f","html_url":"https://github.com/vb64/telemulator3","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/vb64/telemulator3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vb64%2Ftelemulator3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vb64%2Ftelemulator3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vb64%2Ftelemulator3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vb64%2Ftelemulator3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vb64","download_url":"https://codeload.github.com/vb64/telemulator3/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vb64%2Ftelemulator3/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259768514,"owners_count":22908228,"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":["telegram-bot-api","unit-testing"],"created_at":"2024-10-21T00:23:01.439Z","updated_at":"2025-06-14T06:02:28.956Z","avatar_url":"https://github.com/vb64.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Library telemulator3\n\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vb64/telemulator3/pep257.yml?label=Pep257\u0026style=plastic\u0026branch=main)](https://github.com/vb64/telemulator3/actions?query=workflow%3Apep257)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vb64/telemulator3/py3.yml?label=pyTelegramBotAPI%204.11.0%20Python%203.7-3.11\u0026style=plastic\u0026branch=main)](https://github.com/vb64/telemulator3/actions?query=workflow%3Apy3)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/fe568012ee1649b89bafbb4de163a0c0)](https://app.codacy.com/gh/vb64/telemulator3/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade)\n[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/fe568012ee1649b89bafbb4de163a0c0)](https://app.codacy.com/gh/vb64/telemulator3/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_coverage)\n\nThe free, open-source telemulator3 library designed to simplify automatic testing of Telegram bots created using the [pyTelegramBotAPI library](https://github.com/eternnoir/pyTelegramBotAPI).\n\nThe telemulator3 library partially emulates the Telegram Bot API in unit tests and allows you to create typical scenarios for the interaction of your bot with the Telegram Bot API.\n\n## Installation\n\n```bash\npip install telemulator3\n```\n\n## Usage\n\nCreate TeleBot instance and start emulate Telegram API for bot.\n\n```python\nfrom telebot import TeleBot\nfrom telemulator3 import Telemulator\n\nbot = TeleBot('xxx-yyy-zzz', threaded=False)\n\n@bot.message_handler(commands=['start', 'help'])\ndef send_welcome(message):\n    bot.reply_to(message, \"Howdy, how are you doing?\")\n\ntelemul = Telemulator()\ntelemul.set_tested_bot(bot, username='my_bot', name='My Bot')\n```\n\nAt start, there are no registered users in emulated API.\n\n```python\nassert not telemul.api.users\n```\n\nMake API user, that represent our bot.\nIt's a first registered user.\n\n```python\nmybot = telemul.api.get_me()\nassert mybot.is_bot\nassert mybot.username == 'my_bot'\nassert len(telemul.api.users) == 1\n```\n\nNew user open private chat with bot and send `/start` command.\nBot must answer as defined and his answer must be in chat history.\n\n```python\nfrom telemulator3 import send_command\n\nuser = telemul.api.create_user('User')\nchat = user.private()\nsend_command(chat, '/start', user)\nassert chat.history.contain('Howdy, how are you doing?')\n```\n\nUser create group and add bot as member.\n\n```python\ngroup = user.create_group('My group')\ngroup.add_members(user, [mybot])\nassert group.history.contain('invite new members:')\n```\n\nAnd so on.\n\n```python\nmybot.leave(group)\nassert group.history.contain('My Bot (ID 1) left chat')\n# group.history.dump()\n```\n\n## Development\n\n```\ngit clone git@github.com:vb64/telemulator3\ncd telemulator3\nmake setup PYTHON_BIN=/path/to/python3\nmake tests\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvb64%2Ftelemulator3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvb64%2Ftelemulator3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvb64%2Ftelemulator3/lists"}