aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-04-01 22:08:39 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-04-01 22:08:39 +0200
commitfd3d958533a5d438b97e5d1d703ef6afab9fb46a (patch)
tree12bfe37731a0d930ef050bad8c3bd5c3480b698b
parent10b516b1b82479d6547c25edca36ad3629bbcd2c (diff)
downloaddiscord-fd3d958533a5d438b97e5d1d703ef6afab9fb46a.zip
discord-fd3d958533a5d438b97e5d1d703ef6afab9fb46a.tar.bz2
-rw-r--r--jh-discord.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/jh-discord.py b/jh-discord.py
index 543269b..57116bf 100644
--- a/jh-discord.py
+++ b/jh-discord.py
@@ -97,7 +97,8 @@ async def on_message(message):
has_lock = False
try:
- msg = bytes(message.clean_content.replace('\n', ' '), "utf8", 'ignore')
+ msg_encoded = message.clean_content.encode('utf-8')
+ msg = msg_encoded.replace(b'\n', b' ')
server_mutex.acquire()
has_lock = True
@@ -115,11 +116,11 @@ async def on_message(message):
+ " <"
+ str(message.author.name)
+ "> "
- + str(message.clean_content)
+ + str(msg_encoded)
)
if (len(result) > 0):
- print("#" + str(message.channel.name) + " <- " + result)
+ print("#" + str(message.channel.name) + " <- " + str(result.encode('utf-8')))
if (len(result) > 0):
await client.send_message(message.channel, result)