fix .u
This commit is contained in:
@@ -70,13 +70,13 @@ def u(phenny, input):
|
|||||||
# phenny.msg('#inamidst', '%r' % arg)
|
# phenny.msg('#inamidst', '%r' % arg)
|
||||||
if not arg:
|
if not arg:
|
||||||
return phenny.reply('You gave me zero length input.')
|
return phenny.reply('You gave me zero length input.')
|
||||||
elif not arg.strip(' '):
|
elif not arg.strip(b' '):
|
||||||
if len(arg) > 1: return phenny.reply('%s SPACEs (U+0020)' % len(arg))
|
if len(arg) > 1: return phenny.reply('%s SPACEs (U+0020)' % len(arg))
|
||||||
return phenny.reply('1 SPACE (U+0020)')
|
return phenny.reply('1 SPACE (U+0020)')
|
||||||
|
|
||||||
# @@ space
|
# @@ space
|
||||||
if set(arg.upper()) - set(
|
if set(arg.upper()) - set(
|
||||||
'ABCDEFGHIJKLMNOPQRSTUVWYXYZ0123456789- .?+*{}[]\\/^$'):
|
b'ABCDEFGHIJKLMNOPQRSTUVWYXYZ0123456789- .?+*{}[]\\/^$'):
|
||||||
printable = False
|
printable = False
|
||||||
elif len(arg) > 1:
|
elif len(arg) > 1:
|
||||||
printable = True
|
printable = True
|
||||||
@@ -84,7 +84,7 @@ def u(phenny, input):
|
|||||||
|
|
||||||
if printable:
|
if printable:
|
||||||
extended = False
|
extended = False
|
||||||
for c in '.?+*{}[]\\/^$':
|
for c in b'.?+*{}[]\\/^$':
|
||||||
if c in arg:
|
if c in arg:
|
||||||
extended = True
|
extended = True
|
||||||
break
|
break
|
||||||
@@ -94,6 +94,8 @@ def u(phenny, input):
|
|||||||
except ValueError: pass
|
except ValueError: pass
|
||||||
else: return phenny.say(about(u))
|
else: return phenny.say(about(u))
|
||||||
|
|
||||||
|
arg = arg.decode('utf-8')
|
||||||
|
|
||||||
if extended:
|
if extended:
|
||||||
# look up a codepoint with regexp
|
# look up a codepoint with regexp
|
||||||
results = list(islice(codepoint_extended(arg), 4))
|
results = list(islice(codepoint_extended(arg), 4))
|
||||||
|
|||||||
Reference in New Issue
Block a user