Download:
child 20:8bd991e9b7ff
parent 18:7cf8ac0d3ebc
19:fade59cdf584
Anton Shestakov <av6@dwimlabs.net>, Fri, 03 Jun 2016 11:36:03 +0800
rollbot: transform times and sides to integers early

1 файлов изменено, 4 вставок(+), 2 удалений(-) [+]
rollbot.py file | annotate | diff | comparison | revisions
--- a/rollbot.py Fri Jun 03 11:23:45 2016 +0800
+++ b/rollbot.py Fri Jun 03 11:36:03 2016 +0800
@@ -38,9 +38,11 @@
times = match.group('times')
if times is None:
times = 1
- sides = match.group('sides')
+ else:
+ times = int(times)
+ sides = int(match.group('sides'))
if times > 0 and sides > 1:
- rolls, total = self.roll(int(times), int(sides))
+ rolls, total = self.roll(times, sides)
return self.format(rolls, total)
return '%s usage: %s' % (self.name, self.usage())