Delete if report is 'delete'

This commit is contained in:
rootcoma 2013-12-04 07:52:16 -08:00
parent a56570d8b1
commit b4fcbb4eb2
2 changed files with 15 additions and 2 deletions

View File

@ -35,7 +35,7 @@ conf.registerChannelValue(TriviaTime.admin, 'sqlitedb',
conf.registerChannelValue(TriviaTime.admin, 'quizfile',
registry.NormalizedString("""plugins/TriviaTime/storage/samplequestions""",
"""Location of question file""")
"""Location of question file. Changes require reloading the plugin""")
)
# timeout, number of hints, values
@ -51,7 +51,7 @@ conf.registerChannelValue(TriviaTime.commands, 'showHintCommandKAOS',
conf.registerChannelValue(TriviaTime.general, 'globalStats',
registry.Boolean(False,
"""Stats are global accross all channels""")
"""Stats are global across all channels""")
)
conf.registerChannelValue(TriviaTime.hints, 'vowelsHint',

View File

@ -779,6 +779,19 @@ class TriviaTime(callbacks.Plugin):
irc.sendMsg(ircmsgs.notice(username, 'NEW: %s' % (newQuestionText)))
irc.sendMsg(ircmsgs.notice(username, 'OLD: %s' % (question[2])))
return
elif str.lower(utils.str.normalizeWhitespace(inp)) == 'delete':
if not threadStorage.questionIdExists(question[0]):
irc.error('That question does not exist.')
return
if threadStorage.isQuestionDeleted(question[0]):
irc.error('That question is already deleted.')
return
if threadStorage.isQuestionPendingDeletion(question[0]):
irc.error('That question is already pending deletion.')
return
irc.reply('Marked question for deletion.')
threadStorage.insertDelete(username, channel, question[0])
return
threadStorage.updateUser(username, 0, 0, 1)
threadStorage.insertReport(channel, username, text, question[0])
irc.reply('Your report has been submitted!')