{ "info": { "author": "Nikita Harlov", "author_email": "nikita@harlov.com", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Topic :: Education" ], "description": "# telegraph_commander\nTelegram simple bot framework\n\n## 1. First, extend BaseBot class, and provide router and configuration:\n```python\nfrom telegraph_commander.logger import get_console_handler\nfrom telegraph_commander.bot import BaseBot\nfrom telegraph_commander.command import CommandRouter, BotCommand\nfrom telegraph_commander.config import BotConfig\n\n\n\nclass YourBotConfig(BotConfig):\n TELEGRAM_API_KEY = ''\n DEFAULT_COMMAND = 'menu'\n\n\nclass YourBot(BaseBot):\n router_class = CommandRouter\n config_class = YourBotConfig\n\nbot = YourBot()\n\n```\n\n## 2. Bind commands to router :\n```python\n@bot.router.command('menu')\nclass MenuCommand(BotCommand):\n async def run(self):\n await self.telegram_api.send_message(self.chat_id, 'Select action', variants=[['/mul']])\n\n\n@bot.router.command('mul')\nclass MulCommand(BotCommand):\n PARAMS = (\n dict(name='operand_1', title='first argument'),\n dict(name='operand_2', title='second argument')\n )\n async def run_handle(self):\n result = float(self.operand_1) * float(self.operand_2)\n await self.telegram_api.send_message(self.chat_id, 'result: {}'.format(result))\n```\n\n## 3. Add console logger handler(optional), and run your bot:\n```python\nbot.logger.addHandler(get_console_handler())\nbot.run()\n```", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/harlov/telegraph_commander/archive/v0.0.3.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/harlov/telegraph_commander", "keywords": null, "license": "MTI License", "maintainer": null, "maintainer_email": null, "name": "telegraph_commander", "package_url": "https://pypi.org/project/telegraph_commander/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/telegraph_commander/", "project_urls": { "Download": "https://github.com/harlov/telegraph_commander/archive/v0.0.3.tar.gz", "Homepage": "https://github.com/harlov/telegraph_commander" }, "release_url": "https://pypi.org/project/telegraph_commander/0.0.3/", "requires_dist": null, "requires_python": null, "summary": "Telegram Bot framework", "version": "0.0.3" }, "last_serial": 2343073, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "65c1c3f62fb5de0c64a0707f286772a2", "sha256": "95b170df31edd4b80f00846f10213c981676f31a6eea9303f752a6b9ace17317" }, "downloads": -1, "filename": "telegraph_commander-0.0.1.zip", "has_sig": false, "md5_digest": "65c1c3f62fb5de0c64a0707f286772a2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9964, "upload_time": "2016-09-11T22:21:21", "url": "https://files.pythonhosted.org/packages/17/fc/55f7eca6f46da2262a9c22e40707162366d33e409d272a8ebc03c89ad2dd/telegraph_commander-0.0.1.zip" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "f3a7af0988bb4fd67892867e3b0b6d0f", "sha256": "c8d6eecd9a38b6574b7f3db2617919a48c250624206b0222cd771a8f985bdabc" }, "downloads": -1, "filename": "telegraph_commander-0.0.2.zip", "has_sig": false, "md5_digest": "f3a7af0988bb4fd67892867e3b0b6d0f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11985, "upload_time": "2016-09-12T19:19:01", "url": "https://files.pythonhosted.org/packages/6b/5c/82cdfef39348059169fe18500001e9e7c1dcb7cbd2fabcbbe333301f4543/telegraph_commander-0.0.2.zip" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "586233c2c6c0801a1aa8c474c1c30298", "sha256": "643537f0ab6ffb7fff3fe60f91f06008e1847cdaef7d3e4445c5c9ec8acc760b" }, "downloads": -1, "filename": "telegraph_commander-0.0.3.zip", "has_sig": false, "md5_digest": "586233c2c6c0801a1aa8c474c1c30298", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12210, "upload_time": "2016-09-14T20:39:10", "url": "https://files.pythonhosted.org/packages/2c/16/d47cc989062a6bd4a655651b106e85c715cb106b3a9e34369a6160f1780c/telegraph_commander-0.0.3.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "586233c2c6c0801a1aa8c474c1c30298", "sha256": "643537f0ab6ffb7fff3fe60f91f06008e1847cdaef7d3e4445c5c9ec8acc760b" }, "downloads": -1, "filename": "telegraph_commander-0.0.3.zip", "has_sig": false, "md5_digest": "586233c2c6c0801a1aa8c474c1c30298", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12210, "upload_time": "2016-09-14T20:39:10", "url": "https://files.pythonhosted.org/packages/2c/16/d47cc989062a6bd4a655651b106e85c715cb106b3a9e34369a6160f1780c/telegraph_commander-0.0.3.zip" } ] }