1
0
mirror of https://github.com/MrDetonia/Maki.git synced 2024-11-28 21:45:30 -05:00

v1.2.3, ignore text after .roll command

This commit is contained in:
Zac Herd 2019-02-25 15:05:29 +00:00
parent 955ee8b8d1
commit 6045fab0f9
2 changed files with 5 additions and 5 deletions

View File

@ -137,8 +137,8 @@ def cmd_markov(client, msg):
def cmd_roll(client, msg):
tmp = msg.content[6:]
pattern = re.compile("^(\d+)d(\d+)([+-]\d+)?$")
pattern2 = re.compile("^d(\d+)([+-]\d+)?$")
pattern = re.compile("^(\d+)d(\d+)([+-]\d+)?(.*)?$")
pattern2 = re.compile("^d(\d+)([+-]\d+)?(.*)?$")
# extract numbers
nums = [int(s) for s in re.findall(r"\d+", tmp)]
@ -155,12 +155,12 @@ def cmd_roll(client, msg):
# extract modifier, if any
modifier = 0
modpattern = re.compile("^(\d+)?d(\d+)[+-]\d+$")
modpattern = re.compile("^(\d+)?d(\d+)[+-]\d+(.*)?$")
if modpattern.match(tmp):
modifier = nums[len(nums) - 1]
# negate modifier, if necessary
modpattern = re.compile("^(\d+)?d(\d+)[-]\d+$")
modpattern = re.compile("^(\d+)?d(\d+)\-\d+(.*)?$")
if modpattern.match(tmp):
modifier = -modifier

View File

@ -10,7 +10,7 @@ import os
import json
# bot version
version = "v1.2.2"
version = "v1.2.3"
# TODO: generate this on the fly and make it look acceptable
# text shown by .help command