Skip to content

goodbot: Templates

qedk edited this page Jun 29, 2020 · 1 revision

The templates directory provides templates for the bot to get messages from, this cuts down on the actual codebase and modularizes responses away from the code.

Currently, we have:

  • faq.json: This file contains all the template messages for FAQs which are fuzzy-matched to return the closest match. Each question is attached to a keyword and the keyword is the key for the answers, giving the extended answers to the question.
  • replies.json: This file contains almost all other bot responses the bot uses to reply, each keyword is connected to a snippet or long-form text. The greetings keyword contains a list of all greetings the bot shuffles between.

The bot stores the files into a dict() upon each initialization, while a bit slower than hardcoding the messages, it provides O(1) time-complexity and can be implemented using the standard library alone.