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

26 lines
620 B
Python
Raw Normal View History

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