The purpose of this PR is to allow for easier additions to but functionality by breaking each function into its own class implementing a common interface. Current examples of bot functions are mobile Slashdot URL parsing and commands.
The new BotFunction interface consists of two methods:
shouldProcess which takes in the user message and returns whether or not the function should be processed.
process which takes in an object implementing the BotRequestMetadata interface and returns a response.
New implementations of BotFunction are picked up automatically and any integrations that need to process messages can simply call the process method in the new FunctionProcessor class and an appropriate response will be returned.
The purpose of this PR is to allow for easier additions to but functionality by breaking each function into its own class implementing a common interface. Current examples of bot functions are mobile Slashdot URL parsing and commands.
The new
BotFunction
interface consists of two methods:shouldProcess
which takes in the user message and returns whether or not the function should be processed.process
which takes in an object implementing theBotRequestMetadata
interface and returns a response.New implementations of
BotFunction
are picked up automatically and any integrations that need to process messages can simply call theprocess
method in the newFunctionProcessor
class and an appropriate response will be returned.