In this PR the bot/index file was refactored. The behaviors related to machine learning were extracted to the bot/brain file. The behaviors related to actions (respond, error, configure) were extracted to the bot/action_handler file.
Besides these changes, the code style was fixed following the coffeelint standard style sheet.
Since we changed a lot of code from one file to others, we didn't change the methods' logic, to facilitate the reviewing process. Others architectural changes where thought and could be discussed for future changes, they are:
Create an interface for the brain file/class so other forms of classification could be implemented by the user, without requiring changes to the source code.
Create a better implementation for the action handler so it can accept user-defined actions. Probably using methods instead of classes and a dictionary to register the actions would solve the problem.
Extract the platform related methods to a chat interface so the hubot-natural could be used in others providers besides rocket-chat
In this PR the
bot/index
file was refactored. The behaviors related to machine learning were extracted to thebot/brain
file. The behaviors related to actions (respond
,error
,configure
) were extracted to thebot/action_handler
file.Besides these changes, the code style was fixed following the
coffeelint
standard style sheet.Since we changed a lot of code from one file to others, we didn't change the methods' logic, to facilitate the reviewing process. Others architectural changes where thought and could be discussed for future changes, they are:
hubot-natural
could be used in others providers besides rocket-chat