Name | Pyrostates JSON |
Version |
1.0.0
JSON |
| download |
home_page | None |
Summary | A state handling extension for Pyrogram |
upload_time | 2024-12-04 20:59:14 |
maintainer | None |
docs_url | None |
author | None |
requires_python | None |
license | Copyright (c) 2024-present SajjadAlipour2006 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
python
bot
telegram
pyrogram
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
## Pyrostates
> A state handling extension for [Pyrogram](https://github.com/pyrogram/pyrogram)
``` python
from pyrogram import Client, filters
from pyrostates import at_state, set_state, del_state
app = Client("my_account")
@app.on_message(at_state(None) & filters.private & filters.text)
async def home_state(_, message):
await message.reply("Hello, I'm the conversation bot. What is your name?")
set_state(message, "NAME")
@app.on_message(at_state("NAME") & filters.private & filters.text)
async def name_state(_, message):
name = message.text
await message.reply(f"Nice to meet you, {name}! How old are you?")
set_state(message, "AGE")
@app.on_message(at_state("AGE") & filters.private & filters.text)
async def age_state(_, message):
age = message.text
await message.reply(f"You are {age} years old, good for you! Have a nice day!")
del_state(message)
app.run()
```
**Pyrostates** is a ready, easy and elegant extension for the [Pyrogram](https://github.com/pyrogram/pyrogram)
framework. It enables you to handle the states of your users in the most simple, efficient and reliable way.
### Installing
``` bash
pip3 install pyrostates
```
Raw data
{
"_id": null,
"home_page": null,
"name": "Pyrostates",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "python, bot, telegram, pyrogram",
"author": null,
"author_email": "Sajjad <sajjadalipour2006@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/ba/5e/b941f488bc4c8b7e3700c58b8d64ceab912b31884aa14bbdff3c79fc0df2/pyrostates-1.0.0.tar.gz",
"platform": null,
"description": "## Pyrostates\r\n\r\n> A state handling extension for [Pyrogram](https://github.com/pyrogram/pyrogram)\r\n\r\n``` python\r\nfrom pyrogram import Client, filters\r\nfrom pyrostates import at_state, set_state, del_state\r\n\r\napp = Client(\"my_account\")\r\n\r\n\r\n@app.on_message(at_state(None) & filters.private & filters.text)\r\nasync def home_state(_, message):\r\n await message.reply(\"Hello, I'm the conversation bot. What is your name?\")\r\n set_state(message, \"NAME\")\r\n\r\n\r\n@app.on_message(at_state(\"NAME\") & filters.private & filters.text)\r\nasync def name_state(_, message):\r\n name = message.text\r\n await message.reply(f\"Nice to meet you, {name}! How old are you?\")\r\n set_state(message, \"AGE\")\r\n\r\n\r\n@app.on_message(at_state(\"AGE\") & filters.private & filters.text)\r\nasync def age_state(_, message):\r\n age = message.text\r\n await message.reply(f\"You are {age} years old, good for you! Have a nice day!\")\r\n del_state(message)\r\n\r\n\r\napp.run()\r\n```\r\n\r\n**Pyrostates** is a ready, easy and elegant extension for the [Pyrogram](https://github.com/pyrogram/pyrogram)\r\nframework. It enables you to handle the states of your users in the most simple, efficient and reliable way.\r\n\r\n### Installing\r\n\r\n``` bash\r\npip3 install pyrostates\r\n```\r\n",
"bugtrack_url": null,
"license": "Copyright (c) 2024-present SajjadAlipour2006 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "A state handling extension for Pyrogram",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/SajjadAlipour2006/Pyrostates",
"Tracker": "https://github.com/SajjadAlipour2006/Pyrostates/issues"
},
"split_keywords": [
"python",
" bot",
" telegram",
" pyrogram"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1e25921984066f50f22508a265b1069ccf5d330be76c53a8da968ae9552a15ec",
"md5": "8ae096e2310770ff29250b8a2ec6e7e3",
"sha256": "b2ce7f58c2b3f8918cedb74c9872847c3010999e8f9b1bd08ab532f7dba0d89f"
},
"downloads": -1,
"filename": "Pyrostates-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8ae096e2310770ff29250b8a2ec6e7e3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5682,
"upload_time": "2024-12-04T20:59:13",
"upload_time_iso_8601": "2024-12-04T20:59:13.167111Z",
"url": "https://files.pythonhosted.org/packages/1e/25/921984066f50f22508a265b1069ccf5d330be76c53a8da968ae9552a15ec/Pyrostates-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ba5eb941f488bc4c8b7e3700c58b8d64ceab912b31884aa14bbdff3c79fc0df2",
"md5": "1c6efc50235508f94addd6daaceada79",
"sha256": "b9a76c5c0c874f3f2cf1373fcceba871f9379b905b2bdf1a3d889408f57fa687"
},
"downloads": -1,
"filename": "pyrostates-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "1c6efc50235508f94addd6daaceada79",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4184,
"upload_time": "2024-12-04T20:59:14",
"upload_time_iso_8601": "2024-12-04T20:59:14.448013Z",
"url": "https://files.pythonhosted.org/packages/ba/5e/b941f488bc4c8b7e3700c58b8d64ceab912b31884aa14bbdff3c79fc0df2/pyrostates-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-04 20:59:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "SajjadAlipour2006",
"github_project": "Pyrostates",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pyrostates"
}