extlib/megahal.py: don't crash when the input string ends in '
This commit is contained in:
parent
ae6eda2c6a
commit
c513a0bebc
@ -167,6 +167,10 @@ class Brain(object):
|
|||||||
boundary = False
|
boundary = False
|
||||||
elif position == len(string):
|
elif position == len(string):
|
||||||
boundary = True
|
boundary = True
|
||||||
|
elif (string[position] == "'" and
|
||||||
|
string[position - 1].isalpha() and
|
||||||
|
position + 1 == len(string)):
|
||||||
|
boundary = True
|
||||||
elif (string[position] == "'" and
|
elif (string[position] == "'" and
|
||||||
string[position - 1].isalpha() and
|
string[position - 1].isalpha() and
|
||||||
string[position + 1].isalpha()):
|
string[position + 1].isalpha()):
|
||||||
|
@ -59,9 +59,6 @@ class MegaHAL(Module):
|
|||||||
reply = ""
|
reply = ""
|
||||||
append_nick = False
|
append_nick = False
|
||||||
|
|
||||||
if line[-1] == '\'':
|
|
||||||
line = line[:-1]
|
|
||||||
|
|
||||||
if re.search(connection.get_nickname(), line, re.IGNORECASE) is not None:
|
if re.search(connection.get_nickname(), line, re.IGNORECASE) is not None:
|
||||||
addressed_pattern = '^' + connection.get_nickname() + '[:,]\s+'
|
addressed_pattern = '^' + connection.get_nickname() + '[:,]\s+'
|
||||||
addressed_re = re.compile(addressed_pattern)
|
addressed_re = re.compile(addressed_pattern)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user