Skip to content

Commit

Permalink
Handle slack html entity escaping properly
Browse files Browse the repository at this point in the history
  • Loading branch information
David Rorex committed Jun 20, 2016
1 parent 47be224 commit 9230531
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions slackups/slackgateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,13 @@ def slackMessage(self, channel, user, text):

conv = self.chanToConv(channel)
logger.info(text.encode('utf-8'))
msg = emoji.shortcode_to_emoji(text)
logger.info(msg.encode('utf-8'))
self.sent_messages[channel+msg] = True
segments = hangups.ChatMessageSegment.from_str(msg)
text = emoji.shortcode_to_emoji(text)
text = re.sub(r'<([^|>]*)\|([^>]*)>', r'\2 - \1', text)
text = re.sub(r'<([^|>]*)>', r'\1', text)
text = text.replace('&lt;','<').replace('&gt;','>').replace('&amp;','&')
logger.info(text.encode('utf-8'))
self.sent_messages[channel+text] = True
segments = hangups.ChatMessageSegment.from_str(text)
asyncio.async(conv.send_message(segments))

def convHash(self, conv):
Expand Down

0 comments on commit 9230531

Please sign in to comment.