Skip to content

Trivia

The Trivia Quiz is a simple three-question quiz. At the end of the quiz you'll receive your score. You can exit the trivia at any time.

This example demonstrates how stored slots can be used in the conversation. Also, this example provides a Python extension server.

The extensions for this bot are used to:

  • Reject the user's input if their answer is not a number from the list.
  • Calculate the user's score based on the valid stored answers.

Diagram

This bot's Finite State Machine can be visualized like this:

Trivia

Run it

To run this example:

  • Using Go extensions:

    go run examples/03_trivia/ext/ext.go
    
  • Using Python extensions:

    python3 examples/03_trivia/ext/ext.py
    

    Note

    This Python example requires Flask to be installed:

    pip install flask
    

And in other terminal:

chatto --path examples/03_trivia/