mirror of
http://aero2k.de/t/repos/urlbot-native.git
synced 2017-09-06 15:25:38 +02:00
add interval
This commit is contained in:
@@ -911,7 +911,7 @@ def vote(argv, **args):
|
|||||||
|
|
||||||
@pluginfunction('quiz', 'play quiz', ptypes_COMMAND)
|
@pluginfunction('quiz', 'play quiz', ptypes_COMMAND)
|
||||||
def quiz_control(argv, **args):
|
def quiz_control(argv, **args):
|
||||||
usage = """quiz mode usage: "quiz start", "quiz stop", "quiz answer", "quiz skip",
|
usage = """quiz mode usage: "quiz start [secs interval]", "quiz stop", "quiz answer", "quiz skip",
|
||||||
"quiz rules;
|
"quiz rules;
|
||||||
if the quiz mode is active, sentences are parsed and compared against the answer.
|
if the quiz mode is active, sentences are parsed and compared against the answer.
|
||||||
"""
|
"""
|
||||||
@@ -938,7 +938,8 @@ The answers will be matched by characters/words. Answers will be
|
|||||||
quizcfg = dict()
|
quizcfg = dict()
|
||||||
|
|
||||||
if argv[0] == 'start':
|
if argv[0] == 'start':
|
||||||
return quiz.start_random_question(quizcfg)
|
interval = argv[1] if len(argv) > 1 else 60
|
||||||
|
return quiz.start_random_question(quizcfg, interval)
|
||||||
elif argv[0] == 'stop':
|
elif argv[0] == 'stop':
|
||||||
return quiz.stop(quizcfg)
|
return quiz.stop(quizcfg)
|
||||||
elif argv[0] == 'answer':
|
elif argv[0] == 'answer':
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ def rate(quizcfg, response, user):
|
|||||||
# }
|
# }
|
||||||
|
|
||||||
|
|
||||||
def start_random_question(quizcfg):
|
def start_random_question(quizcfg, interval):
|
||||||
stop(quizcfg)
|
stop(quizcfg)
|
||||||
qa = get_random_question(quizcfg)
|
qa = get_random_question(quizcfg)
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ def start_random_question(quizcfg):
|
|||||||
'msg': ['Q: {}'.format(qa[0])],
|
'msg': ['Q: {}'.format(qa[0])],
|
||||||
'event': {
|
'event': {
|
||||||
'command': (end_question, ([quizcfg],)),
|
'command': (end_question, ([quizcfg],)),
|
||||||
'time': time.time() + 15
|
'time': time.time() + interval
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user