1
0
mirror of https://github.com/MrDetonia/Maki.git synced 2024-11-10 15:48:06 -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): def cmd_roll(client, msg):
tmp = msg.content[6:] tmp = msg.content[6:]
pattern = re.compile("^(\d+)d(\d+)([+-]\d+)?$") pattern = re.compile("^(\d+)d(\d+)([+-]\d+)?(.*)?$")
pattern2 = re.compile("^d(\d+)([+-]\d+)?$") pattern2 = re.compile("^d(\d+)([+-]\d+)?(.*)?$")
# extract numbers # extract numbers
nums = [int(s) for s in re.findall(r"\d+", tmp)] nums = [int(s) for s in re.findall(r"\d+", tmp)]
@ -155,12 +155,12 @@ def cmd_roll(client, msg):
# extract modifier, if any # extract modifier, if any
modifier = 0 modifier = 0
modpattern = re.compile("^(\d+)?d(\d+)[+-]\d+$") modpattern = re.compile("^(\d+)?d(\d+)[+-]\d+(.*)?$")
if modpattern.match(tmp): if modpattern.match(tmp):
modifier = nums[len(nums) - 1] modifier = nums[len(nums) - 1]
# negate modifier, if necessary # negate modifier, if necessary
modpattern = re.compile("^(\d+)?d(\d+)[-]\d+$") modpattern = re.compile("^(\d+)?d(\d+)\-\d+(.*)?$")
if modpattern.match(tmp): if modpattern.match(tmp):
modifier = -modifier modifier = -modifier

View File

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