This commit is contained in:
deathbybandaid 2019-06-05 20:01:04 -04:00
parent cb0b0dce45
commit a97afcd9ff

View File

@ -22,7 +22,8 @@ def bot_command_rule(bot, trigger):
return
message = trigger.args[1]
message = return_utf(message)
if isinstance(message, unicode):
return
# ignore text coming from a valid prefix
if str(message).startswith(tuple(bot.config.core.prefix_list)):
@ -87,20 +88,3 @@ def bot_command_rule(bot, trigger):
else:
bot.osd("I don't know what you are asking me to do!")
return
def return_utf(s):
if isinstance(s, str):
return s.encode('utf-8')
if isinstance(s, (int, float, complex)):
return str(s).encode('utf-8')
try:
return s.encode('utf-8')
except TypeError:
try:
return str(s).encode('utf-8')
except AttributeError:
return s
except AttributeError:
return s
return s # assume it was already utf-8