Process
I started by making a function matrix, a conversation flow and a paragraph of my bot's personality to help me visualize what my bot will be doing.
Function matrix
Conversation flow
Drawing out a conversation flow allowed me to examine the logic and check if there was any feature missing from the scope. It was also a great reference for me throughout the time when I was writing the code.
A short writing about the bot's personality
Creative Juice bot wants to give designers, especially UX designers, inspirations when they are feeling stuck with their creative projects. He is friendly, reliable, and humble. He loves sharing what he knows and what he found inspiring with other designers. When a user approaches him, he knows that the user needs some creative juice to get going. He respects that and may respond something like: “Good to see you, buddy.” He also cherishes long-term relationships.
After getting a good sense of how my bot works, I started to build the code. The biggest challenge for me is to randomize the exercise/quotes for users and make sure they don't get the same content. At first, I thought about using database, but after I explained my concept to the instructor, I was suggested to use csv file instead. So I created two csv file, one for creativity exercises, and one for quotes.
This section of code was used to read into a csv file. Each row in the file is treated as an array.
Another challenge I encountered was to differentiate the two "yes" a user may reply. The solution comes in storing sessions.