mirror of
1
0
Fork 0
dotbot/dotbot/plugin.py

27 lines
613 B
Python
Raw Normal View History

from .context import Context
from .messenger import Messenger
2014-03-19 23:07:30 -04:00
2022-01-30 18:48:30 -05:00
class Plugin:
2022-01-30 18:48:30 -05:00
"""
2014-03-19 23:07:30 -04:00
Abstract base class for commands that process directives.
2022-01-30 18:48:30 -05:00
"""
2014-03-19 23:07:30 -04:00
def __init__(self, context):
self._context = context
2014-03-19 23:07:30 -04:00
self._log = Messenger()
def can_handle(self, directive):
2022-01-30 18:48:30 -05:00
"""
2016-01-16 22:00:15 -05:00
Returns true if the Plugin can handle the directive.
2022-01-30 18:48:30 -05:00
"""
2014-03-19 23:07:30 -04:00
raise NotImplementedError
def handle(self, directive, data):
2022-01-30 18:48:30 -05:00
"""
2014-03-19 23:07:30 -04:00
Executes the directive.
2016-01-16 22:00:15 -05:00
Returns true if the Plugin successfully handled the directive.
2022-01-30 18:48:30 -05:00
"""
2014-03-19 23:07:30 -04:00
raise NotImplementedError