Editing completely for narrowing down:
How to represent the state-machine of the chat bot inside Django:Should I store all it’s states, transitions, actions and conditions inside models?
Or should i just represent them using dictionaries and other data structures and calculate the response on every request (based on the state of the conversation with the specific user that sent the request which will have to be stored inside database)? If this then how?
Or is there any better way to represent this state machine? for example using a class based representation like dropbox’s securitybot. (The problem with this is that it loads all of the state machine from dictionaries when the class is instantiated. This is inside a main loop so instantiating it once for every user works but I don’t want to instantiate all of it every time a request comes.)