Pyrostates


NamePyrostates JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA state handling extension for Pyrogram
upload_time2024-06-13 12:27:24
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseCopyright (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/e0/b2/e00819a3bf8b5a1105fc5fa487caaf7bf4b67a90bdcc043a1763e8328aba/pyrostates-0.1.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": "0.1.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": "e205670853e69d29dfc7ef3869652c8713c74d34f6d32021e6b3e5f53086a9fc",
                "md5": "c5db09cc84217beae85a8a818af14e02",
                "sha256": "85f70a866b69b2f4ebed27e7290dc416bbbf317e34f2def080bf39416b7bf3d6"
            },
            "downloads": -1,
            "filename": "Pyrostates-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c5db09cc84217beae85a8a818af14e02",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5578,
            "upload_time": "2024-06-13T12:27:21",
            "upload_time_iso_8601": "2024-06-13T12:27:21.813180Z",
            "url": "https://files.pythonhosted.org/packages/e2/05/670853e69d29dfc7ef3869652c8713c74d34f6d32021e6b3e5f53086a9fc/Pyrostates-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e0b2e00819a3bf8b5a1105fc5fa487caaf7bf4b67a90bdcc043a1763e8328aba",
                "md5": "83ab0d8f656ff5d8fdd78a6c82f0f7b4",
                "sha256": "520cbccbb7b48efdf3810f1ec52d74c921ef160a7bfcda7acec24af6a84b033a"
            },
            "downloads": -1,
            "filename": "pyrostates-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "83ab0d8f656ff5d8fdd78a6c82f0f7b4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4135,
            "upload_time": "2024-06-13T12:27:24",
            "upload_time_iso_8601": "2024-06-13T12:27:24.392358Z",
            "url": "https://files.pythonhosted.org/packages/e0/b2/e00819a3bf8b5a1105fc5fa487caaf7bf4b67a90bdcc043a1763e8328aba/pyrostates-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-13 12:27:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SajjadAlipour2006",
    "github_project": "Pyrostates",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pyrostates"
}
        
Elapsed time: 0.28502s