-
-
Notifications
You must be signed in to change notification settings - Fork 4
Middleware
##Middleware in Pyttman
The Middleware layer is the outer-most layer of software being executed before a Message is relayed to the application logic - and before the subsequent Reply is re-routed back to the platform.
As of Pyttman 1.1.10, only one Router class is supported, the FirstMatchingRouter
, which, as the name sugggests, routes the message to the first of many Intents matching a Message.
The FirstMatchingRouter is also the first ever released router in Pyttman. We're aware of the convenience and performance bottlenecks of this approach and are actively developing new routers at the time of writing this.
FirstMatchingRouter(self, abilities: List[Ability], intent_unknown_responses: List[str], help_keyword: str, **kwargs)
Iterates over intents linearly. No calculation performed when routing messages and multiple abilities matches a Message - the first one in order is chosen.
Copy the path under ROUTER_CLASS
and paste the following import reference in ROUTER_CLASS
in the settings.py
file in a Pyttman application:
MESSAGE_ROUTER = {
"ROUTER_CLASS": "pyttman.core.middleware.routing.FirstMatchingRouter",
...
Welcome to the Pyttman Wiki! Here you'll find all available documentation and tutorials for Pyttman.
Get started
Documentation
Contributors