Adding new questions - Terminaator/chatbot GitHub Wiki

All question classes are in one folder named questions. The .py files there can contain more than 1 question.

The first step is to look if the new question should be created into an existing file or a new file should be created. 1 File should only contain similar questions. For example questions about courses should go into 1 file.

If the file has multiple questions, then there should be a controller for those questions. See Courses.py for example.

Each class has 2 main methods: canAnswer(self, layer) and answer(self, layer). The first one checks if the question criterion is met. If it is, then the answer method is called. Answer method forms the answer to the question.

If you made a new question file, then be sure to add it to init.py in the questions folder. Otherwise the chatbot can't find it.

The final step is to add the newly created question or it's controller to possible questions list, which is located in chatbot.py constructor.