Skip to content

Proposal for functional logic adapter design

Gunther Cox edited this page Oct 2, 2016 · 2 revisions

This is a proposal for the design of a new logic adapter that will make it easier for developers using ChatterBot to add functions that the bot runs when a particular condition is met.

Example

  • User: Turn on the lights
  • Bot: Sure
def turn_light_on(self):
    requests.post('http://localhost:5050/api/lights/', data={'on': True})

Adapter design

class CallbackAdapter(LogicAdapter):
callback_adapter_config=[
    'trigger': {
        'contains': 'lights',
        'commands': ['on', 'off'],
        'callable': turn_lights_on
    }
]