cypher: case insensitivity when matching task difficulties
Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
This commit is contained in:
parent
fa4815153a
commit
3b7c871a94
@ -49,7 +49,7 @@ class Dice(Plugin):
|
|||||||
nick = NickMask(event.source).nick
|
nick = NickMask(event.source).nick
|
||||||
task = match.group(1)
|
task = match.group(1)
|
||||||
|
|
||||||
task_group = re.search(CYPHER_ROLL_REGEX, task)
|
task_group = re.search(CYPHER_ROLL_REGEX, task, re.IGNORECASE)
|
||||||
difficulty = int(task_group.group('difficulty')) if task_group.group('difficulty') else None
|
difficulty = int(task_group.group('difficulty')) if task_group.group('difficulty') else None
|
||||||
mods = task_group.group('mods')
|
mods = task_group.group('mods')
|
||||||
comment = task_group.group('comment')
|
comment = task_group.group('comment')
|
||||||
|
@ -40,6 +40,16 @@ class MarkovTestCase(TestCase):
|
|||||||
'test: your check 9succeeded, with +1 damage! 14(d20=17 vs. diff. 3)'
|
'test: your check 9succeeded, with +1 damage! 14(d20=17 vs. diff. 3)'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# general task roll, case insensitive
|
||||||
|
mock_event.arguments = ['!cypher t3']
|
||||||
|
match = re.search(dice.ircplugin.CYPHER_COMMAND_REGEX, mock_event.arguments[0])
|
||||||
|
with mock.patch('random.SystemRandom.randint', return_value=17):
|
||||||
|
self.plugin.handle_cypher_roll(self.mock_connection, mock_event, match)
|
||||||
|
self.mock_bot.reply.assert_called_with(
|
||||||
|
mock_event,
|
||||||
|
'test: your check 9succeeded, with +1 damage! 14(d20=17 vs. diff. 3)'
|
||||||
|
)
|
||||||
|
|
||||||
# unknown target roll
|
# unknown target roll
|
||||||
mock_event.arguments = ['!cypher +1']
|
mock_event.arguments = ['!cypher +1']
|
||||||
match = re.search(dice.ircplugin.CYPHER_COMMAND_REGEX, mock_event.arguments[0])
|
match = re.search(dice.ircplugin.CYPHER_COMMAND_REGEX, mock_event.arguments[0])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user