SystemyDialogowe/modules/DST.py

41 lines
1.1 KiB
Python
Raw Normal View History

2022-06-05 18:59:48 +02:00
class Dst:
def __init__(self):
self.messages = []
self.checklist = {
"ilosc": None,
"tytul": None,
"dzien": None,
2022-06-13 19:24:31 +02:00
"godzina": None,
"miejsce": None,
"numer": None,
2022-06-05 18:59:48 +02:00
}
self.history = []
def store(self, message):
self.messages.append(message)
def get_messages(self):
return self.messages
def get_next_question(self):
for key, value in self.checklist.items():
if value == None:
return key
2022-06-13 19:24:31 +02:00
2022-06-14 12:57:51 +02:00
def reset_if_needed(self,text):
if text == "reset":
for key in self.checklist.keys():
self.checklist[key] = None
2022-06-05 18:59:48 +02:00
2022-06-14 12:57:51 +02:00
2022-06-05 18:59:48 +02:00
def save_answer(self, slots):
for slot in slots:
2022-06-14 12:57:51 +02:00
if slot[0] == "numer":
if (len(slot[1].replace(" ",""))) == 9:
self.checklist[slot[0]] = slot[1].replace(" ","")
else:
self.checklist[slot[0]] = slot[1]
2022-06-05 18:59:48 +02:00
self.messages.append(slots)