{ "info": { "author": "Arseniy Timonik", "author_email": "timonik.bss@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Build Tools" ], "description": "# vkbottle\nNew VK bot-engine repo with **decorators** like in famous framework flask!\n\n[![PyPI](https://badge.fury.io/py/vkbottle.svg)](https://pypi.org/project/vkbottle/) \n[![VK Chat](https://img.shields.io/badge/Vk-Chat-blue)](https://vk.me/join/AJQ1d7fBUBM_800lhEe_AwJj) \n[![Build Status](https://travis-ci.com/timoniq/vkbottle.svg?branch=master)](https://travis-ci.com/timoniq/vkbottle)\n\n##### README VERSIONS: \n* [\u0420\u0443\u0441\u0441\u043a\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f](https://github.com/timoniq/vkbottle/blob/master/RU-README.md)\n\n\n## Install\n\nTo install use terminal command: \n`pip install vkbottle` or \n `pip3 install vkbottle` \n \n Supported Python versions: \n * Python 3.5\n * Python 3.6\n * Python 3.7 and >\n\n## Usage\nLets create a simple bot engine\n```python\nfrom vkbottle import Bot, AnswerObject\n\nbot = Bot(token, group_id, debug=True)\n```\nName | Value\n------------ | -------------\ntoken | Your VK Group token for longpoll starting (**str**)\ngroup_id | Your VK Group ID (**int** )\ndebug | Should vkbottle show debug messages? Default to False (**bool**)\nasync_use | Should vkbottle (Bot) use asyncio to reach more faster results. Default to False (**bool**)\n\nNow we should import our event-files like this: `import events` with `bot.run()` in it or make it in one single file\n\n### Usage Decorators\n\n#### @on_message(text)\n```python\n@bot.on_message('hi!')\ndef hi(answer):\n print('Somebody wrote me \"hi!\"!')\n# if __name__ == '__main__': bot.run()\n```\n#### @on_message_chat(text)\n```python\n@bot.on_message_chat('hi!')\ndef hi(answer):\n print('Somebody wrote me \"hi!\" in chat!')\n# bot.run()\n```\n#### @on_message_undefined()\n```python\n@bot.on_message_undefined()\ndef undefined(answer):\n print('I cannot understand somebody')\n# if __name__ == '__main__': bot.run()\n```\n#### @on_message_both(text)\n```python\n@bot.on_message_both('hi!')\ndef hi(answer):\n print('Somebody wrote me \"hi!\" in chat or in private!')\n# bot.run()\n```\n\n* decorators can be combined \n\nArgument | Description\n-------- | -----------\ntext | Text which will approve the decorator condition (**str**)\npriority | Set the decorator priority. Default to 0 (**int**)\n\nHow to use **answer**?\nThere're a lot of supported methods:\n\nMethod | Description\n------------ | -------------\nanswer(text, attachment=None, keyboard=None, sticker=None) | Needed for fast answer to creator of event\n\nExamples: \n```python\n@bot.on_message('cat')\ndef itz_cat(answer):\n answer('Myaaw')\n# When user send message \"cat\" to bot, it answers \"Myaaw\"\n```\nAnswer is messages.send method without peer_id, it completes automatically\n\n### Keys\n\nIf you need it, you can add simple keys to your decorators like this: \n```python\n@bot.on_message('My name is ')\ndef my_name(answer, name):\n answer('You name is ' + name + '!')\n```\nIt is supported in chat-decorators too \n**Keys are named arguments to the function so should be resolved equal as it was resolved in decorator**\n\n### Async Use\n\nTo use async in your plugins just make `async_use` to True and all your events and messages functions to async:\n```python\n@bot.on_message('how are you')\ndef how_are_you(answer):\n await answer('I\\'m in the golden age of grotesque!')\n # answer calling should be in await expression\n```\n\n### Keyboard Generator\n\nLet's make a simple keyboard using VKBottle Keyboard Generator:\n```python\n[ # My keyboard\n [{'text': 'button1'}, {'text': 'button2'}], # row\n [{'text': 'button3'}] # second row\n]\n```\nKeyboard: \n{button1}{button2} \n{-------button3-----} \n\nKeyboard options for a button: \n\nOption | Meaning | Default\n------ | ------- | -------\ntext | Button text | \ncolor | Button color | Default(secondary)\ntype | Button action type | text\n\n**With Answer**\n\n```python\nanswer(\n 'It\\'s my keyboard!',\n keyboard=[\n [{'text': 'My Balance'}, {'text': 'Me'}],\n [{'text': 'shop', 'color': 'positive'}]\n ]\n)\n```\n\n### Answer-Parsers\n\nThere are two types of parsers and 3 parsers at all:\n\nParser | Description\n------ | -----------\nuser | method parser, based on user.get request\ngroup | method parser, based on group.getById request\nself | class parser, based on self variables of a Bot class\n\nHow to use **answer-parsers**? It's easy to explain: \n\n#### How parsers work\n\nYou make an answer request and the message takes part in Answer-Parser \u0441heckup. \nParser example looks like this: \n**{parser:arg}**\n\nFor example: \n```Hello, my dear {user:first_name}!```\n\n#### User Method Parser\n\nParser Example | Description\n-------------- | -----------\n{user:first_name} | Make it to name of the user who made an event\n{user:last_name} | Make it to second name of the user who made an event\n{user:id} | Make it to id of the userwho made an event\n\n#### Group Method Parser\n\nParser Example | Description\n-------------- | -----------\n{group:name} | Make it to name of the group where bot is\n{group:description} | Make it to description of the group where bot is\n... | ...\n\nMore info in [VK Object/Group Documentation](https://vk.com/dev/objects/group)\n\n#### Self Parser\n\nThis parser is very fast, recommended to use, when time is the main priority\n\nParser Example | Description\n-------------- | -----------\n{self:peer_id} | Event Owner ID\n{self:group_id} | Group where bot is ID\n\n### Bot Api\n\nYou can use VK Bot API to make all types and groups of requests. To do it you can use a simple method:\n\n```python\napi = bot.api\napi.messages.send(peer_id=1, message='Hi, my friend!')\n```\n\nAll available methods you can find in [VK Methods Documentation](https://vk.com/dev/methods)\n***\nAll groups of methods are supported but only these have special highlighting functions:\n* messages\n***\n\n### User Api\n\nTo authorise user use this method:\n```python\nfrom vkbottle import User\nuser = User('my-token', user_id=1)\n```\nArgument | Description\n-------- | -----------\ntoken | Vk Api token (**str**)\nuser_id | User ID (**int**)\ndebug | Should VKBottle escape debugging messages. Default to False (**bool**)\n\n**User Api** is equal to the Bot Api but doesn't have highlighting feature:\n```python\n# ...\nuser_api = user.api\nuser_api.messages.send(peer_id=1, message='Hello my colleague!', random_id=100)\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/timoniq/vkbottle/archive/v0.13.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/timoniq/vkbottle", "keywords": "vk,vkontakte,vk-api,vk-bot,vkbottle,vk-bottle", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "vkbottle", "package_url": "https://pypi.org/project/vkbottle/", "platform": "", "project_url": "https://pypi.org/project/vkbottle/", "project_urls": { "Download": "https://github.com/timoniq/vkbottle/archive/v0.13.tar.gz", "Homepage": "https://github.com/timoniq/vkbottle" }, "release_url": "https://pypi.org/project/vkbottle/0.13/", "requires_dist": null, "requires_python": "", "summary": "New bot-creating repo with options control like in the famous framework flask!", "version": "0.13" }, "last_serial": 5676420, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "6d65afc5447c524fb7e95882861f292c", "sha256": "16393a7e7fc97b5da24bc60d89b9e5f5ec063cb6a35c6493f08a90102542fb8f" }, "downloads": -1, "filename": "vkbottle-0.1.tar.gz", "has_sig": false, "md5_digest": "6d65afc5447c524fb7e95882861f292c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6273, "upload_time": "2019-08-09T15:49:32", "url": "https://files.pythonhosted.org/packages/e1/69/59187c26fa3267d97de9a08dec7261746a6fc53e379495c6cc3672a43e8d/vkbottle-0.1.tar.gz" } ], "0.11": [ { "comment_text": "", "digests": { "md5": "fa1d27a5f0905ab78f71b84af6a9c26a", "sha256": "408d99b6d1e929c6237fd428e7083db20e403941ed29b9d4ae19728bfcd065b2" }, "downloads": -1, "filename": "vkbottle-0.11.tar.gz", "has_sig": false, "md5_digest": "fa1d27a5f0905ab78f71b84af6a9c26a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6294, "upload_time": "2019-08-10T07:45:41", "url": "https://files.pythonhosted.org/packages/2d/ec/8f4a104e543fec59735e8074515ea73d51abb0a6f26d011648e7066a5486/vkbottle-0.11.tar.gz" } ], "0.12": [ { "comment_text": "", "digests": { "md5": "8c5734dcc759f9ac9fc687656aaa2453", "sha256": "338856ace162463c7b2e202a3a591e1f72aa63536708d72025be9274e758cae5" }, "downloads": -1, "filename": "vkbottle-0.12.tar.gz", "has_sig": false, "md5_digest": "8c5734dcc759f9ac9fc687656aaa2453", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12744, "upload_time": "2019-08-11T17:51:57", "url": "https://files.pythonhosted.org/packages/90/a9/9a241fa9b852000afa7a31c3d159314874de511cfb1fb2110300f5b8cf3f/vkbottle-0.12.tar.gz" } ], "0.13": [ { "comment_text": "", "digests": { "md5": "b29882bb76e5359dd8648177bd8eabd9", "sha256": "cc6de3bf6ac0bb7a3e68f27a2262687bbc2a4bd72d7d79cf08ab0c13f738eb83" }, "downloads": -1, "filename": "vkbottle-0.13.tar.gz", "has_sig": false, "md5_digest": "b29882bb76e5359dd8648177bd8eabd9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14000, "upload_time": "2019-08-14T11:12:31", "url": "https://files.pythonhosted.org/packages/95/85/f61725058f2e99fdc5eafbaca0329c4987511024648c5d552f7b4eef51b4/vkbottle-0.13.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b29882bb76e5359dd8648177bd8eabd9", "sha256": "cc6de3bf6ac0bb7a3e68f27a2262687bbc2a4bd72d7d79cf08ab0c13f738eb83" }, "downloads": -1, "filename": "vkbottle-0.13.tar.gz", "has_sig": false, "md5_digest": "b29882bb76e5359dd8648177bd8eabd9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14000, "upload_time": "2019-08-14T11:12:31", "url": "https://files.pythonhosted.org/packages/95/85/f61725058f2e99fdc5eafbaca0329c4987511024648c5d552f7b4eef51b4/vkbottle-0.13.tar.gz" } ] }