Skip to content

Commit

Permalink
#89 - Base class for a Pyttman plugin, with methods for plugin implem…
Browse files Browse the repository at this point in the history
…entations to override.
  • Loading branch information
dotchetter committed Jan 7, 2024
1 parent 0ebb059 commit 4ef1007
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions pyttman/core/plugins/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from pyttman.core.containers import MessageMixin


class PyttmanPlugin:
"""
The PluginBase class offers an API for contributors to
develop custom workflows which interact with different
parts of a Pyttman application runtime.
Implement methods as desired to interact with the
various layers.
The instance is long-lived throughout the application runtime.
"""

def before_app_start(self, app):
"""
Implement this method to have code execute before the app
starts.
"""
pass

def after_app_stops(self, app):
"""
Implement this method to have code execute when the
app has exited
"""

def before_intent(self, message: MessageMixin):
"""
Implement this method to interact with the processing
of a message, before it's processed by the matching Intent.
"""
pass

def after_intent(self, reply: MessageMixin):
"""
Implement this method to interact with the Reply object
from an Intent, before it's delivered to the Client for
a platform response.
"""
pass

0 comments on commit 4ef1007

Please sign in to comment.