Replace irc.bot_response and irc.bot_response_bytes with an interface that autoconverts if needed

This commit is contained in:
Juhani Krekelä 2018-01-20 16:49:37 +02:00
parent 6a2a7503cb
commit a74173fee2
1 changed files with 3 additions and 4 deletions

View File

@ -75,11 +75,10 @@ class API:
self.serverthread_object.send_line_raw(line)
def bot_response(self, recipient, message):
"""Prefix message with ZWSP and convert from unicode to bytestring."""
self.msg(recipient, ('\u200b' + message).encode('utf-8'))
"""Prefix message with ZWSP and convert from unicode to bytestring if necessary."""
if isinstance(message, str):
message = message.encode('utf-8')
def bot_response_bytes(self, recipient, message):
"""Prefix message (bytestring) with ZWSP"""
self.msg(recipient, '\u200b'.encode('utf-8') + message)
def nick(self, nick):