Skip to content

Texts Guide

Moris Doratiotto edited this page Jul 1, 2021 · 1 revision

You can specified the message for every state in a dictionary or in an external file (suggested).
Following, you can find an example for every method supported.

Check out this example: texts.py

Example of usage

Given these simple states:

# states
first = State("first", back_button=False)
another = State("another")
end = State("end")

Dictionary

texts = {
    "first": "This is the first message",
    "another": "This is another message",
    "end": "This is the final message",
}
Conversation(first, state_messages=texts)

JSON

Given this JSON file texts.json:

{
    "first": "This is the first message",
    "another": "This is another message",
    "end": "This is the final message",
}
Conversation(first, state_messages="texts.json")

YAML

Given this YAML file texts.yaml:

first: "This is the first message"
another: "This is another message"
end: "This is the final message"
Conversation(first, state_messages="texts.yaml")

TOML

Given this TOML file texts.toml:

first = "This is the first message"
another = "This is another message"
end = "This is the final message"
Conversation(first, state_messages="texts.toml")
Clone this wiki locally