fix bug when using @comment with a comma but bad duration syntax.
This commit is contained in:
@ -107,6 +107,9 @@ timeUnits = FuzzyDict({
|
||||
def readTimeDelta(s):
|
||||
"""convert a string like "2 days" or "1h2d3w" into seconds"""
|
||||
# split number and words
|
||||
if not s:
|
||||
raise ValueError(s)
|
||||
|
||||
digit = string = number = None
|
||||
seconds = 0
|
||||
for c in s:
|
||||
@ -137,6 +140,9 @@ def readTimeDelta(s):
|
||||
string += c
|
||||
|
||||
# check last string
|
||||
if string is None:
|
||||
raise ValueError(s)
|
||||
|
||||
if string.isdigit():
|
||||
seconds += int(string)
|
||||
else:
|
||||
|
@ -130,6 +130,8 @@ class BantrackerTestCase(ChannelPluginTestCase):
|
||||
self.assertResponse('comment 1', 'No comments recorded for ban 1')
|
||||
self.assertResponse('comment 1 this is a test', 'The operation succeeded.')
|
||||
self.assertRegexp('comment 1', 'test: this is a test$')
|
||||
self.assertResponse('comment 1 this is a test, another test',
|
||||
'The operation succeeded.')
|
||||
|
||||
def testMultiComment(self):
|
||||
self.feedBan('asd!*@*')
|
||||
|
Reference in New Issue
Block a user