update V2 (cleanunp, basic multiple choice, embeds)

This commit is contained in:
ChUrl
2021-06-03 16:07:40 +02:00
parent 948a700dfd
commit 77d205be43
3 changed files with 181 additions and 114 deletions

View File

@ -3,11 +3,18 @@
class Quiz(object):
def __init__(self, name):
self.name = name
self.questions = []
with open(name) as file:
for line in file:
if len(line.strip()) == 0:
continue
question = tuple(string.strip() for string in tuple(line.split(" ")))
if question[1].startswith("{"): # handle multiple choice
question = (question[0], tuple(((question[1])[1:-1]).split(", ")), question[2])
question = (question[0], question[1], tuple(((question[2])[1:-1]).split(": "))) # unpack embed
self.questions.append(question)
def __iter__(self):