Typed router for chatbot
Project description
Chatrouter is an enhanced router for chatbots and easily integrates with any bot library.
key features
- turned complexity into simplicity.
from:
if user_session == "A":
...
elif user_session == "B":
...
elif user_session == "C":
...
else:
...
to:
chatbot = chatrouter.group(user_session)
r = chatrouter.run(chatbot, msg)
- Readable route.
@chatbot.add_command("call me {my_name}")
# or
chatbot.add_command("call me {my_name} and {my_friend}")
# etc
- case sensitive and insensitive.
default case is insensitive but you can add strict=True to a route/command to make it case sensitive.
- public and private command.
command start with "/" and have description is public command, for example:
@chatbot.add_command("/test", description="test command", strict=True)
- invoke callback anywhere.
func = chatrouter.util.get_func("group_name", "command_name")
or
chatrouter.invoke("group", "route", *args, **kwargs)
-
auto generated
/startand/helpcommand. -
object storage
chatrouter.data_user. -
support route with regex.
-
support autoloader
chatrouter.autoloader("path"). -
support Asynchronous.
-
typed python.
installation
pip install chatrouter
Usage
for usage, please see examples directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
chatrouter-1.0.8.tar.gz
(7.2 kB
view details)
File details
Details for the file chatrouter-1.0.8.tar.gz.
File metadata
- Download URL: chatrouter-1.0.8.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7465cb60f9fb176eeaf203164fb601f8bac8dfbffd1878fb2cdffb947e7221c2
|
|
| MD5 |
80dcc211c23c76b583a049735a4e71ee
|
|
| BLAKE2b-256 |
5ed951936c61e50a708c18934f99ea959d42c4683b4e969983819b5ebfb0966f
|