chatrouter


Namechatrouter JSON
Version 1.0.7 PyPI version JSON
download
home_pagehttps://github.com/cirebon-dev/chatrouter
SummaryTyped router for chatbot
upload_time2024-12-01 07:57:33
maintainerNone
docs_urlNone
authorguangrei
requires_pythonNone
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Chatrouter is an enhanced router for chatbots and easily integrates with any bot library.

## key features

1. turned complexity into simplicity.

from:
```python
if user_session == "A":
    ...
elif user_session == "B":
    ...
elif user_session == "C":
    ...
else:
    ...
```
to:
```python
chatbot = chatrouter.group(user_session)
r = chatrouter.run(chatbot, msg)
```
2. Readable route.

```python
@chatbot.add_command("call me {my_name}")
# or 
chatbot.add_command("call me {my_name} and {my_friend}")
# etc
```

3. case sensitive and insensitive.

default case is `insensitive` but you can add `strict=True` to a route/command to make it case  sensitive.

4. public and private command.

command start with "/" and have description is public command, for example:
```python
@chatbot.add_command("/test", description="test command", strict=True)
```
5. invoke callback anywhere.

```python
func = chatrouter.util.get_func("group_name", "command_name")
```

or

```python
chatrouter.invoke("group", "route", *args, **kwargs)
```

6. auto generated `/start` and `/help` command.

7. object storage `chatrouter.data_user`.

8. support route with regex.

9. support autoloader `chatrouter.autoloader("path")`.

10. support Asynchronous.

11. typed python.

## installation

```
pip install chatrouter
```

## Usage

for usage, please see [examples](https://github.com/cirebon-dev/chatrouter/tree/main/examples) directory.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cirebon-dev/chatrouter",
    "name": "chatrouter",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "guangrei",
    "author_email": "myawn@pm.me",
    "download_url": "https://files.pythonhosted.org/packages/71/2b/e344f7773adf551ecba559281e9ae816fa7514937fc505461f1a9d022e06/chatrouter-1.0.7.tar.gz",
    "platform": "any",
    "description": "Chatrouter is an enhanced router for chatbots and easily integrates with any bot library.\n\n## key features\n\n1. turned complexity into simplicity.\n\nfrom:\n```python\nif user_session == \"A\":\n    ...\nelif user_session == \"B\":\n    ...\nelif user_session == \"C\":\n    ...\nelse:\n    ...\n```\nto:\n```python\nchatbot = chatrouter.group(user_session)\nr = chatrouter.run(chatbot, msg)\n```\n2. Readable route.\n\n```python\n@chatbot.add_command(\"call me {my_name}\")\n# or \nchatbot.add_command(\"call me {my_name} and {my_friend}\")\n# etc\n```\n\n3. case sensitive and insensitive.\n\ndefault case is `insensitive` but you can add `strict=True` to a route/command to make it case  sensitive.\n\n4. public and private command.\n\ncommand start with \"/\" and have description is public command, for example:\n```python\n@chatbot.add_command(\"/test\", description=\"test command\", strict=True)\n```\n5. invoke callback anywhere.\n\n```python\nfunc = chatrouter.util.get_func(\"group_name\", \"command_name\")\n```\n\nor\n\n```python\nchatrouter.invoke(\"group\", \"route\", *args, **kwargs)\n```\n\n6. auto generated `/start` and `/help` command.\n\n7. object storage `chatrouter.data_user`.\n\n8. support route with regex.\n\n9. support autoloader `chatrouter.autoloader(\"path\")`.\n\n10. support Asynchronous.\n\n11. typed python.\n\n## installation\n\n```\npip install chatrouter\n```\n\n## Usage\n\nfor usage, please see [examples](https://github.com/cirebon-dev/chatrouter/tree/main/examples) directory.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Typed router for chatbot",
    "version": "1.0.7",
    "project_urls": {
        "Homepage": "https://github.com/cirebon-dev/chatrouter"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "712be344f7773adf551ecba559281e9ae816fa7514937fc505461f1a9d022e06",
                "md5": "55987678e8154bbdae4aa566388ff501",
                "sha256": "cac8697c9b7329dbe081f7ff06b5de39f26a56e2c1dc8a08c9a37103e4de0712"
            },
            "downloads": -1,
            "filename": "chatrouter-1.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "55987678e8154bbdae4aa566388ff501",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6772,
            "upload_time": "2024-12-01T07:57:33",
            "upload_time_iso_8601": "2024-12-01T07:57:33.690156Z",
            "url": "https://files.pythonhosted.org/packages/71/2b/e344f7773adf551ecba559281e9ae816fa7514937fc505461f1a9d022e06/chatrouter-1.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-01 07:57:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cirebon-dev",
    "github_project": "chatrouter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "chatrouter"
}
        
Elapsed time: 0.96285s